:root {
  --bg: #f1f6f3;
  --surface: #ffffff;
  --paper: #f5f9f6;
  --ink: #172a21;
  --muted: #475c50;
  --faint: #5d7367;
  --line: #dce7df;
  --line-strong: #b4c8bb;
  --accent: #126247;
  --accent-2: #0c4f38;
  --accent-soft: #e2f2e9;
  --accent-ring: rgba(18, 98, 71, 0.15);
  --accent-ink: #ffffff;
  --wait: var(--accent);
  --due: #93501a;
  --done: #1e6b3b;
  --miss: #b42318;
  --off: var(--muted);
  --radius: 16px;
  --control: 10px;
  --shadow: 0 1px 2px rgba(18, 48, 33, 0.045), 0 8px 24px rgba(18, 48, 33, 0.04);
  --shadow-sm: 0 1px 2px rgba(18, 48, 33, 0.055);
  --ease: 150ms cubic-bezier(0.2, 0, 0, 1);
  --font: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image: radial-gradient(1100px 440px at 50% -150px, #e1efe6 0%, rgba(225, 239, 230, 0) 72%);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--ease);
}

a:hover {
  text-decoration: underline;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 32px) 72px;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 11px 16px;
  background: #fdf8ec;
  border: 1px solid #ead8b1;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  color: #5a3d0b;
}

#accountOwnerBanner {
  background: #eaf5ef;
  border-color: #bed9ca;
  color: #134a35;
}

.banner p {
  margin: 0;
  flex: 1 1 240px;
}

.banner a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 650;
  background: rgba(90, 61, 11, 0.08);
  color: #5a3d0b;
  text-decoration: none;
  transition: background-color var(--ease);
}

.banner a:hover {
  background: rgba(90, 61, 11, 0.14);
  text-decoration: none;
}

#accountOwnerBanner a {
  background: rgba(18, 98, 71, 0.1);
  color: var(--accent);
}

#accountOwnerBanner a:hover {
  background: rgba(18, 98, 71, 0.17);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "brand nav user";
  align-items: center;
  gap: 12px 20px;
  margin: 0 0 20px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.topbar .brand {
  grid-area: brand;
  justify-self: start;
}

.mark {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #167454 0%, #0d4f38 100%);
  color: var(--accent-ink);
  box-shadow: 0 3px 10px rgba(18, 98, 71, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform var(--ease), box-shadow var(--ease);
}

a.brand:hover .mark {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(18, 98, 71, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.mark svg {
  width: 24px;
  height: 24px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 14px;
}

h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

h2 + .job-schedule {
  margin: -8px 0 16px;
  font-weight: 550;
}

.job-schedule.on {
  color: var(--done);
}

.job-schedule.off {
  color: var(--muted);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 1px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-nav {
  grid-area: nav;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.topbar-nav a {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 4px 16px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--ease), color var(--ease);
}

.topbar-nav a:hover {
  background: var(--paper);
  color: var(--ink);
}

.topbar-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.account-switcher,
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-switcher {
  margin: 0 0 16px;
}

#deleteAccountBtn:hover:not(:disabled) {
  background: #fdf0ef;
  color: var(--miss);
  border-color: #efc3be;
}

.topbar-user {
  grid-area: user;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-user button {
  flex-shrink: 0;
}

.who {
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who:not(:empty) {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 550;
}

.field-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.field-inline select {
  min-width: 156px;
  max-width: 240px;
}

.form-strip {
  display: flex;
  align-items: flex-end;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-strip label {
  margin: 0;
  flex: 1 1 220px;
}

.form-strip .hint {
  flex: 1 1 100%;
  margin: 0;
}

.form-strip .actions {
  margin: 0;
}

.stage {
  margin: 0 0 16px;
}

.card,
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.3vw, 26px);
  box-shadow: var(--shadow);
}

.today {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(250px, 0.82fr);
  align-items: center;
  gap: 24px 32px;
  margin: 0 0 20px;
  background: linear-gradient(125deg, var(--surface) 38%, #e5f3eb 100%);
  transition: background var(--ease), border-color var(--ease);
}

.today[data-status="due"] {
  background: linear-gradient(125deg, var(--surface) 40%, #fdf1e2 100%);
  border-color: #ebd6bc;
}

.today[data-status="failed"] {
  background: linear-gradient(125deg, var(--surface) 42%, #fdeeed 100%);
  border-color: #efc9c5;
}

.today[data-status="off"] {
  background: linear-gradient(125deg, var(--surface) 46%, #eef3f0 100%);
}

.today[data-run="1"] {
  background: linear-gradient(125deg, var(--surface) 34%, #dff2e7 100%);
  border-color: #b7dbc7;
}

@keyframes livePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.84);
  }
}

.today[data-run="1"] .today-main .kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 98, 71, 0.16);
  animation: livePulse 1.6s ease-in-out infinite;
}

.today[data-run="1"] .kicker::after {
  content: " · 进行中";
  color: var(--accent);
}

.status-word {
  margin: 6px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.today[data-status="due"] .status-word {
  color: var(--due);
}

.today[data-status="wait"] .status-word,
.today[data-run="1"] .status-word {
  color: var(--wait);
}

.today[data-status="done"] .status-word {
  color: var(--done);
}

.today[data-status="failed"] .status-word {
  color: var(--miss);
}

.today[data-status="off"] .status-word {
  color: var(--off);
}

.status-sub {
  margin: 10px 0 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: 13.5px;
}

.today-side {
  display: grid;
  gap: 12px;
}

.today-meta {
  margin: 0;
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.today-side .today-meta > div {
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(180, 200, 187, 0.55);
}

.today-meta dt {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.today-meta dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 550;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.actions.today-actions {
  margin-top: 0;
}

.today-actions button {
  flex: 1 1 auto;
}

#stopTaskBtn:not(:disabled) {
  color: var(--miss);
  border-color: #e6a6a2;
  background: #fff4f3;
}

#stopTaskBtn:not(:disabled):hover {
  background: #fde8e6;
  border-color: #dc8f8a;
}

.meter {
  margin-top: 18px;
  max-width: 380px;
}

.meter-bar {
  height: 8px;
  background: rgba(23, 42, 33, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.meter-bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, #1d8360 100%);
  transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.meter-label {
  margin: 7px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 18px 28px;
  align-items: end;
  margin: 0 0 16px;
}

.login-copy h2 {
  margin-bottom: 8px;
}

.login-copy .field-inline {
  margin: 0 0 10px;
}

.login-status {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
}

.login-copy .hint {
  margin: 0;
}

.login-forms {
  display: grid;
  gap: 10px;
}

.login-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}

.login-row label {
  margin: 0;
  flex: 1 1 180px;
}

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

.dashboard-grid,
.track-grid,
.settings-grid {
  align-items: start;
}

.grid + .grid {
  margin-top: 16px;
}

.track-grid {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.43fr);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-heading h2 {
  margin: 0;
}

.card-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#routeEditor {
  margin-top: 18px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.log-panel,
.card + .card,
.grid + .card {
  margin-top: 16px;
}

.grid > .card {
  margin-top: 0;
}

.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.log-head h2 {
  margin-bottom: 0;
}

.log-head .hint {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
}

.map,
.log-view {
  border: 1px solid var(--line);
  border-radius: 12px;
}

.map {
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #eef5f1 100%);
  box-shadow: inset 0 1px 2px rgba(23, 42, 33, 0.035);
}

.log-view {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 12px 14px;
  background: var(--paper);
  font: 12.5px/1.68 var(--mono);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.log-view.is-empty {
  padding: 20px 16px;
  color: var(--faint);
  font-family: var(--font);
  font-size: 13px;
  text-align: center;
}

.log-line {
  padding: 2px 6px;
  border-radius: 6px;
}

.log-line:hover {
  background: rgba(18, 98, 71, 0.05);
}

.log-time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.log-line.is-ok .log-body {
  color: var(--done);
  font-weight: 600;
}

.log-line.is-err {
  background: rgba(180, 35, 24, 0.055);
}

.log-line.is-err .log-body {
  color: var(--miss);
  font-weight: 600;
}

.log-line.is-warn .log-body {
  color: var(--due);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="time"],
input[type="url"],
input[type="password"],
input[type="tel"],
input:not([type]),
select {
  appearance: none;
  min-width: 0;
  min-height: 42px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--control);
  padding: 9px 12px;
  font: 14px/1.3 var(--font);
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

input[type="text"]:hover:not(:disabled),
input[type="search"]:hover:not(:disabled),
input[type="number"]:hover:not(:disabled),
input[type="time"]:hover:not(:disabled),
input[type="url"]:hover:not(:disabled),
input[type="password"]:hover:not(:disabled),
input[type="tel"]:hover:not(:disabled),
input:not([type]):hover:not(:disabled),
select:hover:not(:disabled) {
  border-color: #96b0a0;
}

select {
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

:where(a, button, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

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

.form-section {
  min-inline-size: 0;
  margin: 0 0 14px;
  padding: 10px 14px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(245, 249, 246, 0.45);
}

.form-section legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 650;
}

.form-options {
  margin: 0 0 12px;
  border-radius: var(--control);
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0 13px;
}

.form-options summary {
  padding: 9px 0;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.form-options label,
.form-options .hint {
  margin: 4px 0 0;
  padding-bottom: 12px;
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}

.check input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: #c5d5cb;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--ease), box-shadow var(--ease);
}

.check input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(17, 36, 27, 0.26);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.check input[type="checkbox"]:checked {
  background: var(--accent);
}

.check input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.check input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.hint {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.hint.err {
  color: var(--miss);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

button,
a.button {
  min-height: 42px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: var(--control);
  padding: 8px 15px;
  font: 650 14px/1.2 var(--font);
  box-shadow: 0 1px 2px rgba(11, 77, 55, 0.2);
  cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease), transform 90ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-2);
  box-shadow: 0 2px 6px rgba(11, 77, 55, 0.24);
}

button:active:not(:disabled),
a.button:active {
  transform: translateY(0.5px);
}

button:disabled {
  opacity: 0.44;
  box-shadow: none;
  cursor: not-allowed;
}

a.button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

a.button:hover {
  background: var(--accent-2);
  text-decoration: none;
}

button.quiet,
a.button.quiet {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}

button.quiet:hover:not(:disabled),
a.button.quiet:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #b7d6c4;
}

.flash {
  flex-basis: 100%;
  margin: 2px 0 0;
  padding: 8px 12px;
  border-radius: 9px;
  background: #e8f5ed;
  border: 1px solid #c3dfd0;
  font-size: 13px;
  font-weight: 500;
  color: var(--done);
}

.flash.err {
  background: #fdf0ef;
  border-color: #efc3be;
  color: var(--miss);
}

#accountFlash,
#settingsFlash,
#pageFlash {
  margin: 0 0 16px;
}

.track-name {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
  color: var(--muted);
}

.map {
  height: 230px;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 13px;
}

.track-actions {
  margin: 10px 0 16px;
}

.track-grid .map {
  height: clamp(225px, 32vw, 320px);
}

.preview-track {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.preview-track .hint {
  flex: 1 1 160px;
  margin: 0;
  overflow-wrap: anywhere;
}

#runPreview, #routeEditor, #notify { scroll-margin-top: 16px; }
#routeStadium { margin-bottom: 12px; }
#routeMap { height: clamp(280px, 48vh, 460px); width: 100%; border-radius: 10px; border: 1px solid var(--line); z-index: 0; }
#routeLocation { flex: 1 1 160px; }
#routeLocationForm, .route-tools { flex-wrap: wrap; margin: 10px 0; }
#routeSummary { margin-top: 8px; }
.route-point {
  background: #0d5c42;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(13, 92, 66, 0.35);
  text-align: center;
  line-height: 24px;
  font: bold 12px/24px var(--font);
}
#routeMap .leaflet-control-attribution { font-size: 10px; }

.map svg {
  width: 100%;
  height: 100%;
  display: block;
}

.file {
  gap: 8px;
  padding: 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease);
}

.file:hover {
  border-color: var(--accent);
  background: #edf6f0;
}

.file.is-dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.file.has-file {
  border-color: #84b49a;
  background: #edf6f1;
}

.file-title {
  color: var(--ink);
  font-weight: 600;
}

.file-sub {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.file.has-file .file-sub {
  color: var(--accent);
  font-weight: 550;
}

.file input {
  width: 100%;
  margin-top: 2px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
}

.file input::file-selector-button {
  margin-right: 10px;
  min-height: 34px;
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font: 550 13px/1.2 var(--font);
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}

.file input::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.track-upload .form-options {
  margin: 16px 0 0;
}

.empty {
  margin: 24px 0;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.boot-error {
  min-height: 72vh;
  display: grid;
  place-items: center;
  justify-items: center;
  text-align: center;
}

.boot-error .empty {
  width: min(520px, 100%);
  margin-bottom: 16px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.account-bar span {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.account-bar button {
  flex-shrink: 0;
}

.settings-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.secret-output {
  margin-top: 12px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  user-select: all;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
}

.quota-input {
  max-width: 84px;
}

.auth-pending {
  visibility: hidden;
}

[hidden] {
  display: none !important;
}

body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px 48px;
}

.auth-page {
  width: min(432px, 100%);
}

.auth-brand {
  margin: 0 0 20px;
}

.auth-card {
  padding: 24px 24px 26px;
}

.auth-card h2 {
  text-transform: none;
  letter-spacing: -0.02em;
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 6px;
}

.auth-card .hint {
  margin: 0 0 18px;
}

.auth-card button[type="submit"] {
  width: 100%;
  padding: 11px 14px;
  margin-top: 4px;
}

.auth-card .passkey-btn {
  width: 100%;
  padding: 11px 14px;
  margin-top: 10px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 20px;
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.auth-tabs button {
  min-height: 36px;
  background: none;
  box-shadow: none;
  border-radius: 8px;
  color: var(--muted);
  padding: 7px 4px;
  font-size: 13.5px;
  font-weight: 600;
}

.auth-tabs button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  color: var(--ink);
}

.auth-tabs button.is-on {
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(18, 48, 33, 0.1);
}

.auth-foot {
  margin: 16px 4px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.sport-lead {
  margin: 0 0 16px;
}

.sport-meta {
  gap: 8px;
  margin: 12px 0 16px;
}

.sport-meta > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid #e2ece5;
}

#resultMeta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#sampleMeta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#trackForm {
  margin-top: 16px;
}

.sport-splits {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.sport-splits th,
.sport-splits td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.sport-splits th {
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(245, 249, 246, 0.7);
}

.sport-splits tbody tr:hover td {
  background: var(--paper);
}

@media (max-width: 800px) {
  .today,
  .grid,
  .login-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand user" "nav nav";
  }

  .topbar-nav a {
    flex: 1;
    padding-inline: 8px;
  }

  .today-side {
    padding-top: 14px;
    border-top: 1px solid rgba(180, 200, 187, 0.5);
  }

  .account-switcher .field-inline {
    flex: 1 1 150px;
    min-width: 0;
  }

  .account-switcher select {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 16px 14px 48px;
  }

  .card,
  .panel {
    padding: 18px 16px;
  }

  .who {
    max-width: 11ch;
  }

  button,
  a.button,
  .topbar-nav a {
    min-height: 44px;
  }

  input:not([type="checkbox"]),
  select {
    font-size: 16px;
  }

  #resultMeta,
  #sampleMeta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions button,
  .route-tools button {
    flex: 1 1 auto;
  }

  .form-actions button[type="submit"] {
    flex-basis: 100%;
  }

  #routeLocation {
    flex-basis: 100%;
  }
}

/* ------------------------------------------------------------------ admin */

.page-wide {
  max-width: 1280px;
}

button.small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.link-button {
  min-height: 32px;
  background: none;
  box-shadow: none;
  color: var(--accent);
  padding: 5px 4px;
  font-weight: 600;
}

.link-button:hover:not(:disabled) {
  background: none;
  box-shadow: none;
  text-decoration: underline;
}

.admin-shell {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.admin-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  transition: background-color var(--ease), color var(--ease);
}

.admin-nav a:hover {
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}

.admin-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.nav-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.admin-nav a[aria-current="page"] .nav-count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--accent-ink);
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  min-height: 32px;
  margin: 0 0 12px;
}

.admin-head .flash {
  flex: 1 1 260px;
  margin: 0;
}

.admin-updated {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0 auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 17px 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat strong {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat .hint {
  margin: 0;
}

.todo-list {
  display: grid;
  gap: 8px;
}

.todo-list > .hint {
  margin: 0;
}

.todo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 16px;
  width: 100%;
  padding: 12px 15px;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: none;
  font-weight: 400;
}

.todo:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: #bfd9ca;
  border-left-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.todo.warn {
  border-left-color: var(--due);
}

.todo.warn:hover:not(:disabled) {
  border-left-color: var(--due);
}

.todo.bad {
  border-left-color: var(--miss);
}

.todo.bad:hover:not(:disabled) {
  border-left-color: var(--miss);
}

.todo strong {
  font-weight: 650;
}

.todo span {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo .todo-go {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--accent);
  font-weight: 600;
  transition: transform var(--ease);
}

.todo:hover:not(:disabled) .todo-go {
  transform: translateX(2px);
}

.table-head .hint {
  margin: -6px 0 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.toolbar input[type="search"] {
  flex: 1 1 220px;
}

.toolbar select {
  flex: 0 1 200px;
  min-width: 140px;
}

.bulkbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--accent-soft);
  border: 1px solid #b9d5c6;
  border-radius: 10px;
  font-size: 13px;
}

.bulkbar > span {
  margin-right: 4px;
  font-weight: 650;
}

.bulkbar select {
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 13px;
}

.inline-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.inline-field input {
  min-height: 34px;
  padding: 5px 8px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.admin-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table th {
  position: sticky;
  top: 0;
  background: var(--paper);
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover td {
  background: #f1f7f3;
}

.admin-table tr.is-off .cell-main {
  color: var(--faint);
}

.admin-table .col-check {
  width: 36px;
  padding-right: 0;
}

.admin-table .col-actions {
  width: 1%;
}

.admin-table select {
  min-height: 34px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 13px;
  max-width: 200px;
}

.cell-main {
  font-weight: 600;
}

.cell-sub {
  color: var(--faint);
  font-size: 12px;
}

.row-actions,
.quota-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quota-cell .quota-input {
  min-height: 34px;
  width: 64px;
  padding: 5px 8px;
}

.table-empty {
  padding: 36px 12px !important;
  text-align: center !important;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge + .badge {
  margin-left: 4px;
}

.badge.ok {
  background: #e4f3e8;
  border-color: #bfe0c8;
  color: var(--done);
}

.badge.warn {
  background: #fbf0e1;
  border-color: #ecd1b0;
  color: var(--due);
}

.badge.bad {
  background: #fcebe9;
  border-color: #efbfb9;
  color: var(--miss);
}

.badge.accent {
  background: var(--accent-soft);
  border-color: #b9d5c6;
  color: var(--accent);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.pager .hint {
  margin: 0;
}

.ticket-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgba(17, 36, 27, 0.2);
}

.ticket-dialog::backdrop {
  background: rgba(17, 36, 27, 0.42);
  backdrop-filter: blur(3px);
}

.ticket-dialog h2 {
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .admin-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 5px;
  }

  .admin-nav a {
    flex-shrink: 0;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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