:root {
  --ink: #19243a;
  --muted: #6b7890;
  --line: #e5eaf2;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --blue: #2768f5;
  --blue-dark: #1748bd;
  --blue-pale: #edf3ff;
  --green: #12815f;
  --amber: #9a6500;
  --shadow: 0 22px 60px rgba(39, 67, 112, 0.12);
}
* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(39, 104, 245, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 104, 245, 0.025) 1px, transparent 1px),
    var(--wash);
  background-size: 28px 28px;
  font-family: "Avenir Next", "Noto Sans SC", "PingFang SC", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

button, input { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { min-height: 100vh; }

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 66px;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1520px) / 2));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand {
  align-items: center;
  display: flex;
  font-size: 17px;
  font-weight: 700;
  gap: 12px;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand-mark {
  align-items: end;
  background: var(--ink);
  border-radius: 10px;
  display: flex;
  gap: 3px;
  height: 34px;
  justify-content: center;
  padding: 8px;
  width: 34px;
}

.brand-mark i { background: white; border-radius: 2px; display: block; width: 3px; }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3) { height: 19px; background: #74a0ff; }

.account { align-items: center; display: flex; gap: 14px; color: var(--muted); }
.account-name { color: var(--ink); font-weight: 600; }

.page {
  margin: 0 auto;
  max-width: 1580px;
  padding: 32px 28px 60px;
}

.page-head { align-items: end; display: flex; justify-content: space-between; margin-bottom: 24px; }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; margin: 0 0 7px; text-transform: uppercase; }
h1 { font-size: clamp(25px, 3vw, 36px); letter-spacing: -0.035em; line-height: 1.1; margin: 0; }
.head-note { color: var(--muted); margin: 9px 0 0; }

.button {
  align-items: center;
  background: var(--paper);
  border: 1px solid #cfd7e6;
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 650;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
  padding: 0 17px;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.button:hover { border-color: #9aabc6; transform: translateY(-1px); }
.button-primary { background: var(--blue); border-color: var(--blue); color: white; box-shadow: 0 8px 22px rgba(39, 104, 245, 0.22); }
.button-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button-quiet { background: transparent; border-color: transparent; color: var(--muted); min-height: 34px; padding: 0 8px; }
.button-danger { color: #a13d48; }
.plus { font-size: 21px; font-weight: 400; line-height: 1; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(36, 55, 90, 0.05); }

.summary {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) repeat(3, 1fr);
  margin-bottom: 22px;
  overflow: hidden;
}

.summary-label, .metric { min-height: 132px; padding: 23px 28px; }
.summary-label { background: #f8faff; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.summary-title { font-size: 16px; font-weight: 700; }
.summary-days { color: var(--muted); display: grid; gap: 13px; margin-top: 22px; }
.metric { border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-name { color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: 0.03em; }
.metric-today, .metric-yesterday { font-family: "DIN Alternate", "Avenir Next", sans-serif; font-variant-numeric: tabular-nums; }
.metric-today { font-size: clamp(24px, 3vw, 34px); font-weight: 700; letter-spacing: -0.03em; margin-top: 18px; }
.metric-yesterday { color: #7a8da9; font-size: 15px; margin-top: 7px; }

.notice { border-radius: 10px; margin-bottom: 18px; padding: 12px 16px; }
.notice-success { background: #ebf8f3; color: var(--green); }
.notice-warning { background: #fff6df; color: var(--amber); }
.notice-error { background: #fff0f2; color: #a13d48; }

.toolbar { align-items: center; display: flex; gap: 12px; justify-content: space-between; padding: 15px 18px; }
.search { position: relative; width: min(420px, 100%); }
.search svg { color: #8290a5; height: 18px; left: 13px; position: absolute; top: 11px; width: 18px; }
.search input, .field input {
  background: white;
  border: 1px solid #d7deea;
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  outline: none;
  padding: 0 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  width: 100%;
}
.search input { padding-left: 39px; }
.search input:focus, .field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39, 104, 245, 0.12); }
.record-count { color: var(--muted); font-size: 13px; }
.bulk-toolbar { align-items: center; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 18px; }
.selection-count { font-weight: 650; min-width: 125px; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bulk-hint { color: var(--muted); font-size: 12px; margin-left: auto; }
.button:disabled { cursor: not-allowed; opacity: 0.4; transform: none; }
.selection-cell { width: 48px; }
.selection-cell input { accent-color: var(--blue); cursor: pointer; height: 17px; width: 17px; }
.selection-cell input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.site-table tbody tr.is-selected { background: var(--blue-pale); }

.table-wrap { border-top: 1px solid var(--line); overflow-x: auto; }
.site-table { border-collapse: collapse; min-width: 980px; width: 100%; }
.site-table th { background: #f7f9fc; color: #56647b; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; padding: 14px 18px; text-align: left; text-transform: uppercase; }
.site-table td { border-top: 1px solid var(--line); padding: 20px 18px; vertical-align: middle; }
.site-table tbody tr { transition: background 150ms ease; }
.site-table tbody tr:hover { background: #fbfcff; }
.site-table tbody tr.is-disabled { opacity: 0.56; }
.site-name { font-size: 15px; font-weight: 700; }
.site-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; margin-top: 5px; }
.site-url { color: var(--blue); font-weight: 600; text-decoration: none; }
.site-url:hover { text-decoration: underline; }
.stacked-stat { display: grid; gap: 7px; min-width: 90px; }
.stacked-stat strong, .stacked-stat span { font-family: "DIN Alternate", "Avenir Next", sans-serif; font-variant-numeric: tabular-nums; }
.stacked-stat strong { font-size: 16px; }
.stacked-stat span { color: #7a8da9; }
.actions { align-items: center; display: flex; gap: 9px; white-space: nowrap; }
.text-link { color: var(--blue); font-weight: 650; text-decoration: none; }
.text-link:hover { color: var(--blue-dark); }
.inline-form { display: inline; }

.empty { padding: 72px 24px; text-align: center; }
.empty-orbit { border: 1px solid #ccd8ed; border-radius: 50%; height: 58px; margin: 0 auto 20px; position: relative; width: 58px; }
.empty-orbit::before { background: var(--blue); border-radius: 50%; content: ""; height: 10px; left: 24px; position: absolute; top: -5px; width: 10px; }
.empty h2 { font-size: 19px; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 20px; }

.modal-backdrop { align-items: center; background: rgba(20, 31, 52, 0.48); display: flex; inset: 0; justify-content: center; padding: 22px; position: fixed; z-index: 50; backdrop-filter: blur(5px); }
.modal { animation: rise 180ms ease both; background: white; border-radius: 16px; box-shadow: var(--shadow); max-width: 520px; padding: 28px; width: 100%; }
.modal-head { align-items: start; display: flex; justify-content: space-between; }
.modal h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.modal-note { color: var(--muted); line-height: 1.65; margin: 8px 0 22px; }
.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field label { font-size: 13px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 25px; }
.modal-open { overflow: hidden; }

.code-layout { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr); }
.code-card { padding: 26px; }
.code-card h2, .guide-card h2 { font-size: 17px; margin: 0 0 10px; }
.code-card p, .guide-card p, .guide-card li { color: var(--muted); line-height: 1.7; }
.code-box { background: #111827; border-radius: 10px; color: #dbe7ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.7; margin: 18px 0; overflow-x: auto; padding: 20px; white-space: pre; }
.copy-row { align-items: center; display: flex; justify-content: space-between; }
.copy-hint { color: var(--muted); font-size: 12px; }
.is-copied { background: var(--green); border-color: var(--green); }
.guide-card { align-self: start; padding: 26px; }
.guide-card ol { margin: 14px 0 0; padding-left: 19px; }
.back-link { color: var(--muted); display: inline-flex; margin-bottom: 18px; text-decoration: none; }
.back-link:hover { color: var(--blue); }

.login-page { align-items: center; display: grid; min-height: 100vh; padding: 28px; }
.login-shell { display: grid; grid-template-columns: 1.05fr 0.95fr; margin: 0 auto; max-width: 980px; overflow: hidden; width: 100%; }
.login-story { background: #15213a; color: white; min-height: 560px; overflow: hidden; padding: 56px; position: relative; }
.login-story::after { border: 1px solid rgba(116, 160, 255, 0.35); border-radius: 50%; content: ""; height: 420px; position: absolute; right: -210px; top: 70px; width: 420px; box-shadow: 0 0 0 72px rgba(116,160,255,.04), 0 0 0 144px rgba(116,160,255,.025); }
.login-story .brand { position: relative; z-index: 2; }
.login-story h1 { font-size: 44px; line-height: 1.12; margin-top: 120px; max-width: 430px; position: relative; z-index: 2; }
.login-story p { color: #aebbd1; line-height: 1.7; max-width: 370px; position: relative; z-index: 2; }
.login-form { align-items: center; display: flex; padding: 58px; }
.login-form form { width: 100%; }
.login-form h2 { font-size: 25px; margin: 0; }
.login-subtitle { color: var(--muted); margin: 8px 0 30px; }
.login-form .button { margin-top: 10px; width: 100%; }

@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }

@media (max-width: 820px) {
  .page { padding: 24px 16px 48px; }
  .topbar { padding: 0 16px; }
  .page-head { align-items: start; gap: 18px; }
  .summary { grid-template-columns: 1fr; }
  .summary-label, .metric { border-bottom: 1px solid var(--line); border-right: 0; min-height: auto; }
  .summary-days { display: none; }
  .metric { align-items: center; display: grid; grid-template-columns: 1fr auto; }
  .metric-today { margin: 0; }
  .metric-yesterday { grid-column: 2; margin: 4px 0 0; }
  .toolbar { align-items: start; flex-direction: column; }
  .search { width: 100%; }
  .code-layout, .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-form { padding: 38px 28px; }
}
