:root {
  --ink: #10243e;
  --muted: #66768c;
  --paper: #f3f7fb;
  --surface: #ffffff;
  --line: #d9e4ef;
  --primary: #1769aa;
  --primary-soft: #deedfb;
  --question: #5b5ea6;
  --question-soft: #ececfa;
  --red: #b4433b;
  --red-soft: #f9e2df;
  --blue: #2878b5;
  --blue-soft: #e2f0fa;
  --purple: #745a9d;
  --purple-soft: #ece6f5;
  --shadow: 0 14px 35px rgba(28, 72, 116, 0.11);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -10%, rgba(54, 132, 196, 0.18), transparent 32rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 72px;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(16, 63, 105, 0.12);
  background: rgba(243, 247, 251, 0.92);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -0.02em; }
.brand__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: var(--primary); font-family: Georgia, serif; font-size: 20px; box-shadow: 0 5px 14px rgba(23,105,170,.22); }
.nav { display: flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.66); }
.nav__link { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 650; }
.nav__link:hover, .nav__link.is-active { color: var(--primary); background: var(--surface); box-shadow: 0 2px 8px rgba(25,79,128,.09); }
.topbar__actions { display: flex; align-items: center; justify-self: end; gap: 12px; }
.account { display: flex; align-items: center; gap: 10px; }
.account__identity { display: flex; flex-direction: column; max-width: 180px; line-height: 1.25; text-align: right; }
.account__identity strong, .account__identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__identity strong { font-size: 12px; }
.account__identity small { color: var(--muted); font-size: 10px; }
.local-mode { padding: 6px 9px; border-radius: 8px; color: var(--muted); background: var(--primary-soft); font-size: 11px; font-weight: 750; }

.shell { width: min(1440px, 92vw); min-height: calc(100vh - 130px); margin: 0 auto; padding: 64px 0 80px; }
.footer { padding: 25px 4vw 35px; color: var(--muted); text-align: center; font-size: 13px; }

.login-body { min-height: 100vh; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 30px; }
.login-card { width: min(440px, 100%); padding: 44px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.login-card__mark { margin-bottom: 24px; }
.login-card h1 { margin: 5px 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 42px; font-weight: 500; line-height: 1.05; letter-spacing: -.035em; }
.login-card > p:not(.eyebrow) { margin: 0 0 28px; color: var(--muted); }
.google-button { width: 100%; min-height: 48px; gap: 10px; font-size: 14px; }
.google-mark { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: var(--primary); background: white; font-weight: 850; }
.login-error { display: flex; flex-direction: column; gap: 3px; margin: 0 0 20px; padding: 12px 14px; border: 1px solid #e5aaa5; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 13px; }
.login-error span { color: #744a47; }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 42px; }
.hero h1, .page-heading h1 { max-width: 850px; margin: 4px 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(44px, 6vw, 76px); font-weight: 500; line-height: .98; letter-spacing: -.045em; }
.hero .lede { max-width: 690px; margin: 0; color: var(--muted); font-size: 18px; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sync-note { flex: 0 0 auto; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.6); font-size: 13px; }
.sync-note small { color: #8292a6; }
.pulse { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #388ed0; box-shadow: 0 0 0 5px rgba(56,142,208,.14); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 70px; }
.metrics--compact { grid-template-columns: repeat(2, minmax(180px, 260px)); margin-bottom: 28px; }
.metrics--three { grid-template-columns: repeat(3, minmax(180px, 260px)); }
.metrics--four { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.metric { min-height: 158px; padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.72); transition: transform .18s ease, box-shadow .18s ease; }
a.metric:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.metric > span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; margin: 11px 0 7px; font-family: Georgia, serif; font-size: 46px; font-weight: 500; line-height: 1; }
.metric small { color: var(--muted); }
.metric--alert { border-color: #9fc8e8; background: linear-gradient(145deg, var(--primary-soft), rgba(255,255,255,.92)); }
.metric--alert strong { color: #0d548c; }

.section-heading, .panel__heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading { margin: 0 0 20px; }
.section-heading h2, .panel__heading h2 { margin: 0; font-family: Georgia, serif; font-size: 29px; font-weight: 500; letter-spacing: -.025em; }
.section-heading > a, .panel__heading > a { color: var(--primary); font-size: 14px; font-weight: 750; }

.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 56px; }
.report-card { position: relative; min-height: 190px; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.report-card::after { position: absolute; right: -25px; bottom: -40px; width: 100px; height: 100px; border-radius: 50%; background: var(--primary-soft); content: ""; opacity: .7; }
.report-card:hover, .tenant-card:hover { transform: translateY(-3px); border-color: #a9c4dc; box-shadow: var(--shadow); }
.report-card strong { display: inline-block; margin: 23px 7px 0 0; font-family: Georgia, serif; font-size: 40px; font-weight: 500; }
.report-card > span { color: var(--muted); font-size: 13px; }
.report-card small { display: block; margin-top: 7px; color: var(--muted); }
.report-card--large { min-height: 260px; }
.report-card dl { display: flex; gap: 25px; margin: 22px 0; }
.report-card dl div { display: flex; flex-direction: column-reverse; }
.report-card dt { color: var(--muted); font-size: 11px; }
.report-card dd { margin: 0; font-weight: 750; }
.report-card .card-arrow { position: absolute; bottom: 20px; color: var(--primary); font-weight: 750; }

.page-heading { position: relative; margin-bottom: 36px; }
.page-heading h1 { margin-top: 8px; font-size: clamp(40px, 5vw, 66px); overflow-wrap: anywhere; }
.page-heading > p:not(.eyebrow):not(.path) { max-width: 680px; color: var(--muted); font-size: 17px; }
.page-heading .badge { margin-top: 18px; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--primary); font-size: 14px; font-weight: 750; }
.heading-actions { position: absolute; right: 0; bottom: 4px; }
.flag-title { font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important; font-size: clamp(28px, 4vw, 50px) !important; letter-spacing: -.04em !important; }

.panel { margin-bottom: 30px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 4px 15px rgba(24,67,105,.04); }
.panel__heading { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tenant-flags-table th:first-child,
.tenant-flags-table td:first-child { width: 48%; min-width: 420px; }
th { padding: 13px 18px; color: var(--muted); background: #f7fafe; font-size: 11px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 15px 18px; border-top: 1px solid #e8eef5; vertical-align: middle; }
tbody tr:hover { background: #f7fafe; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.name-link { color: #145f9b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.name-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.path { display: block; max-width: 660px; margin-top: 4px; color: #8493a6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.path--large { font-size: 13px; }
.muted { color: #8b99aa; }
code { padding: 4px 7px; border-radius: 6px; background: #edf3f8; font-size: 12px; }

.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 999px; color: #53677d; background: #e8eef5; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge--rollout, .badge--keep-alive, .badge--keep-alive-and-rollout, .badge--on { color: var(--primary); background: var(--primary-soft); }
.badge--not-in-notion, .badge--unassigned, .badge--setting-question, .badge--sales-question, .badge--configured { color: var(--question); background: var(--question-soft); }
.badge--obsolete, .badge--off { color: var(--red); background: var(--red-soft); }
.badge--setting { color: var(--blue); background: var(--blue-soft); }
.badge--new { color: #74470b; background: #fff0bf; }

.search { display: flex; gap: 10px; max-width: 620px; margin: 0 0 20px; }
.search input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: var(--surface); color: var(--ink); font: inherit; }
.search input:focus { border-color: #68a2d1; box-shadow: 0 0 0 3px rgba(23,105,170,.12); }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 10px 15px; border: 1px solid var(--primary); border-radius: 10px; color: white; background: var(--primary); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.button--quiet { border-color: var(--line); color: var(--ink); background: rgba(255,255,255,.65); }
.status-editor { display: flex; align-items: center; gap: 6px; min-width: 210px; }
.status-editor select { min-width: 138px; padding: 7px 28px 7px 9px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); background: #f7fafe; font: inherit; font-size: 12px; font-weight: 650; }
.status-editor select:focus { border-color: #68a2d1; box-shadow: 0 0 0 3px rgba(23,105,170,.12); }
.status-editor button { padding: 7px 9px; border: 1px solid #a9c4dc; border-radius: 8px; color: var(--primary); background: white; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.status-editor button:hover { color: white; background: var(--primary); }
.notice { display: flex; align-items: center; gap: 12px; max-width: 700px; margin: -15px 0 22px; padding: 12px 15px; border: 1px solid #9fc8e8; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-size: 13px; }
.notice span { color: #536b82; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.refresh-summary { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)) 2fr; gap: 1px; border-bottom: 1px solid var(--line); background: var(--line); }
.refresh-summary > div { padding: 18px 22px; background: #f7fafe; }
.refresh-summary strong { display: block; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.refresh-summary span { color: var(--muted); font-size: 11px; }
.refresh-summary .commit-summary { display: grid; grid-template-columns: auto 1fr; align-content: center; gap: 5px 10px; }
.refresh-picker select { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); font: inherit; }
.release-choice { display: grid; grid-template-columns: repeat(2, 1fr); }
.release-choice__option { padding: 30px; }
.release-choice__option + .release-choice__option { border-left: 1px solid var(--line); }
.release-choice__option h2 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.release-choice__option p { min-height: 72px; margin: 0 0 22px; color: var(--muted); }

.tenant-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tenant-card { display: flex; align-items: center; justify-content: space-between; gap: 25px; min-height: 125px; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tenant-card h3 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.tenant-card p { max-width: 580px; margin: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.tenant-card dl { display: flex; flex: 0 0 auto; gap: 18px; margin: 0; }
.tenant-card dl div { min-width: 58px; text-align: center; }
.tenant-card dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.tenant-card dd { margin: 3px 0 0; font-family: Georgia, serif; font-size: 25px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.definition-card, .callout { margin: 0 0 15px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.definition-card div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid #e8eef5; }
.definition-card div:last-child { border: 0; }
.definition-card dt { color: var(--muted); font-size: 13px; }
.definition-card dd { margin: 0; font-weight: 700; text-align: right; }
.callout { border-color: #b9d2e8; background: #edf6fc; }
.callout strong { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.callout p { margin: 8px 0 0; color: #405b73; white-space: pre-wrap; }
.empty-state { padding: 70px 30px; color: var(--muted); text-align: center; }
.empty-state__icon { margin-bottom: 8px; color: var(--primary); font-size: 35px; }
.empty-state h3 { margin: 0; color: var(--ink); font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.empty-state p { margin: 7px 0 0; }

@media (max-width: 1050px) {
  .metrics, .report-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { grid-template-columns: auto 1fr auto; }
  .nav { justify-self: center; }
  .topbar__actions > a:first-child, .account__identity { display: none; }
}

@media (max-width: 720px) {
  .topbar { display: flex; min-height: 62px; padding: 0 4vw; overflow-x: auto; }
  .brand > span:last-child { display: none; }
  .nav { margin-left: auto; border: 0; background: transparent; }
  .nav__link { padding: 7px 9px; font-size: 12px; }
  .login-shell { padding: 18px; }
  .login-card { padding: 30px 24px; }
  .shell { width: 94vw; padding-top: 40px; }
  .hero { display: block; }
  .sync-note { display: inline-block; margin-top: 24px; }
  .metrics, .report-grid, .tenant-grid, .detail-grid, .release-choice { grid-template-columns: 1fr; }
  .metrics--compact { grid-template-columns: repeat(2, 1fr); }
  .metrics--three, .metrics--four { grid-template-columns: 1fr; }
  .refresh-summary { grid-template-columns: repeat(2, 1fr); }
  .refresh-summary .commit-summary { grid-column: 1 / -1; }
  .release-choice__option + .release-choice__option { border-top: 1px solid var(--line); border-left: 0; }
  .tenant-flags-table th:first-child,
  .tenant-flags-table td:first-child { width: 55%; min-width: 300px; }
  .metric { min-height: 135px; }
  .heading-actions { position: static; margin-top: 18px; }
  .tenant-card { align-items: start; flex-direction: column; }
  th, td { padding: 12px; }
}
