:root {
  /* Untitled UI-style light theme tokens */
  --base: #FAFAFA;          /* page background (gray-25) */
  --surface: #FFFFFF;       /* card / sidebar background */
  --surface2: #F9FAFB;      /* subtle secondary surface (gray-50) */
  --border: #E4E7EC;        /* gray-200 */
  --border-strong: #D0D5DD; /* gray-300 */
  --text: #101828;          /* gray-900 */
  --text2: #475467;         /* gray-600 */
  --text3: #667085;         /* gray-500 */

  --brand: #0E7C90;         /* Unios teal, darkened for AA contrast */
  --brand-dark: #0B6272;
  --brand-50: #EDF9FA;
  --brand-100: #D6F1F4;

  --gold: #0E7C90;
  --gold-soft: #0891B2;
  --pos: #079455;
  --pos-bg: #ECFDF3;
  --neg: #D92D20;
  --neg-bg: #FEF3F2;
  --amber: #DC6803;
  --amber-bg: #FFFAEB;
  --blue: #175CD3;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.10), 0 1px 2px rgba(16, 24, 40, 0.06);
  --radius-md: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--base);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }
.hidden { display: none !important; }

#dashboard-view { display: flex; min-height: 100vh; }

/* ── Login view ─────────────────────────────────────────────────────────── */

#login-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--base);
}

.login-card-wrap { width: 360px; }

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .sub {
  font-size: 11px; color: var(--text3); letter-spacing: .14em;
  text-transform: uppercase; margin-top: 10px;
}

.login-title { font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 4px; text-align: center; }
.login-subtitle { font-size: 13px; color: var(--text3); margin: 0 0 20px; text-align: center; }

.login-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.login-box label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 12px 0 6px;
}

.login-box input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.login-box input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-100);
}
.login-box input::placeholder { color: var(--text3); }

.login-box button {
  width: 100%;
  margin-top: 18px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-dark);
  background: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.login-box button:hover { background: var(--brand-dark); }
.login-box button:disabled { opacity: .6; cursor: default; }

.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--neg);
}

/* ── App shell ──────────────────────────────────────────────────────────── */

#sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  position: relative;
}

#sidebar .logo-wrap .sub {
  font-size: 9px; color: var(--text3); letter-spacing: .12em;
  text-transform: uppercase; margin-top: 8px;
}

#sidebar hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

#sidebar .modules-label {
  font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: .04em;
  text-transform: uppercase; margin: 0 0 6px 10px;
}

.nav-item {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-50);
}

#sidebar .user-footer {
  position: fixed;
  bottom: 44px;
  left: 14px;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.5;
}
#sidebar .user-footer .name { color: var(--text); font-weight: 600; }

#sidebar .logout-btn {
  position: fixed;
  bottom: 16px;
  left: 14px;
  background: transparent;
  border: none;
  color: var(--text3);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
#sidebar .logout-btn:hover { color: var(--neg); }

#main { flex: 1; padding: 20px 28px 60px; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.topbar .last-updated { font-size: 12px; color: var(--text3); }
.topbar .last-updated span { color: var(--text2); font-weight: 500; }
#refresh-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text2);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
#refresh-btn:hover { color: var(--text); background: var(--surface2); }

.page-title { font-size: 24px; font-weight: 600; color: var(--text); margin: 0 0 4px; letter-spacing: -0.01em; }
.page-subtitle { font-size: 13px; color: var(--text3); margin-bottom: 14px; }

.chip-legend {
  display: flex; flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface2);
  margin-bottom: 8px;
}
.chip-legend .chip { display: inline-flex; align-items: center; gap: 6px; margin-right: 20px; font-size: 12px; }
.chip-legend .dot { font-size: 11px; }
.chip-legend .lbl { color: var(--text2); font-weight: 500; }

.as-at { font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.as-at span { color: var(--text2); font-weight: 500; }

.sec-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 22px 0 12px; margin-top: 6px;
}
.sec-hdr .icon { font-size: 14px; }
.sec-hdr .label {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: var(--text3); text-transform: uppercase;
}

/* ── Cards (shared Untitled UI-style container) ───────────────────────────── */

.metric-card,
.metric-simple,
.ebit-header,
.quarter-card,
.payout-panel,
table.scoreboard-table,
.cols-3 > div,
#chart-stip-ebit,
#chart-stip-enps {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.cols-3 > div { padding: 16px 18px 6px; overflow: hidden; }

/* ── Metric cards ───────────────────────────────────────────────────────── */

.metric-card {
  padding: 16px 18px;
  text-align: center;
}
.metric-card .label {
  font-size: 12px; color: var(--text3); text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 6px; font-weight: 600;
}
.metric-card .value { font-size: 30px; font-weight: 700; }
.metric-card .foot { font-size: 12px; color: var(--text3); margin-top: 2px; }

.metric-simple { padding: 14px 18px; }
.metric-simple .label { font-size: 13px; color: var(--text3); margin-bottom: 4px; font-weight: 500; }
.metric-simple .value { font-size: 20px; font-weight: 700; color: var(--text); }
.metric-simple .delta { font-size: 12px; color: var(--text3); margin-top: 2px; }

.metrics-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 14px; margin-top: 8px; }

/* ── STIP EBIT header ───────────────────────────────────────────────────── */

.ebit-header {
  padding: 16px 18px 12px;
}
.ebit-header .row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.ebit-header .row .left { font-size: 12px; color: var(--text2); font-weight: 500; }
.ebit-header .row .right { font-size: 11px; color: var(--text3); }
.ebit-header .amount { font-size: 30px; font-weight: 700; color: var(--text); margin-bottom: 4px; }

.chart-box { margin-top: 10px; }

#chart-stip-ebit, #chart-stip-enps { padding: 6px 6px 2px; overflow: hidden; }

/* ── Strategic projects ─────────────────────────────────────────────────── */

.strategic-label { font-size: 12px; color: var(--text2); font-weight: 500; margin: 20px 0 10px; }

.project-block { margin: 14px 0 8px; }
.project-row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 0 10px;
}
.project-name { font-size: 14px; font-weight: 600; color: var(--text); }
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; border-radius: 999px;
  padding: 3px 10px;
}

.quarters-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quarter-card {
  padding: 10px 12px; min-height: 90px;
}
.quarter-card.current { background: var(--brand-50); border-color: var(--brand-100); }
.quarter-card .qhdr {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 6px; color: var(--text3);
}
.quarter-card.current .qhdr { color: var(--brand-dark); }
.quarter-item {
  display: flex; gap: 6px; align-items: flex-start; font-size: 12px;
  line-height: 1.4; margin-bottom: 5px; color: var(--text2);
}
.quarter-item .glyph { color: var(--text3); flex-shrink: 0; }
.quarter-item.done .glyph { color: var(--pos); }
.quarter-empty { font-size: 12px; color: var(--text3); }

.overall-line { font-size: 12px; font-weight: 500; margin-top: 10px; }
.adherence-warn { font-size: 11px; font-weight: 500; color: var(--neg); margin-top: 4px; }

/* ── STIP payout table ──────────────────────────────────────────────────── */

.payout-panel {
  margin-top: 20px;
  overflow: hidden;
}
.payout-panel .hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.payout-panel.collapsed .hdr { border-bottom: none; padding-bottom: 12px; }
.payout-panel .hdr-text { flex: 1; min-width: 0; }
.payout-panel .hdr .title {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3);
}
.payout-panel .hdr .note { font-size: 11px; color: var(--text3); margin-left: 10px; }

.payout-toggle {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  color: var(--text2);
  font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.payout-toggle:hover { background: var(--surface); color: var(--text); }
.payout-panel:not(.collapsed) .payout-toggle { transform: rotate(45deg); }
.payout-panel.collapsed .payout-body { display: none; }

table.payout-table, table.scoreboard-table {
  width: 100%; border-collapse: collapse;
}
table.payout-table th, table.scoreboard-table th {
  font-size: 11px; font-weight: 600; color: var(--text3); text-align: left;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 14px;
  background: var(--surface2);
}
table.payout-table td { padding: 9px 14px; font-size: 12px; color: var(--text2); border-top: 1px solid var(--border); }
table.payout-table td.pct { font-size: 13px; font-weight: 700; text-align: center; }
table.payout-table td.note { color: var(--text3); font-style: italic; }

.payout-panel .footnote {
  padding: 8px 16px 10px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text3); background: var(--surface2);
}

/* ── Scoreboard table ───────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; }
table.scoreboard-table {
  overflow: hidden;
}
table.scoreboard-table thead tr th:first-child { border-top-left-radius: var(--radius-lg); }
table.scoreboard-table thead tr th:last-child { border-top-right-radius: var(--radius-lg); }
table.scoreboard-table th { white-space: nowrap; }
table.scoreboard-table td {
  padding: 10px 14px; font-size: 12px; color: var(--text2);
  border-top: 1px solid var(--border); white-space: nowrap;
}
table.scoreboard-table tbody tr:hover { background: var(--surface2); }
table.scoreboard-table .idx { color: var(--text3); width: 32px; }
table.scoreboard-table .measure { font-size: 13px; font-weight: 600; color: var(--text); white-space: normal; }
table.scoreboard-table .category { font-size: 11px; color: var(--text3); margin-top: 1px; }
table.scoreboard-table .now-val { font-size: 13px; font-weight: 700; white-space: nowrap; }
.tier-badge {
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.tier-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle;
}
.awaiting { color: var(--text3); font-size: 11px; font-style: italic; }

/* ── Financial / position sections ─────────────────────────────────────── */

.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 8px; }

.fin-headline .label { font-size: 12px; color: var(--text3); margin-bottom: 4px; font-weight: 500; }
.fin-headline .value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.fin-headline .tier { font-size: 13px; font-weight: 500; }
.fin-headline .fy { font-size: 12px; font-weight: 400; color: var(--text3); }

.chart-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 0; }
.chart-desc { font-size: 11px; color: var(--text3); margin-bottom: 4px; }

@media (max-width: 1000px) {
  .cols-3 { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .quarters-grid { grid-template-columns: 1fr 1fr; }
}
