:root {
  --brand: #006b62;
  --brand-dark: #005149;
  --brand-soft: #d5efea;
  --canvas: #f7f9f7;
  --surface: #ffffff;
  --surface-soft: #f0f3f1;
  --surface-muted: #e9eeeb;
  --ink: #1b1c1b;
  --ink-muted: #5d625f;
  --outline: #818985;
  --outline-soft: #d9e0dc;
  --success: #2d6948;
  --success-soft: #dcede2;
  --warning: #725300;
  --warning-soft: #f7e8be;
  --danger: #b3261e;
  --danger-soft: #ffdad6;
  --info: #275d7a;
  --info-soft: #d4e9f5;
  --shadow: 0 18px 50px rgba(20, 45, 39, 0.12);
  --top-height: 66px;
  --bottom-height: 70px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #edf2ef;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #edf2ef; }
body { min-width: 320px; min-height: 100%; margin: 0; background: #edf2ef; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--brand-dark); }
svg { display: block; }

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: clip;
  background: var(--canvas);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: calc(var(--top-height) + env(safe-area-inset-top));
  align-items: center;
  gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  background: rgba(247, 249, 247, 0.96);
  border-bottom: 1px solid rgba(217, 224, 220, 0.7);
  backdrop-filter: blur(14px);
}

.brand-mark {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
}

.topbar-copy { min-width: 0; flex: 1; }
.topbar-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-line { display: flex; align-items: center; gap: 5px; margin-top: 1px; color: var(--ink-muted); font-size: 11px; line-height: 15px; }
.sync-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--success); }
.sync-dot.warning { background: var(--warning); }
.sync-dot.danger { background: var(--danger); }

.detail-topbar { gap: 4px; }
.detail-topbar .topbar-title { font-size: 20px; line-height: 28px; }
.icon-button {
  display: inline-grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-soft); }
.icon-button:focus-visible { outline: 3px solid rgba(0, 107, 98, 0.2); outline-offset: 1px; }
.icon-button svg { width: 24px; height: 24px; }

.screen {
  min-height: calc(100dvh - var(--top-height));
  padding: 14px 16px calc(30px + env(safe-area-inset-bottom));
}
.root-screen { padding-bottom: calc(var(--bottom-height) + 34px + env(safe-area-inset-bottom)); }
.screen-stack { display: grid; gap: 18px; }

.page-heading { margin: 0; font-size: 27px; font-weight: 760; line-height: 34px; letter-spacing: -0.35px; }
.page-subtitle { margin: 3px 0 0; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.section-heading h2 { margin: 0; font-size: 17px; line-height: 24px; }
.section-action { min-height: 40px; padding: 0 4px; color: var(--brand); background: transparent; border: 0; font-size: 13px; font-weight: 700; cursor: pointer; }

.surface {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--outline-soft);
  border-radius: 14px;
}
.surface-pad { padding: 16px; }
.soft-surface { background: var(--surface-soft); border-color: transparent; }

.list-row {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--outline-soft);
}
.list-row:last-child { border-bottom: 0; }
button.list-row, a.list-row { cursor: pointer; text-decoration: none; }
button.list-row:hover, a.list-row:hover { background: #f9fbfa; }
button.list-row:focus-visible, a.list-row:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(0, 107, 98, 0.2); outline-offset: -3px; }
.row-icon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 11px;
}
.row-icon.neutral { color: var(--ink-muted); background: var(--surface-soft); }
.row-icon svg { width: 21px; height: 21px; }
.row-copy { min-width: 0; flex: 1; }
.row-title { margin: 0; font-size: 15px; font-weight: 680; line-height: 21px; }
.row-subtitle { display: -webkit-box; margin: 2px 0 0; overflow: hidden; color: var(--ink-muted); font-size: 12px; line-height: 17px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.row-meta { margin: 4px 0 0; color: var(--ink-muted); font-size: 11px; line-height: 16px; }
.chevron { flex: 0 0 auto; color: var(--ink-muted); }
.chevron svg { width: 20px; height: 20px; }

.status-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 9px;
  color: var(--ink-muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 720;
  line-height: 16px;
  white-space: nowrap;
}
.status-badge.success { color: var(--success); background: var(--success-soft); }
.status-badge.warning { color: var(--warning); background: var(--warning-soft); }
.status-badge.danger { color: var(--danger); background: var(--danger-soft); }
.status-badge.info { color: var(--info); background: var(--info-soft); }

.feature-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 10px 5px; }
.feature-button { display: grid; min-width: 0; min-height: 76px; place-items: center; align-content: center; gap: 7px; padding: 5px 2px; color: var(--ink); background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
.feature-button:hover { background: var(--surface-soft); }
.feature-button:focus-visible { outline: 3px solid rgba(0, 107, 98, 0.2); }
.feature-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--brand-dark); background: var(--surface-soft); border-radius: 12px; }
.feature-icon svg { width: 21px; height: 21px; }
.feature-label { width: 100%; overflow: hidden; font-size: 11px; font-weight: 620; line-height: 15px; text-align: center; white-space: nowrap; text-overflow: ellipsis; }

.notice-row { display: flex; min-height: 62px; align-items: center; gap: 10px; padding: 12px 14px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--outline-soft); border-radius: 14px; }
.notice-row.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.notice-row.warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.notice-row.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.notice-row .notice-copy { min-width: 0; flex: 1; }
.notice-row strong { display: block; color: inherit; font-size: 14px; line-height: 20px; }
.notice-row p { margin: 2px 0 0; color: var(--ink-muted); font-size: 12px; line-height: 18px; }
.notice-row svg { flex: 0 0 22px; width: 22px; height: 22px; }
button.notice-row { width: 100%; text-align: left; cursor: pointer; }

.metrics { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--outline-soft); }
.metric { min-width: 0; padding: 13px 2px 12px; text-align: center; }
.metric + .metric { border-left: 1px solid var(--outline-soft); }
.metric-button { width: 100%; color: inherit; background: transparent; border: 0; cursor: pointer; }
.metric-value { display: block; color: var(--brand-dark); font-size: 18px; font-weight: 800; line-height: 24px; }
.metric.warning .metric-value { color: var(--warning); }
.metric.danger .metric-value { color: var(--danger); }
.metric-label { display: block; overflow: hidden; color: var(--ink-muted); font-size: 10px; line-height: 15px; white-space: nowrap; text-overflow: ellipsis; }
.surface-footer { min-height: 46px; padding: 4px 12px; border-top: 1px solid var(--outline-soft); text-align: center; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(100%, 480px);
  min-height: calc(var(--bottom-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
  margin: 0 auto;
  padding: 5px 5px max(5px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--outline-soft);
  backdrop-filter: blur(14px);
}
.nav-button { display: grid; min-width: 0; min-height: 58px; place-items: center; align-content: center; gap: 2px; color: var(--ink-muted); background: transparent; border: 0; border-radius: 15px; cursor: pointer; }
.nav-button svg { width: 22px; height: 22px; }
.nav-button span { font-size: 11px; line-height: 16px; }
.nav-button.active { color: var(--brand-dark); font-weight: 700; }
.nav-button.active svg { box-sizing: content-box; padding: 4px 14px; background: var(--brand-soft); border-radius: 999px; }
.nav-button:focus-visible { outline: 3px solid rgba(0, 107, 98, 0.2); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.segment { min-height: 42px; padding: 0 12px; color: var(--ink-muted); background: transparent; border: 1px solid var(--outline); border-radius: 9px; font-size: 13px; font-weight: 650; cursor: pointer; }
.segment.active { color: var(--brand-dark); background: var(--brand-soft); border-color: var(--brand-soft); }
.segment:focus-visible { outline: 3px solid rgba(0, 107, 98, 0.2); }

.tool-row { display: flex; align-items: center; gap: 8px; }
.search-field { position: relative; min-width: 0; flex: 1; }
.search-field svg { position: absolute; top: 50%; left: 13px; width: 21px; height: 21px; color: var(--ink-muted); transform: translateY(-50%); pointer-events: none; }
.search-field input { width: 100%; min-height: 48px; padding: 10px 12px 10px 43px; color: var(--ink); background: var(--surface); border: 1px solid var(--outline); border-radius: 9px; }
.compact-select { min-height: 48px; max-width: 142px; padding: 0 34px 0 13px; color: var(--brand-dark); background-color: var(--surface); border: 1px solid var(--outline); border-radius: 999px; font-size: 12px; font-weight: 700; }
.result-count { margin: 8px 0 0; color: var(--ink-muted); font-size: 12px; }

.two-column-grid, .three-column-grid { display: grid; gap: 12px; }
.two-column-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-column-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.action-tile { display: grid; min-height: 112px; place-items: center; align-content: center; gap: 9px; padding: 12px 8px; text-align: center; background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
.action-tile:hover { background: var(--surface-soft); }
.action-tile .feature-icon { width: 48px; height: 48px; }
.action-tile strong { font-size: 13px; line-height: 18px; }
.action-tile small { color: var(--ink-muted); font-size: 11px; line-height: 16px; }

.detail-hero { display: grid; gap: 11px; padding: 17px; background: var(--surface); border: 1px solid var(--outline-soft); border-radius: 14px; }
.detail-title-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title-line h1 { min-width: 0; margin: 0; font-size: 22px; line-height: 29px; }
.detail-hero p { margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 21px; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meta-block { min-width: 0; padding: 11px 12px; background: var(--surface-soft); border-radius: 10px; }
.meta-label { display: block; color: var(--ink-muted); font-size: 11px; line-height: 16px; }
.meta-value { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; line-height: 19px; }

.form-card { display: grid; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--outline-soft); border-radius: 14px; }
.field { display: grid; gap: 7px; }
.field label, .field legend { color: var(--ink); font-size: 13px; font-weight: 700; line-height: 19px; }
.field small { color: var(--ink-muted); font-size: 11px; line-height: 17px; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 50px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 9px;
  outline: none;
}
.field textarea { min-height: 112px; resize: vertical; line-height: 21px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 107, 98, 0.14); }
.field input:disabled, .field textarea:disabled, .field select:disabled { color: var(--ink-muted); background: var(--surface-muted); }
fieldset.field { margin: 0; padding: 0; border: 0; }
.choice-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; min-height: 38px; align-items: center; padding: 7px 11px; color: var(--ink-muted); background: var(--surface); border: 1px solid var(--outline-soft); border-radius: 999px; font-size: 12px; line-height: 18px; cursor: pointer; }
.choice input:checked + span { color: var(--brand-dark); background: var(--brand-soft); border-color: var(--brand); font-weight: 700; }
.choice input:focus-visible + span { outline: 3px solid rgba(0, 107, 98, 0.2); }
.check-line { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: 12px; line-height: 18px; }
.check-line input { flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); }

.primary-button, .secondary-button, .text-button, .danger-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.primary-button svg, .secondary-button svg, .text-button svg, .danger-button svg {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}
.primary-button { color: #fff; background: var(--brand); border: 1px solid var(--brand); }
.secondary-button { color: var(--brand-dark); background: var(--brand-soft); border: 1px solid transparent; }
.text-button { color: var(--brand); background: transparent; border: 1px solid var(--outline); }
.danger-button { color: var(--danger); background: var(--danger-soft); border: 1px solid transparent; }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button:hover, .text-button:hover { background: var(--surface-soft); }
.primary-button:focus-visible, .secondary-button:focus-visible, .text-button:focus-visible, .danger-button:focus-visible { outline: 3px solid rgba(0, 107, 98, 0.22); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.button-row > * { flex: 1 1 140px; }
.full-width { width: 100%; }

.empty-state { display: flex; align-items: flex-start; gap: 10px; padding: 16px; color: var(--info); background: var(--info-soft); border-radius: 12px; }
.empty-state svg { flex: 0 0 22px; width: 22px; height: 22px; }
.empty-state strong { display: block; font-size: 14px; line-height: 20px; }
.empty-state p { margin: 3px 0 0; color: var(--ink-muted); font-size: 12px; line-height: 18px; }

.definition-list { margin: 0; }
.definition-row { display: grid; grid-template-columns: minmax(82px, 0.8fr) minmax(0, 1.6fr); gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--outline-soft); }
.definition-row:last-child { border-bottom: 0; }
.definition-row dt { color: var(--ink-muted); font-size: 12px; line-height: 18px; }
.definition-row dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 620; line-height: 19px; }

.login-shell { display: grid; min-height: 100vh; min-height: 100dvh; align-items: center; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); background: var(--canvas); }
.login-card { width: min(100%, 400px); margin: 0 auto; padding: 24px; background: var(--surface); border: 1px solid var(--outline-soft); border-radius: 22px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 46px; height: 46px; flex-basis: 46px; border-radius: 13px; }
.login-card h1 { margin: 0; font-size: 23px; line-height: 30px; }
.login-card > p { margin: 18px 0 20px; color: var(--ink-muted); font-size: 13px; line-height: 20px; }
.login-error { margin: 12px 0 0; color: var(--danger); font-size: 12px; line-height: 18px; }

.loading-screen { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; background: var(--canvas); }
.loading-mark { display: grid; gap: 12px; place-items: center; color: var(--ink-muted); font-size: 13px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 999px; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; z-index: 60; right: 16px; bottom: calc(var(--bottom-height) + 24px + env(safe-area-inset-bottom)); left: 16px; width: min(calc(100% - 32px), 420px); margin: 0 auto; padding: 12px 14px; color: #fff; background: #25302d; border-radius: 11px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18); font-size: 13px; line-height: 19px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #6f211c; }

.subtle { color: var(--ink-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.break-word { overflow-wrap: anywhere; }
.space-top { margin-top: 14px; }
.hidden { display: none !important; }

@media (min-width: 640px) {
  .app-shell { box-shadow: var(--shadow); }
}

@media (max-width: 365px) {
  .screen { padding-right: 12px; padding-left: 12px; }
  .topbar { padding-right: 10px; padding-left: 10px; }
  .feature-label { font-size: 10px; }
  .feature-icon { width: 38px; height: 38px; }
  .metric-label { font-size: 9px; }
  .three-column-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
