:root {
  --press: #26301a;        /* dark olive — sidebar, footers */
  --leaf: #4f6128;         /* olive green — actions, links */
  --leaf-deep: #37461c;    /* deep olive — gradients */
  --leaf-bright: #7a9a3d;  /* brighter olive — pops of energy */
  --leaf-soft: #e7ebdc;    /* pale olive — hovers, chips */
  --oil: #c9a227;          /* golden oil — the one bright accent */
  --oil-deep: #a67f16;     /* deep gold — gradients */
  --oil-bright: #f2c94c;   /* bright gold — highlights on dark surfaces */
  --paper: #f5f5f0;        /* page background */
  --card: #ffffff;
  --ink: #20241a;
  --ink-soft: #6b7161;
  --line: #dfe1d6;
  --down: #a6432a;         /* declining numbers */
  --up: #3e7a3e;
  --good: #2ee66b;         /* gauge: growth vs last year */
  --evil: #ff1a2b;         /* gauge: decline vs last year — the "demonic" red */
  --teal: #2f6f6a;         /* new-product revenue tile */
  --teal-deep: #1f4f4b;
  --shadow-sm: 0 1px 2px rgba(32,36,26,.06);
  --shadow-md: 0 8px 24px rgba(32,36,26,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(201,162,39,.10), transparent 38%),
    radial-gradient(circle at 100% 22%, rgba(79,97,40,.09), transparent 42%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink); font-size: 15px; line-height: 1.45;
}
h1, h2, .brand-name {
  font-family: "Inter", -apple-system, sans-serif; font-weight: 700; letter-spacing: -0.01em;
}
h1 { font-size: 24px; margin: 0 0 2px; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; }
a { color: var(--leaf); }

/* ---- shell ---- */
.shell { min-height: 100vh; }
.sidebar {
  width: 210px; background: var(--press); color: #eef0e6;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 20;
}
.main-area { margin-left: 210px; min-height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { color: var(--oil); font-size: 22px; line-height: 1; }
.brand-name { font-size: 20px; display: block; color: #fff; }
.brand-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #b9c0a6; }
.sidebar nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; }
.sidebar nav a {
  color: #d8dcc8; text-decoration: none; padding: 9px 12px; border-radius: 7px; font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.10); color: #fff; border-left-color: var(--oil); }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.sidebar-foot a { color: #b9c0a6; }
.content { padding: 22px 30px 50px; max-width: 1200px; margin: 0 auto; }

.page-head { display: flex; justify-content: space-between; align-items: end;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-soft); font-size: 13px; }

/* ---- cards, KPIs ---- */
.grid { display: grid; gap: 12px; }
.grid > * { min-width: 0; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow-sm); }
.kpi .label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.kpi .value { font-family: "Inter", sans-serif; font-size: 28px; font-weight: 700; margin-top: 4px; }
.kpi .delta { font-size: 13px; margin-top: 2px; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); }
.two-col { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .content { padding: 18px; margin: 0; } }
.chart-box { position: relative; height: 260px; }

/* ---- responsive nav: below 900px the sidebar becomes a slide-in drawer ---- */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 900px) {
  .nav-toggle {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 14px; left: 14px; z-index: 40;
    width: 42px; height: 42px; border-radius: 9px; border: none;
    background: var(--press); color: #fff; font-size: 19px; cursor: pointer;
    box-shadow: var(--shadow-md); padding: 0;
  }
  .content { padding-top: 68px; max-width: 100%; }
  .main-area { margin-left: 0; }
  .sidebar {
    z-index: 35; width: 240px;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 6px 0 28px rgba(0,0,0,.28);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(15,18,10,.45);
  }
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); border-bottom: 2px solid var(--line); padding: 6px 8px; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.down-text { color: var(--down); font-weight: 600; }
.up-text { color: var(--up); }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--leaf-soft); color: var(--press); }
.tag.warn { background: #f3e0d8; color: var(--down); }
.tag.gold { background: #f4ead0; color: #7a621a; }

/* ---- forms & buttons ---- */
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 2px solid var(--leaf); outline-offset: 1px;
}
label { font-size: 12px; color: var(--ink-soft); display: block; margin: 10px 0 4px; }
button, .btn {
  font: inherit; background: var(--leaf); color: #fff; border: none; border-radius: 7px;
  padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: #41511f; }
button.quiet { background: transparent; color: var(--leaf); border: 1px solid var(--line); padding: 5px 10px; font-size: 13px; }
button.quiet:hover { background: var(--leaf-soft); }
button.danger { background: transparent; color: var(--down); border: 1px solid var(--line); padding: 5px 10px; font-size: 13px; }
form.inline { display: inline; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filter-bar > div { min-width: 150px; }
.filter-bar label { margin-top: 0; }

/* ---- flashes ---- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--leaf-soft); color: var(--press); }
.flash.bad { background: #f3e0d8; color: var(--down); }
.flash.floating { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 10; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--press); }
.login-card { background: var(--card); border-radius: 12px; padding: 34px 34px 28px; width: 340px; }
.login-card .brand-mark { font-size: 30px; }
.login-card h1 { font-size: 24px; margin: 8px 0 0; }
.login-card .brand-sub { color: var(--ink-soft); }
.login-card button { width: 100%; margin-top: 16px; }

/* ---- misc ---- */
.res-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.res-card .cat { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.res-card .title { font-weight: 600; margin: 4px 0 10px; }
.task { display: flex; gap: 12px; justify-content: space-between; }
.task .meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.task.done .title { text-decoration: line-through; color: var(--ink-soft); }
.empty { color: var(--ink-soft); padding: 30px 0; text-align: center; }
details.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; margin-bottom: 14px; }
details.panel summary { cursor: pointer; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- dashboard v2 ---- */
.scorecards { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.score {
  background: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-deep) 100%);
  border: none; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.score::before {
  content: ""; position: absolute; top: -40px; right: -40px; width: 140px; height: 140px;
  border-radius: 50%; background: radial-gradient(circle, rgba(242,201,76,.35), transparent 70%);
  pointer-events: none;
}
.score { display: flex; flex-direction: column; }
.score .score-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  position: relative; z-index: 1; }
/* The text column may shrink; the gauge never does, so it can't be pushed
   out of the card by a long dollar figure. */
.score .score-text { min-width: 0; flex: 1; }
.score .gauge { flex-shrink: 0; }
.score .label { color: rgba(255,255,255,.78); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; }
.score .period { color: #fff; font-size: 13px; font-weight: 600; margin-top: 1px; }
/* Sized by how long the figure actually is, so millions and hundreds of
   millions still clear the gauge. Set from the template, not the viewport —
   a wide window does not make a long number any shorter. */
.score .value { font-family: "Inter", sans-serif; font-weight: 700; margin-top: 3px;
  color: #fff; white-space: nowrap; font-size: 24px; }
.score .value.len-md { font-size: 20px; }
.score .value.len-lg { font-size: 17px; }
.score .value.len-xl { font-size: 15px; }
.score .delta { margin-top: auto; padding-top: 8px; }
.score .delta { position: relative; z-index: 1; }
.score .delta.up { color: var(--good); }
.score .delta.down { color: #ff6b6b; font-weight: 600; }
.gauge-num { font-family: "Inter", sans-serif; font-size: 20px; font-weight: 700; fill: #fff; }
.gauge.good .gauge-arc { stroke: var(--good); filter: drop-shadow(0 0 5px rgba(46,230,107,.65)); }
.gauge.good .gauge-num { fill: var(--good); }
.gauge.bad .gauge-arc { stroke: var(--evil); animation: demonic-pulse 1.4s ease-in-out infinite; }
.gauge.bad .gauge-num { fill: var(--evil); }
@keyframes demonic-pulse {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(255,26,43,.6)); }
  50% { filter: drop-shadow(0 0 13px rgba(255,26,43,1)); }
}
.dash-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .dash-2 { grid-template-columns: 1fr; } }
.newbiz {
  background: linear-gradient(135deg, var(--oil) 0%, var(--oil-deep) 100%);
  border: none; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.newbiz::before {
  content: ""; position: absolute; bottom: -50px; left: -30px; width: 150px; height: 150px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.25), transparent 70%);
  pointer-events: none;
}
.newbiz .label, .newbiz .delta { position: relative; z-index: 1; color: var(--press); }
.newbiz .value.big { font-family: "Inter", sans-serif; font-size: 36px; font-weight: 700;
  color: var(--press); margin: 2px 0; position: relative; z-index: 1; }
table.mini { margin-top: 12px; position: relative; z-index: 1; }
table.mini td { padding: 5px 6px; border-bottom: 1px solid rgba(38,48,26,.15); font-size: 13px; color: var(--press); }
/* "since ..." sits on a coloured tile, so it takes the tile's own ink at a
   readable weight rather than the pale grey used on white cards. */
table.mini td.since { font-size: 12px; color: var(--press); opacity: .75; white-space: nowrap; }
.newbiz.teal table.mini td.since { color: #fff; opacity: .85; }

.newbiz.teal {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
}
.newbiz.teal::before { background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.newbiz.teal .label, .newbiz.teal .delta, .newbiz.teal .value.big { color: #fff; }
.newbiz.teal table.mini td { color: #fff; border-bottom-color: rgba(255,255,255,.18); }
h2 .sub { font-family: -apple-system, sans-serif; font-size: 12px; font-weight: 400; color: var(--ink-soft); }

/* colored accent stripes for chart cards — a shot of color instead of another white box */
.chart-card { border-top: 4px solid var(--leaf); }
.chart-card.gold { border-top-color: var(--oil); }
.chart-card.rust { border-top-color: var(--down); }

/* ---- reports ---- */
.report-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.report-list .card { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.report-list .card:hover { border-color: var(--leaf); }
.report-list .rt { font-family: "Inter", sans-serif; font-size: 17px; font-weight: 700; }
.report-list .rd { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.matrix-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table.matrix { font-size: 13px; white-space: nowrap; min-width: 100%; border-collapse: separate; border-spacing: 0; }
table.matrix th, table.matrix td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.matrix th { position: sticky; top: 0; background: var(--card); cursor: pointer; z-index: 2; }
table.matrix th a { color: var(--ink-soft); text-decoration: none; }
table.matrix th.sorted a { color: var(--leaf); }
table.matrix td.label-cell, table.matrix th.label-cell { position: sticky; left: 0; background: var(--card);
  border-right: 2px solid var(--line); text-align: left; max-width: 320px; white-space: normal; z-index: 1; }
table.matrix th.label-cell { z-index: 3; }
table.matrix tr.child td.label-cell { padding-left: 26px; color: var(--ink-soft); }
table.matrix tr.child { background: #fbfbf8; }
table.matrix td.calc { background: #f7f8f2; font-weight: 600; }
/* YoY cells read as filled chips: green = up, red = down, black text on both. */
table.matrix td.yoy-pos, table.matrix td.yoy-neg { color: #000; font-weight: 600; }
table.matrix td.yoy-pos { background: #7fd88f; }
table.matrix td.yoy-neg { background: #f28b82; }
/* Beat the .calc / .child background, which would otherwise win on tie. */
table.matrix td.calc.yoy-pos, table.matrix tr.child td.yoy-pos { background: #7fd88f; }
table.matrix td.calc.yoy-neg, table.matrix tr.child td.yoy-neg { background: #f28b82; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.toolbar > div { min-width: 130px; } .toolbar label { margin-top: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg a { padding: 7px 12px; font-size: 13px; text-decoration: none; color: var(--ink-soft); background: #fff; }
.seg a.on { background: var(--leaf); color: #fff; }

/* ---- task completion note ---- */
.action-note { margin-top: 6px; font-size: 13px; background: var(--leaf-soft); border-radius: 6px;
  padding: 6px 10px; color: var(--press); }
.action-note .an-label { font-weight: 600; }
.done-pop { display: inline-block; position: relative; }
.done-pop summary { list-style: none; cursor: pointer; }
.done-pop summary::-webkit-details-marker { display: none; }
.quiet-btn { background: transparent; color: var(--leaf); border: 1px solid var(--line);
  padding: 5px 10px; font-size: 13px; border-radius: 7px; display: inline-block; }
.quiet-btn:hover { background: var(--leaf-soft); }
.done-form { position: absolute; right: 0; top: 34px; z-index: 5; width: 280px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.10); }
.done-form label { margin-top: 0; }
.done-form button { margin-top: 8px; width: 100%; }
