:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-muted: #f0f3ee;
  --text: #1f2933;
  --muted: #647078;
  --line: #d9dfd4;
  --accent: #157f6e;
  --accent-strong: #0f6659;
  --accent-soft: #dceee9;
  --warn: #a05a00;
  --warn-soft: #fff2d9;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --blue: #2868a8;
  --blue-soft: #e1eefb;
  --shadow: 0 12px 28px rgba(31, 41, 51, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #edf1eb;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 0 0 16px;
  border-bottom-color: var(--line);
  color: var(--text);
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.login-heading h1 {
  margin: 0;
  font-size: 26px;
}

.login-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-submit {
  width: 100%;
}

.login-hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
  padding: 18px 14px;
  background: #26332f;
  color: #f6faf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(246, 250, 247, 0.68);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: rgba(246, 250, 247, 0.8);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-symbol {
  color: rgba(246, 250, 247, 0.55);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
}

.db-chip {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: rgba(246, 250, 247, 0.7);
  font-size: 12px;
  word-break: break-word;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.92);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.view-root {
  padding: 22px 26px 40px;
}

.section {
  display: grid;
  gap: 16px;
}

.section-spacer {
  height: 14px;
}

.task-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notice-band {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfa;
}

.notice-band strong {
  font-size: 15px;
}

.notice-band span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.panel,
.kpi,
.modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  overflow: hidden;
}

.panel-header,
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 16px;
}

.kpi {
  padding: 16px;
  box-shadow: none;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.kpi-value {
  margin-top: 9px;
  font-size: 29px;
  font-weight: 800;
  line-height: 1;
}

.kpi-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.report-filter-toolbar {
  margin-bottom: 14px;
}

.report-search-field {
  min-width: 280px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.is-hidden {
  display: none !important;
}

.field.compact {
  min-width: 150px;
}

.field span,
.form-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(21, 127, 110, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-strong);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn:disabled:hover {
  background: var(--accent);
}

.btn.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

.btn.secondary:hover {
  background: var(--surface-muted);
}

.btn.danger {
  background: var(--danger);
}

.btn.danger:hover {
  background: #8f1d14;
}

.btn.icon {
  width: 38px;
  padding: 8px;
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 158px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  background: #f8faf7;
  color: #425047;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: #fbfcfa;
}

tr[data-task-row] {
  cursor: default;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: #425047;
  font-size: 12px;
  font-weight: 700;
}

.tag.green {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 80px;
  gap: 12px;
  align-items: center;
}

.progress {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e4e9e0;
}

.progress span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.area-list {
  display: grid;
  gap: 12px;
}

.area-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.area-code {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.area-name {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 800;
}

.metric-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-box {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.metric-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.assignment-grid {
  display: grid;
  gap: 10px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr);
  gap: 10px;
  align-items: center;
}

.task-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.assignment-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.check-field input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.multi-check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.multi-check-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.multi-check-item:has(input:checked) {
  border-color: rgba(21, 127, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.multi-check-item input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.multi-check-item span {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.assignment-table {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.assignment-table table {
  min-width: 680px;
}

.assignment-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.import-drop {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 138px;
  padding: 20px;
  border: 1px dashed #9fb1a7;
  border-radius: 8px;
  background: #fbfcfa;
  text-align: center;
}

.import-drop input {
  max-width: 280px;
}

.file-meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-host {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.38);
}

.modal-host[hidden] {
  display: none;
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #ffffff;
}

.modal.wide {
  width: min(1180px, 100%);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 16px;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .brand {
    justify-content: center;
  }

  .brand > div:not(.brand-mark),
  .nav-item span:last-child,
  .sidebar-footer {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 0;
    padding: 10px;
  }

  .brand {
    display: none;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(78px, 1fr);
    overflow-x: auto;
  }

  .nav-item {
    min-height: 38px;
  }

  .nav-item span:last-child {
    display: block;
    font-size: 12px;
    text-align: center;
  }

  .nav-symbol {
    display: none;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .topbar-controls,
  .topbar-controls .field,
  .toolbar-left,
  .toolbar-right,
  .toolbar-left .field,
  .toolbar-right .field {
    width: 100%;
  }

  .view-root {
    padding: 16px;
  }

  .kpi-grid,
  .split,
  .form-grid,
  .metric-pair {
    grid-template-columns: 1fr;
  }

  .assignment-row {
    grid-template-columns: 1fr;
  }
}
