/* Inter, bundled with the portal (SIL Open Font License, see fonts/Inter-OFL-LICENSE.txt). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #14201f;
  --ink-soft: #3d4a48;
  --muted: #6a7774;
  --line: #d5ddd9;
  --paper: #f4f1ea;
  --panel: #fffcf7;
  --teal: #0f5c56;
  --teal-deep: #0a3f3b;
  --gold: #b08a3c;
  --gold-soft: #e8d5a8;
  --good: #1f7a4d;
  --good-bg: #e8f5ee;
  --bad: #b42318;
  --bad-bg: #fceceb;
  --rail: #0d2f2c;
  --shadow: 0 18px 50px rgba(13, 47, 44, 0.08);
  --radius: 18px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    linear-gradient(160deg, rgba(15, 92, 86, 0.07), transparent 40%),
    linear-gradient(340deg, rgba(176, 138, 60, 0.08), transparent 36%),
    var(--paper);
}

button, input, select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.rail {
  background:
    radial-gradient(circle at 20% 0%, rgba(176, 138, 60, 0.18), transparent 45%),
    linear-gradient(180deg, #114643 0%, var(--rail) 55%, #081f1d 100%);
  color: #f4f7f6;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--gold-soft), #c9a45a);
  color: var(--teal-deep);
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.brand-name {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-sub {
  margin-top: 2px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(244, 247, 246, 0.62);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(244, 247, 246, 0.72);
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 160ms ease, color 160ms ease;
}

.rail-nav button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.rail-nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(232, 213, 168, 0.28);
}

.nav-ico {
  width: 18px;
  opacity: 0.8;
}

.rail-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.partner-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 247, 246, 0.5);
}

.partners {
  margin-top: 8px;
  font-size: 14px;
  color: var(--gold-soft);
}

.partners .dot {
  margin: 0 6px;
  opacity: 0.5;
}

.rail-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(244, 247, 246, 0.55);
}

.stage {
  padding: 28px 36px 40px;
  max-width: 1180px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}

.topbar h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 92, 86, 0.08);
  color: var(--teal-deep);
  font-size: 13px;
  font-weight: 500;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(31, 122, 77, 0.5);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(31, 122, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 122, 77, 0); }
}

.meta-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-left: 1px solid var(--line);
}

.meta-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  margin: 0 0 22px;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(213, 221, 217, 0.9);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 92, 86, 0.1), transparent 70%);
}

.card .label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.card .value {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}

.card .delta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 16px;
}

.split.equal {
  grid-template-columns: 0.9fr 1.2fr;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(213, 221, 217, 0.9);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel.compact {
  align-self: start;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-hint {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

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

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

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

.cell-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.fail { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: #fff3d6; color: #8a5a00; }
.badge-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; }

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rank-item:last-child { border-bottom: 0; }

.rank-no {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(15, 92, 86, 0.08);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.rank-bar {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: #e7ece9;
  overflow: hidden;
}

.rank-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #1f8a7f);
  border-radius: inherit;
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 6px;
}

.form label span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.form input,
.form select {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  padding-right: 72px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(13, 47, 44, 0.06);
}

.form input:focus,
.form select:focus {
  outline: 2px solid rgba(15, 92, 86, 0.25);
  border-color: var(--teal);
}

.btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(180deg, #147a72 0%, var(--teal) 100%);
  color: #fff;
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions .btn {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.actions .btn:hover {
  border-color: var(--teal);
  color: var(--teal-deep);
}

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

.report-tile {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f7f5ef);
  border: 1px solid var(--line);
}

.report-tile .k {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.report-tile .v {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(176, 138, 60, 0.18), transparent 36%),
    linear-gradient(160deg, #0d2f2c 0%, #114643 45%, #1a4541 100%);
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-hint {
  margin: 14px 0 0;
}

.form-error {
  margin: 0;
  color: var(--bad);
  font-size: 13px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

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

.filters label {
  display: grid;
  gap: 6px;
}

.filters label span {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.filters input,
.filters select {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 12px;
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.ghost {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  color: #f4f7f6;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.signed-in {
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
}

.signed-in strong {
  font-size: 14px;
}

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.site-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.site-foot strong {
  color: var(--ink);
  margin-right: 8px;
}

.site-foot em {
  font-style: normal;
  color: var(--teal-deep);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: relative;
    height: auto;
    border-radius: 0 0 24px 24px;
  }
  .rail-nav { flex-direction: row; flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split, .split.equal, .report-grid { grid-template-columns: 1fr; }
  .stage { padding: 22px 18px 36px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar h1 { font-size: 24px; }
}
