:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #182028;
  background: #f4f6f7;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f6f7; }
.hidden { display: none !important; }
button, select, textarea, input { font: inherit; letter-spacing: 0; }
button, select, input { min-height: 38px; border: 1px solid #c9d0d5; border-radius: 6px; background: #fff; color: #25313a; padding: 0 12px; }
button { cursor: pointer; font-weight: 650; }
button:hover { border-color: #67747e; background: #f7f9fa; }
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid #94c4b5; outline-offset: 2px; }
.primary { background: #176b55; border-color: #176b55; color: #fff; }
.primary:hover { background: #125844; border-color: #125844; }

.topbar { min-height: 94px; padding: 20px clamp(18px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #17242d; color: #fff; }
.topbar h1 { margin: 3px 0 0; font-size: 25px; line-height: 1.2; }
.eyebrow { margin: 0; color: #6b7983; font-size: 12px; font-weight: 750; text-transform: uppercase; }
.topbar .eyebrow { color: #9db0bb; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.compact-control { display: grid; gap: 3px; margin: 0; color: #c8d4da; font-size: 11px; }
.compact-control select { min-width: 148px; }
#citySelect { min-width: 220px; }
.city-search-control input { width: 150px; }
.environment { font-size: 13px; color: #d9e1e5; white-space: nowrap; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #53c89b; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef2f3; }
.login-panel { width: min(420px, 100%); padding: 28px; border: 1px solid #d3dade; border-radius: 8px; background: #fff; box-shadow: 0 16px 40px rgba(25, 39, 47, 0.12); }
.login-panel h1 { margin: 5px 0 8px; font-size: 27px; }
.login-panel button { width: 100%; margin-top: 18px; }
.login-panel .notice { margin-top: 12px; }

.tabs { display: flex; gap: 4px; padding: 0 clamp(18px, 4vw, 56px); background: #fff; border-bottom: 1px solid #d9dfe3; overflow-x: auto; }
.tab { min-width: 108px; border: 0; border-radius: 0; border-bottom: 3px solid transparent; background: transparent; }
.tab.active { color: #176b55; border-bottom-color: #176b55; }

main { width: min(1500px, 100%); margin: 0 auto; padding: 24px clamp(18px, 4vw, 56px) 56px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { min-height: 82px; padding: 15px 17px; border: 1px solid #d7dde1; border-radius: 7px; background: #fff; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: #65727c; font-size: 13px; }
.metric strong { font-size: 27px; line-height: 1; }
.notice { min-height: 24px; margin: 0 0 8px; color: #176b55; font-weight: 650; }
.notice.error { color: #a33b37; }

.view { display: none; }
.view.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 10px 0 14px; }
.section-heading h2 { margin: 4px 0 0; font-size: 21px; }
.commands { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid #d7dde1; border-radius: 7px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e5e9eb; text-align: left; vertical-align: top; font-size: 13px; }
th { background: #edf1f2; color: #4d5b64; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.store-name { display: block; font-size: 14px; font-weight: 750; margin-bottom: 4px; }
.muted { color: #6d7982; }
.tag { display: inline-flex; align-items: center; min-height: 24px; margin: 0 4px 4px 0; padding: 2px 7px; border-radius: 4px; background: #e8f2ee; color: #176b55; font-size: 12px; font-weight: 700; }
.tag.warn { background: #fff0d2; color: #795300; }
.tag.block { background: #f7e4e3; color: #963833; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { min-height: 32px; padding: 0 9px; font-size: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.split > * { min-width: 0; }
.split h3 { margin: 0 0 9px; font-size: 15px; }
.task-create { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; align-items: end; gap: 14px; margin: 0 0 18px; padding: 14px 0 18px; border-bottom: 1px solid #d7dde1; }
.task-create label { margin: 0; }
.task-city-status { min-height: 38px; display: grid; align-content: center; gap: 2px; }
.task-city-status span { color: #6d7982; font-size: 12px; }
.task-city-status strong { font-size: 14px; }
.field-search { width: 100%; margin: 8px 0 12px; }
.city-selection-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.city-selection-tools label { display: flex; align-items: center; gap: 7px; margin: 0; }
.city-selection-tools input { width: auto; min-height: auto; }
.city-selection-tools .muted { white-space: nowrap; }
.city-checkboxes { max-height: 260px; overflow-y: auto; align-content: start; padding-right: 4px; }
.city-checkboxes .province-label { grid-column: 1 / -1; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e5e9eb; color: #25313a; font-size: 12px; }
.city-checkboxes .province-label:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

dialog { width: min(480px, calc(100vw - 28px)); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 20px 60px rgba(15, 25, 32, 0.25); }
dialog::backdrop { background: rgba(20, 30, 36, 0.58); }
dialog form { padding: 20px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-size: 19px; }
.icon-button { width: 38px; padding: 0; font-size: 24px; }
label { display: grid; gap: 6px; margin-top: 14px; color: #4f5d66; font-size: 13px; font-weight: 700; }
fieldset { margin-top: 14px; border: 1px solid #c9d0d5; border-radius: 6px; }
legend { color: #4f5d66; font-size: 13px; font-weight: 700; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.checkbox-grid label { display: flex; align-items: center; gap: 7px; margin: 0; }
.checkbox-grid input { min-height: auto; }
textarea { min-height: 92px; resize: vertical; border: 1px solid #c9d0d5; border-radius: 6px; padding: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 820px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { align-items: flex-end; flex-direction: column; }
  .compact-control { width: 100%; }
  .compact-control select { width: 100%; }
  .city-search-control input { width: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .task-create { grid-template-columns: 1fr; align-items: stretch; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  .topbar { min-height: 136px; flex-direction: column; }
  .topbar-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .metrics { gap: 8px; }
  .city-selection-tools { align-items: flex-start; flex-direction: column; gap: 6px; }
  .metric { min-height: 74px; padding: 12px; }
  .metric strong { font-size: 23px; }
  .commands, .commands select, .commands button { width: 100%; }
}
