:root {
  --bg: #eef2f9;
  --surface: #f4f7fd;
  --card: #ffffff;
  --ink: #101f36;
  --ink-2: #47597a;
  --ink-3: #64748b;
  --brand: #006eff;
  --brand-deep: #0056d6;
  --brand-soft: #e8f1ff;
  --brand-line: #cfe0fb;
  --line: #e3eaf6;
  --ok: #0b7a4b;
  --warn: #9a5b00;
  --danger: #b42318;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --raise: 0 1px 2px rgba(16, 31, 54, 0.04), 7px 9px 22px rgba(23, 44, 86, 0.07), -7px -9px 20px rgba(255, 255, 255, 0.9);
  --raise-sm: 0 1px 2px rgba(16, 31, 54, 0.05), 4px 5px 12px rgba(23, 44, 86, 0.06), -4px -5px 12px rgba(255, 255, 255, 0.9);
  --raise-hover: 0 1px 2px rgba(16, 31, 54, 0.05), 10px 13px 28px rgba(23, 44, 86, 0.1), -8px -10px 24px rgba(255, 255, 255, 0.95);
  --inset: inset 2px 2px 5px rgba(23, 44, 86, 0.09), inset -2px -2px 5px rgba(255, 255, 255, 0.95);
  --inset-soft: inset 1px 1px 3px rgba(23, 44, 86, 0.07), inset -1px -1px 3px rgba(255, 255, 255, 0.9);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }


html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(120% 90% at 82% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 58%), var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 60;
}
.boot-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--raise);
  color: var(--ink-2);
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--brand-line);
  border-top-color: var(--brand);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(384px, 100%);
  padding: 28px 26px 22px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--raise);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand h1 { font-size: 19px; }
.login-brand p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #2f8bff 0%, var(--brand) 52%, var(--brand-deep) 100%);
  box-shadow: 0 6px 14px rgba(0, 110, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.brand-mark svg { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--inset-soft);
  color: var(--ink);
  font: inherit;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}
.field input::placeholder { color: #93a3b8; }
.field input:hover { border-color: var(--brand-line); }
.field input:focus {
  outline: none;
  border-color: var(--brand-line);
  box-shadow: var(--inset-soft), 0 0 0 3px rgba(0, 110, 255, 0.14);
}
.login-error { min-height: 18px; font-size: 12.5px; color: var(--danger); }
.login-foot { font-size: 11.5px; color: var(--ink-3); text-align: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--raise-sm);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 160ms ease, color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { box-shadow: var(--raise-hover); color: var(--ink); }
.btn:active { box-shadow: var(--inset-soft); }
.btn-primary {
  background: linear-gradient(180deg, #2f8bff 0%, var(--brand) 60%, var(--brand-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 110, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { color: #fff; box-shadow: 0 9px 22px rgba(0, 110, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-primary:active { box-shadow: inset 0 2px 6px rgba(6, 40, 92, 0.35); }
.btn-block { width: 100%; padding: 11px 16px; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #f7faff 0%, var(--surface) 100%);
  box-shadow: 6px 0 22px rgba(23, 44, 86, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-text span { font-size: 11.5px; color: var(--ink-3); }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; color: #7a8ba6; transition: color 160ms ease; }
.nav-item:hover { color: var(--ink); background: rgba(255, 255, 255, 0.72); box-shadow: var(--raise-sm); }
.nav-item:hover svg { color: var(--brand); }
.nav-item.is-active {
  color: var(--brand-deep);
  background: var(--card);
  box-shadow: var(--raise-sm);
}
.nav-item.is-active svg { color: var(--brand); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  transform: translateY(-50%);
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #18a06a;
  box-shadow: 0 0 0 3px rgba(24, 160, 106, 0.14);
}
.pulse.is-off { background: #b42318; box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14); }
.dot-sep { color: #c3cedd; }

.main { min-width: 0; padding: 24px 28px 40px; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.topbar-title h2 { font-size: 22px; letter-spacing: -0.02em; }
.topbar-title p { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.range {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--inset-soft);
}
.range button {
  padding: 6px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.range button:hover { color: var(--ink); }
.range button.is-active {
  background: var(--card);
  color: var(--brand-deep);
  box-shadow: var(--raise-sm);
}

.view { display: flex; flex-direction: column; gap: 16px; }

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.card {
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--raise);
  padding: 18px 20px;
}
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.kpi-label svg { width: 15px; height: 15px; color: #8fa1ba; }
.kpi-value { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.trend-up { color: var(--ok); }
.trend-down { color: var(--danger); }
.trend-flat { color: var(--ink-3); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 14.5px; }
.card-head span { font-size: 12px; color: var(--ink-3); }

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

.chart { width: 100%; height: 210px; display: block; }
.chart-legend { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
.legend-users { background: var(--brand); }
.legend-amount { background: #9dc4ff; }

.rank { display: flex; flex-direction: column; gap: 2px; }
.rank-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  transition: background-color 150ms ease;
}
.rank-row:hover { background: #f6f9ff; }
.rank-no {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface);
  box-shadow: var(--inset-soft);
}
.rank-main { min-width: 0; }
.rank-main strong { display: block; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-main span { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-val small { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); text-align: right; }

.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  background: #f7faff;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f0f4fb; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 150ms ease; }
tbody tr:hover { background: #f7faff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.phone { display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.phone-reveal {
  border: 0;
  padding: 1px 7px;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--inset-soft);
  color: var(--ink-3);
  font-size: 11px;
  cursor: pointer;
  transition: color 150ms ease, box-shadow 150ms ease;
}
.phone-reveal:hover { color: var(--brand-deep); box-shadow: var(--raise-sm); }
.phone-full { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--inset-soft);
  white-space: nowrap;
}
.badge-open { background: var(--brand-soft); color: var(--brand-deep); box-shadow: none; }
.badge-settle { background: #e8f7ef; color: var(--ok); box-shadow: none; }
.badge-start { background: #eef2ff; color: #3730a3; box-shadow: none; }
.badge-login { background: #fdf3e3; color: var(--warn); box-shadow: none; }
.badge-resume { background: #f1f4fa; color: var(--ink-2); box-shadow: none; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--inset-soft);
  min-width: 220px;
}
.search svg { width: 15px; height: 15px; color: #8fa1ba; }
.search input {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.search input::placeholder { color: #93a3b8; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; }
.pager-info { font-size: 12px; color: var(--ink-3); }
.pager-btns { display: flex; gap: 8px; }

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}
.empty strong { display: block; color: var(--ink-2); font-size: 13.5px; margin-bottom: 4px; }

.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.settings-list { display: flex; flex-direction: column; gap: 0; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 2px;
  border-bottom: 1px solid #f0f4fb;
  font-size: 13px;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row > div { min-width: 0; }
.setting-row strong { display: block; font-weight: 550; }
.setting-row span { font-size: 12px; color: var(--ink-3); }
.setting-row code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--inset-soft);
  color: var(--ink-2);
}

.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--inset-soft);
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  resize: vertical;
  min-height: 76px;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}
.field textarea::placeholder { color: #93a3b8; }
.field textarea:hover { border-color: var(--brand-line); }
.field textarea:focus {
  outline: none;
  border-color: var(--brand-line);
  box-shadow: var(--inset-soft), 0 0 0 3px rgba(0, 110, 255, 0.14);
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.radio input { accent-color: var(--brand); }

.picker {
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--inset-soft);
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.picker-row:hover { background: var(--card); box-shadow: var(--raise-sm); }
.picker-row input { accent-color: var(--brand); }
.picker-row span:nth-of-type(2) {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--inset-soft);
  font-size: 12.5px;
  color: var(--ink);
}
.chip em { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.chip-x {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  transition: color 150ms ease;
}
.chip-x:hover { color: var(--danger); }

.duty-select {
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--inset-soft);
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  max-width: 100%;
}
.duty-select:hover { border-color: var(--brand-line); }
.duty-select:focus {
  outline: none;
  border-color: var(--brand-line);
  box-shadow: var(--inset-soft), 0 0 0 2px rgba(0, 110, 255, 0.16);
}
tbody tr.is-current-week td { background: #f2f7ff; }

tr.duty-month td {
  padding: 16px 12px 6px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
tr.duty-month:first-child td { padding-top: 4px; }

.duty-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface);
  color: var(--ink-3);
  box-shadow: var(--inset-soft);
  vertical-align: 1px;
}
.duty-tag.is-now { background: var(--brand-soft); color: var(--brand-deep); box-shadow: none; }

@media (max-width: 1180px) {
  .split-duty { grid-template-columns: minmax(0, 1fr); }
}



@media (max-width: 1180px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    overflow-x: auto;
    box-shadow: 0 6px 18px rgba(23, 44, 86, 0.06);
  }
  .brand-text span, .sidebar-foot { display: none; }
  .brand { padding: 0; }
  .nav { flex-direction: row; gap: 4px; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .nav-item.is-active::before { display: none; }
  .main { padding: 18px 16px 32px; }
  .topbar { align-items: flex-start; }
}
@media (max-width: 640px) {
  .grid-kpi { grid-template-columns: minmax(0, 1fr); }
  .split-2 { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 26px; }
  .topbar-title h2 { font-size: 19px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .topbar-actions { width: 100%; }
}

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