/* Defaults only — per-school colors from config/school.toml are injected as a
   :root override in base.html/login.html and win over these. */
:root {
    --accent: #f47735;
    --accent-dark: #d9611f;
    --bg: #fbf1e8;
    --surface: #ffffff;
    --ink: #2a2520;
    --muted: #8a7c70;
    --line: #ecdfd2;
    --link: #bf5a14;
    --pos: #1c7d54;
    --neg: #c0392b;
    --card-shadow: 0 1px 2px rgba(74,48,20,.05), 0 2px 6px rgba(74,48,20,.06);
    --radius: 12px;
}
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; margin: 0; }
.wrap { max-width: 1520px; margin: 0 auto; padding: 0 32px 64px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }

/* Header */
header { background: var(--surface); border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); padding: 13px 24px; }
.header-inner { max-width: 1520px; margin: 0 auto; width: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 600; color: var(--ink); font-size: 15px; letter-spacing: -.01em; }
.brand img { height: 36px; }
.user { color: var(--muted); font-size: 13.5px; }

/* Page heading */
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 20px; }
.page-head h1 { font-size: 23px; font-weight: 600; margin: 0; letter-spacing: -.02em; }
.fy-badge { font-size: 12px; font-weight: 600; color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 22%, var(--surface)); padding: 3px 11px; border-radius: 20px; }
.back { font-size: 14px; margin: 26px 0 4px; }
.detail-title { font-size: 22px; font-weight: 600; margin: 6px 0 22px; letter-spacing: -.02em; }
.detail-title .num { font-family: ui-monospace, Menlo, monospace; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px 18px; }
.tile .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 7px; }
.tile .value { font-size: 25px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .value.pos { color: var(--pos); }
.tile .value.neg { color: var(--neg); }

/* Toolbar (FY + search) */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.toolbar select, .toolbar input[type=search] { font: inherit; font-size: 14px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.toolbar input[type=search] { min-width: 240px; }
.toolbar select:focus, .toolbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn { font: inherit; font-size: 14px; padding: 7px 18px; border: none; background: var(--accent); color: #fff; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--accent-dark); }

/* Card wrapping a table */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.card-head .meta { font-size: 12.5px; color: var(--muted); }

/* Excel-style tables */
table { border-collapse: collapse; width: 100%; border: 2px solid #333; }
th, td { text-align: left; padding: 5px 11px; border: 1px solid #b0b0b0; vertical-align: top; }
th { font-weight: 600; background: #f0f0f0; }
thead th { background: linear-gradient(#8c8c8c, #6e6e6e); color: #fff; border-color: #5a5a5a; font-size: 13px; }
tbody tr:nth-child(even) { background: #f2f3f5; }
.num { font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
.negative { color: var(--neg); }
.total td, .total th { font-weight: 600; background: #e9eaec; }
/* Account detail header: title left, metadata card right */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head .detail-title { margin: 6px 0 0; }
.acct-meta { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 10px 14px; font-size: 12.5px; }
.acct-meta-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.acct-meta dl { display: grid; grid-template-columns: auto auto; gap: 3px 14px; margin: 0; }
.acct-meta dt { color: var(--muted); }
.acct-meta dd { margin: 0; }

/* Usage meters (accounts list) */
th.usage-head, td.usage { min-width: 130px; }
.meter { display: flex; align-items: center; gap: 8px; }
.meter-track { flex: 1; height: 8px; min-width: 64px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 15%, var(--surface)); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.meter-fill.over-bad { background: var(--neg); }
.meter-fill.over-good { background: var(--pos); }
.meter-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }

/* Filter sidebars: .filters-panel is shared; .list-filters / .txn-filters
   carry only their container-specific placement. */
.filters-panel { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.filters-panel label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.filters-panel select, .filters-panel input { font: inherit; font-size: 14px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }
.filters-panel select:focus, .filters-panel input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.filters-link { font-size: 13px; text-align: center; }

/* Accounts page: filter sidebar + main column */
.list-layout { display: flex; align-items: flex-start; gap: 20px; }
.list-main { flex: 1; min-width: 0; }
.list-main .card { margin-bottom: 24px; }
.list-filters { flex: 0 0 230px; position: sticky; top: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); }
@media (max-width: 720px) {
    .list-layout { flex-direction: column; }
    .list-filters { position: static; flex: none; width: 100%; box-sizing: border-box; }
}

/* Transaction filters (sidebar) + sortable headers (account detail) */
.txn-layout { display: flex; align-items: flex-start; }
.txn-table-wrap { flex: 1; min-width: 0; overflow-x: auto; }
.txn-filters { flex: 0 0 210px; padding: 14px 16px; border-right: 1px solid var(--line); align-self: stretch; }
@media (max-width: 720px) {
    .txn-layout { flex-direction: column; }
    .txn-filters { flex: none; width: 100%; box-sizing: border-box; border-right: none; border-bottom: 1px solid var(--line); }
}
.txn-filters button { font: inherit; font-size: 13px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.txn-filters button:hover { color: var(--ink); border-color: var(--accent); }
#txn-count { margin-right: 12px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: "\2195"; opacity: 0.35; margin-left: 6px; font-size: 11px; }
th.sortable.asc::after { content: "\2191"; opacity: 1; }
th.sortable.desc::after { content: "\2193"; opacity: 1; }

/* Budget burn-down chart */
.chart-card { margin-bottom: 24px; }
.chart-card > summary { cursor: pointer; list-style: none; user-select: none; }
.chart-card > summary::-webkit-details-marker { display: none; }
.chart-card > summary::after { content: "\25B8"; color: var(--muted); font-size: 14px; margin-left: 12px; flex-shrink: 0; }
.chart-card[open] > summary::after { content: "\25BE"; }
.chart-card:not([open]) > summary { border-bottom: none; }
.chart-wrap { position: relative; padding: 14px 12px 6px; }
.burndown { display: block; width: 100%; height: auto; font-family: inherit; }
.burndown .grid { stroke: var(--line); stroke-width: 1; }
.burndown .zero { stroke: var(--muted); stroke-width: 1; }
.burndown .tick { fill: var(--muted); font-size: 12px; }
.burndown .ideal, .chart-legend .lg-ideal { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 1 7; stroke-linecap: round; fill: none; }
.burndown .actual, .chart-legend .lg-actual { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.burndown .end-ring, .burndown .hover-ring { fill: var(--surface); }
.burndown .end-dot, .burndown .hover-dot { fill: var(--accent); }
.burndown .end-label { fill: var(--ink); font-size: 13px; font-weight: 600; }
.burndown .end-label.neg-label { fill: var(--neg); }
.burndown .crosshair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
.chart-legend svg { vertical-align: middle; margin: 0 5px 2px 14px; }
.chart-legend svg:first-of-type { margin-left: 0; }
.chart-tip { position: absolute; top: 0; left: 0; background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.45; padding: 7px 10px; border-radius: 7px; pointer-events: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* Pager */
.pager { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); font-size: 14px; }
.pager .disabled { color: #c2b6a9; }
.pager .page-of { color: var(--muted); }

/* Text helpers */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); margin-top: 24px; }
.spaced { margin-top: 32px; }

/* Login hero */
body.login { margin: 0; padding: 0; background: var(--bg); }
/* background-image comes inline from config (school.toml branding.hero) */
.login-hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; background-color: var(--bg); background-position: center; background-size: cover; background-repeat: no-repeat; }
.login-card { background: rgba(255, 255, 255, 0.96); padding: 40px; border-radius: var(--radius); text-align: center; max-width: 360px; box-shadow: 0 6px 28px rgba(0, 0, 0, 0.28); border-top: 3px solid var(--accent); }
.login-card img { height: 76px; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .tag { color: var(--muted); margin: 0 0 24px; }
.signin { display: inline-block; padding: 12px 22px; background: var(--accent); color: #fff; border-radius: 8px; font-weight: 600; }
.signin:hover { background: var(--accent-dark); text-decoration: none; }
