:root {
  --bg: #f5f8fd;
  --card: #ffffff;
  --ink: #0a1f44;
  --muted: #667085;
  --line: #e1e8f3;
  --brand: #0660f0;
  --brand-2: #00c0fc;
  --brand-soft: #eaf2fe;
  --teal: #00a8e8;
  --amber: #fc6c18;
  --coral: #e5484d;
  --green: #15803d;
  --sky: #2563eb;
  --navy: #0a1f44;
  --shadow: 0 1px 2px rgba(10, 31, 68, .04), 0 8px 24px rgba(6, 96, 240, .07);
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: var(--brand); }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--brand); padding: 4px 8px 16px; letter-spacing: -.02em; }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: inline-block; position: relative; }
.logo i::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 3px solid #fff; border-right-color: transparent; animation: spin 3s linear infinite; }
.nav button { all: unset; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #1c2f52; cursor: pointer; font-weight: 500; }
.nav button:hover { background: var(--brand-soft); }
.nav button.on { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(6, 96, 240, .25); }
.nav .badge { margin-left: auto; background: var(--coral); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.side .foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 8px; }

.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .grow { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.pill.ok { background: #e7f6ec; color: var(--green); }
.pill.bad { background: #fdecec; color: var(--coral); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.8s ease-in-out infinite; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
select.btn { padding-right: 28px; max-width: 280px; text-overflow: ellipsis; }

.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.span4 { grid-column: 1 / -1; }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; overflow-x: auto; } .side .foot, .logo { display: none; } .g4, .g3, .g2 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; } .main { padding: 16px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; min-width: 0; animation: rise .45s ease both; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: #1c2f52; display: flex; align-items: center; gap: 8px; }
.card h3 small { color: var(--muted); font-weight: 500; }
.card .note-btn { position: absolute; top: 12px; right: 12px; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; border-radius: 8px; padding: 2px 6px; }
.card .note-btn:hover { background: var(--brand-soft); color: var(--brand); }
.card .note-btn[data-count]:not([data-count="0"])::after { content: attr(data-count); font-size: 10px; background: var(--brand); color: #fff; border-radius: 999px; padding: 0 5px; margin-left: 3px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: linear-gradient(135deg, #fff, var(--brand-soft)); }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; width: 70px; height: 26px; opacity: .8; }
.neg { color: var(--coral); }
.pos { color: var(--green); }
.warn { color: var(--amber); }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
table.t td { padding: 7px 8px; border-bottom: 1px solid #edf2fa; vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.total td { font-weight: 700; border-top: 1.5px solid var(--ink); }
table.t tr.sec td { font-weight: 700; color: var(--brand); padding-top: 12px; }
table.t tbody tr { transition: background .2s; }
table.t tbody tr:hover { background: #f5f9ff; }
.scroll { max-height: 420px; overflow: auto; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: var(--sky); white-space: nowrap; }
.tag.critical, .tag.missing_in_2b, .tag.itc_not_available, .tag.held { background: #fdecec; color: var(--coral); }
.tag.high, .tag.amount_mismatch, .tag.recover, .tag.probable_match { background: #fff1e8; color: var(--amber); }
.tag.matched, .tag.matched_within_tolerance, .tag.released, .tag.resolved, .tag.fixed { background: #e7f6ec; color: var(--green); }
.tag.medium, .tag.missing_in_books { background: #eef2ff; color: var(--sky); }

/* flow */
.flow { width: 100%; height: 220px; }
.flow .node rect { fill: #fff; stroke: var(--line); stroke-width: 1.2; rx: 12; filter: drop-shadow(0 4px 10px rgba(6, 96, 240, .08)); }
.flow .node text { font-size: 12px; font-weight: 700; fill: #1c2f52; text-anchor: middle; }
.flow .node .v { font-size: 11px; font-weight: 600; fill: var(--brand); }
.flow .node.hot rect { stroke: var(--brand-2); stroke-width: 2; }
.flow path.edge { fill: none; stroke: #c9dcf7; stroke-width: 2; stroke-dasharray: 5 6; animation: dash 1.4s linear infinite; }
.flow circle.pkt { fill: var(--brand-2); }

/* map */
.map { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; max-width: 520px; }
.map .st { aspect-ratio: 1; border-radius: 9px; background: #edf2fa; color: #4b5d7a; font-size: 11px; font-weight: 700; display: grid; place-items: center; cursor: pointer; transition: transform .2s, background .3s; border: 1px solid transparent; }
.map .st:hover { transform: scale(1.08); }
.map .st.l1 { background: #d6e6fd; } .map .st.l2 { background: #9cc3fb; color: #fff; } .map .st.l3 { background: var(--brand-2); color: #fff; } .map .st.home { background: var(--brand); color: #fff; box-shadow: 0 0 0 3px #d6e6fd; }
.map .st.sel { border-color: var(--ink); }
.map .blank { visibility: hidden; }

/* drop */
.drop { border: 2px dashed #c9dcf7; border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); background: #fff; transition: all .2s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); transform: scale(1.01); }
.changes li { margin: 4px 0; }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 100vw; background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(10, 31, 68, .08); transform: translateX(105%); transition: transform .3s ease; z-index: 30; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { padding: 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.drawer .list { flex: 1; overflow: auto; padding: 12px 16px; }
.drawer .c { background: var(--brand-soft); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.drawer .c small { color: var(--muted); display: block; font-size: 11px; }
.drawer form { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.drawer textarea { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 8px; resize: none; height: 60px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 16px; transition: transform .35s; z-index: 40; max-width: 90vw; }
.toast.show { transform: translateX(-50%); }
.login { max-width: 460px; margin: 12vh auto; }
.ticker { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 22px; color: var(--brand); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bar { height: 8px; border-radius: 999px; background: #edf2fa; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 999px; transition: width 1s ease; }
canvas { max-width: 100%; }
.flash { animation: flash 1.2s ease; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dash { to { stroke-dashoffset: -22; } }
@keyframes flash { 0% { background: #fff6d6; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* funnel */
.funnel { display: flex; flex-direction: column; align-items: center; padding: 6px 0; }
.fstage { width: 100%; display: flex; justify-content: center; }
.fbar { min-width: 190px; color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; transition: width 1s ease; box-shadow: 0 6px 14px rgba(6, 96, 240, .15); animation: rise .5s ease both; white-space: nowrap; }
.fbar span { font-variant-numeric: tabular-nums; font-weight: 600; opacity: .95; }
.fdrop { color: var(--muted); font-size: 12px; padding: 5px 0; }

/* adverse figures */
.kpi.bad .value { color: var(--coral); }
table.t td.neg, table.t td.neg b, table.t tr.total td.neg { color: var(--coral); }

/* header controls */
.iconbtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; padding: 0; transition: transform .15s, box-shadow .15s; }
.iconbtn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
select#period { max-width: 190px; }
input.dt { padding: 6px 8px; font-weight: 500; }

/* budget grid */
.bgrid input { width: 92px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; text-align: right; font-variant-numeric: tabular-nums; background: #fff; }
.bgrid input:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.bgrid input::placeholder { color: #a9b6c9; }
.bgrid td { padding: 4px 4px; }
select#ent { max-width: 230px; } select#centre { max-width: 170px; }
table.t td.neg b.pos, table.t td.neg .pos { color: var(--green); }
.bgrid td:first-child, .bgrid th:first-child { min-width: 250px; position: sticky; left: 0; background: #fff; }

/* sub-tabs */
.subnav { display: flex; gap: 6px; margin: 18px 0 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.subnav button { all: unset; cursor: pointer; padding: 8px 14px; border-radius: 10px 10px 0 0; font-weight: 600; color: #5b6072; border-bottom: 2.5px solid transparent; }
.subnav button:hover { background: var(--brand-soft); color: var(--brand); }
.subnav button.on { color: var(--brand); border-bottom-color: var(--brand); background: #fff; }

/* Fiveox brand */
.logo { color: var(--navy); }
.logo img { width: 30px; height: 30px; object-fit: contain; }
.logo small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin-top: -2px; }
.nav button.on { background: linear-gradient(135deg, #0660f0, #0a4fd0); }
.top h1 { color: var(--navy); }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.bar i { background: linear-gradient(90deg, #0660f0, #00c0fc); }
/* sign in / register */
.authwrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.authside { background: linear-gradient(150deg, #eaf2fe 0%, #ffffff 55%, #e6f8ff 100%); padding: 56px 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; border-right: 1px solid var(--line); }
.authside img.wordmark { width: 220px; }
.authside h2 { font-size: 30px; line-height: 1.2; margin: 6px 0 0; color: var(--navy); letter-spacing: -.02em; }
.authside ul { padding-left: 18px; color: #33466b; line-height: 1.9; margin: 0; }
.authside .dots { display: flex; gap: 8px; } .authside .dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.authform { display: flex; align-items: center; justify-content: center; padding: 32px; }
.authcard { width: 100%; max-width: 420px; }
.authcard h3 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
.authcard label { display: block; font-size: 12px; font-weight: 600; color: #33466b; margin: 12px 0 4px; }
.authcard input, .authcard select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.authcard input:focus, .authcard select:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.authcard .btn.primary { width: 100%; margin-top: 16px; padding: 11px; text-align: center; }
.authcard .err { color: var(--coral); font-size: 13px; min-height: 18px; margin-top: 10px; }
.authcard .switch { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; }
.authcard .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
@media (max-width: 860px) { .authwrap { grid-template-columns: 1fr; } .authside { padding: 28px; border-right: 0; } .authside ul { display: none; } }

/* sub-tabs nested in the left menu */
.nav .caret { margin-left: auto; font-size: 10px; opacity: .7; }
.nav .badge + .caret, .nav .caret + .badge { margin-left: 6px; }
.nav .subs { margin: 2px 0 6px 14px; padding-left: 10px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.nav .subs button { padding: 6px 10px; font-size: 13px; font-weight: 500; color: #45587a; border-radius: 8px; }
.nav .subs button.on { background: var(--brand-soft); color: var(--brand); box-shadow: none; font-weight: 700; }
.side { overflow-y: auto; }
.nav .caret { font-size: 16px; line-height: 1; transition: transform .2s; display: inline-block; }
.nav .caret.open { transform: rotate(90deg); }

/* header: organisation, location, period, downloads */
.top { margin-bottom: 6px; gap: 10px; flex-wrap: nowrap; }
.top h1, select.orgname { font-size: 20px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
select.orgname { border: 0; background: transparent; padding: 4px 22px 4px 0; cursor: pointer; max-width: 420px; font-family: inherit; }
select.orgname:focus { outline: 2px solid var(--brand-2); border-radius: 8px; }
.top select.btn { flex: 0 0 auto; }
.topsub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.topsub .sub { color: var(--muted); }
@media (max-width: 1100px) { .top { flex-wrap: wrap; } }
.top h1, select.orgname { flex: 0 0 auto; max-width: 46%; }
select#centre { max-width: 160px; } select#period { max-width: 170px; }
select#ent.orgname { max-width: 46%; width: auto; }

/* overview tiles */
.sech { font-size: 15px; margin: 22px 0 10px; color: var(--navy); }
.tile { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tile:hover, .tile:focus { transform: translateY(-2px); border-color: #b9d3fb; box-shadow: 0 10px 26px rgba(6, 96, 240, .13); outline: none; }
.tile h3 { color: var(--navy); font-size: 15px; }
.tile .go { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--brand); }
.trow { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.trow:last-of-type { border-bottom: 0; }
.trow span { color: var(--muted); } .trow b { font-variant-numeric: tabular-nums; text-align: right; }
.trow b.neg { color: var(--coral); } .trow b.pos { color: var(--green); } .trow b.warn { color: var(--amber); }
.tnote { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
