:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #172126;
  --muted: #657178;
  --line: #dfe5e7;
  --surface: #ffffff;
  --canvas: #f4f7f7;
  --accent: #087d8c;
  --accent-dark: #075e68;
  --success: #137a4b;
  --success-bg: #e8f6ee;
  --warning: #9a6300;
  --warning-bg: #fff3d6;
  --danger: #a53838;
  --danger-bg: #fdecec;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(100%, 390px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 34px; box-shadow: 0 18px 50px rgba(23, 33, 38, 0.08); }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 6px; font-weight: 800; font-size: 14px; }
.brand-mark.small { width: 38px; height: 38px; }
.eyebrow { margin: 22px 0 6px; color: var(--accent); text-transform: uppercase; font-size: 11px; font-weight: 800; letter-spacing: 0; }
.login-panel h1 { margin: 0; font-size: 27px; line-height: 1.2; }
.login-form { display: grid; gap: 16px; margin-top: 30px; }
.login-form label { display: grid; gap: 7px; color: #39474d; font-size: 13px; font-weight: 700; }
input { width: 100%; height: 44px; border: 1px solid #cbd5d8; border-radius: 5px; padding: 0 12px; color: var(--ink); background: white; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 125, 140, 0.12); }
.primary-button, .secondary-button, .quiet-button, .nav-item { border: 0; }
.primary-button { min-height: 44px; border-radius: 5px; background: var(--accent); color: white; font-weight: 800; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: 0.6; cursor: wait; }
.form-error { margin: -2px 0 0; padding: 10px 12px; border-radius: 5px; color: var(--danger); background: var(--danger-bg); font-size: 13px; }
.loading-view { min-height: 100vh; display: grid; place-items: center; }
.loading-bar { width: 140px; height: 3px; overflow: hidden; background: #d6dfe1; }
.loading-bar::after { content: ""; display: block; width: 55%; height: 100%; background: var(--accent); animation: loading 1s ease-in-out infinite alternate; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(180%); } }

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; color: #eef5f6; background: #18262b; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand span { margin-top: 2px; color: #a9bbc0; font-size: 12px; }
.navigation { display: grid; gap: 4px; margin-top: 18px; }
.nav-item { width: 100%; min-height: 40px; padding: 0 12px; border-radius: 5px; color: #b9c8cc; background: transparent; text-align: left; font-weight: 700; }
.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: white; background: #087d8c; }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; padding: 18px 8px 2px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer span { overflow: hidden; color: #b9c8cc; font-size: 11px; text-overflow: ellipsis; }
.quiet-button { padding: 0; color: white; background: transparent; text-align: left; font-size: 12px; font-weight: 700; }
.workspace { min-width: 0; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 30px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar h1 { margin: 0; font-size: 23px; }
.status-pill, .inline-status { display: inline-flex; align-items: center; justify-content: center; min-height: 27px; border-radius: 999px; padding: 0 10px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-pill.success, .inline-status.success { color: var(--success); background: var(--success-bg); }
.status-pill.warning, .inline-status.warning { color: var(--warning); background: var(--warning-bg); }
.status-pill.neutral, .inline-status.neutral { color: #536369; background: #edf1f2; }
.content { padding: 28px 30px 50px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { min-height: 118px; display: flex; flex-direction: column; justify-content: space-between; padding: 19px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { font-size: 30px; line-height: 1; }
.metric small { color: var(--muted); font-size: 11px; }
.economics-toolbar { min-height: 64px; display: flex; align-items: end; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.period-control { display: grid; gap: 5px; margin-right: auto; color: var(--muted); font-size: 11px; font-weight: 800; }
.period-control input { width: 170px; height: 36px; }
.economics-metrics { margin-top: 14px; }
.economics-metrics .metric strong { font-size: 25px; }
.section-block { margin-top: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.section-block.compact { margin-top: 0; padding: 22px; }
.section-heading { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.section-heading .eyebrow, .section-block.compact .eyebrow { margin: 0 0 5px; }
.section-heading h2, .section-block h2 { margin: 0; font-size: 16px; }
.secondary-button { min-height: 35px; padding: 0 13px; border: 1px solid #cbd5d8; border-radius: 5px; color: #34444a; background: white; font-size: 12px; font-weight: 800; }
.secondary-button:hover { border-color: var(--accent); color: var(--accent); }
.service-list { padding: 0 20px; }
.service-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #edf1f2; }
.service-row:last-child { border-bottom: 0; }
.service-row strong, .service-row span { display: block; }
.service-row div > span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 54px; padding: 0 20px; border-bottom: 1px solid #edf1f2; text-align: left; font-size: 12px; white-space: nowrap; }
th { color: var(--muted); background: #fafcfc; font-weight: 800; }
tbody tr:last-child td { border-bottom: 0; }
.empty-cell { height: 84px; color: var(--muted); text-align: center; }
.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
dl { margin: 20px 0 0; }
dl div { display: flex; justify-content: space-between; padding: 13px 0; border-top: 1px solid var(--line); }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; font-weight: 800; }
.large-number { display: block; margin-top: 28px; font-size: 38px; }

@media (max-width: 920px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px; }
  .sidebar-brand { padding-bottom: 14px; }
  .navigation { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
  .nav-item { text-align: center; }
  .sidebar-footer { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; }
  .topbar { min-height: 78px; padding: 15px 18px; }
  .content { padding: 18px 14px 36px; }
  .metric-grid, .activity-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .login-panel { padding: 26px 22px; }
  .metric-grid, .activity-grid { grid-template-columns: 1fr; }
  .metric { min-height: 98px; }
  .section-heading { align-items: flex-start; }
  .topbar { align-items: flex-start; }
  .economics-toolbar { align-items: stretch; flex-wrap: wrap; }
  .period-control { width: 100%; }
  .period-control input { width: 100%; }
}
