:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  color: #17243a;
  background: #fff;
  --muted: #596980;
  --border: #e0e6ef;
  --blue: #2457d5;
  --blue-hover: #1947bc;
  --surface: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p { margin: 0; }
body { min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #426de1;
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }

.brand { color: #17243a; font-size: 17px; font-weight: 700; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a, .repository-link {
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
nav a:hover, .repository-link:hover { background: #f4f6fb; }
nav [aria-current="page"] { color: #1947bc; background: #eef2f8; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.auth-panel { width: min(100%, 390px); }
.auth-panel form { padding: clamp(20px, 5vw, 32px); }
.auth-heading { display: grid; gap: 8px; margin-bottom: 10px; }
.auth-brand { color: var(--blue); font-size: 14px; font-weight: 700; }
.auth-panel button { margin-top: 8px; }
#setup-token-field label { margin-bottom: 5px; }

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  min-height: 56px;
  padding: 8px clamp(18px, 3vw, 39px);
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}
.content { max-width: 1140px; margin: auto; padding: clamp(22px, 3vw, 34px) clamp(18px, 3vw, 39px); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 25px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
h1 { font-size: clamp(22px, 3vw, 27px); line-height: 1.25; }
.page-header p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.button { min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.primary { background: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: var(--blue-hover); }
.secondary { background: var(--surface); color: #35445b; border-color: var(--border); }
.secondary:hover:not(:disabled) { background: #f5f7fc; }
.danger { background: #fff1f1; color: #ae302d; }
.danger:hover:not(:disabled) { background: #ffe4e3; }
.text-button { border: 0; background: transparent; padding: 6px 7px; border-radius: 5px; color: #2457c3; font-size: 13px; font-weight: 650; }
.text-button:hover:not(:disabled) { background: #edf3ff; }

.metrics { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.metrics strong { color: #17243a; font-variant-numeric: tabular-nums; }
.panel { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th, td { padding: 14px clamp(10px, 1.7vw, 20px); }
th { background: #f8fafd; color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
td { border-top: 1px solid var(--border); min-width: 100px; vertical-align: middle; }
tbody tr:hover { background: #fbfcff; }
.account-name { display: block; font-weight: 650; overflow-wrap: anywhere; min-width: 110px; }
.account-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.action-cell { text-align: right; white-space: nowrap; }
.result-cell { min-width: 145px; overflow-wrap: anywhere; }
.time-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px;
  color: #536176; background: #edf1f6; white-space: nowrap; font-size: 12px; font-weight: 650;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill[data-tone="positive"] { color: #14694e; background: #e8f7f0; }
.pill[data-tone="warning"] { color: #8b4213; background: #fff1dc; }
.pill[data-tone="active"] { color: #174aa8; background: #e9f0ff; }
.empty { display: grid; gap: 8px; justify-items: center; padding: 55px 16px; text-align: center; }
.empty p, .footnote, .field-hint { color: var(--muted); font-size: 13px; line-height: 1.65; }
.footnote { margin-top: 13px; }
.notice { margin: 0 0 15px; padding: 10px 13px; background: #e9f0ff; border-radius: 7px; color: #204581; overflow-wrap: anywhere; }
.notice[data-tone="warning"] { color: #823517; background: #fff1e5; }

dialog { width: min(460px, calc(100% - 28px)); max-height: calc(100vh - 32px); margin: auto; padding: 0; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 60px #14244335; }
dialog::backdrop { background: #17243a61; }
form { display: grid; gap: 9px; padding: 22px; }
.dialog-header, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-header { margin-bottom: 8px; }
h2 { font-size: 20px; }
.icon-button { border: 0; border-radius: 6px; background: #f1f4f9; color: var(--muted); width: 31px; height: 31px; font-size: 19px; }
label { display: block; font-size: 13px; font-weight: 650; }
input:not([type="checkbox"]), select {
  width: 100%; min-width: 0; height: 39px; color: inherit; background: var(--surface); padding: 7px 9px;
  border: 1px solid #cbd5e4; border-radius: 7px; font-size: 14px;
}
.schedule { display: grid; gap: 12px; margin-top: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafd; }
.check-option { display: flex; align-items: center; gap: 7px; }
.check-option input { accent-color: var(--blue); width: 15px; height: 15px; }
.schedule-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.schedule-fields label { margin-bottom: 5px; }
.location-fields { display: grid; gap: 9px; }
.location-fields label { margin-bottom: 5px; }
.location-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-error { color: #a2332b; font-size: 13px; overflow-wrap: anywhere; }
.dialog-actions { margin-top: 10px; }
.dialog-actions > div { display: flex; gap: 8px; margin-left: auto; }

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

@media (max-width: 760px) {
  .page-header { flex-wrap: wrap; }
  .brand { padding: 0; font-size: 14px; }
  nav a, .repository-link { padding: 6px; font-size: 12px; }
  .topbar { min-height: 44px; gap: 7px; }
}

@media (max-width: 380px) {
  nav { order: 3; width: 100%; }
}
