/* Default theme. Per-school colors from config/school.toml are injected as a
   :root override in base.html and login.html and take precedence. */
: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; }
/* Desktop tool for business staff: use the width of the monitor. The vw term
   keeps a margin on very large displays. */
.wrap { max-width: min(2200px, 96vw); 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: min(2200px, 96vw); 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; }

/* Daily Sky quota meter. Neutral under half, warm past half, red past 80%. */
.quota { font-size: 12.5px; color: var(--muted); padding: 5px 11px; border-radius: 7px;
         border: 1px solid var(--line); white-space: nowrap; margin-right: 14px; }
.quota strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.quota.warm { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.quota.warm strong { color: var(--accent-dark); }
.quota.hot { border-color: var(--neg); background: color-mix(in srgb, var(--neg) 8%, transparent); }
.quota.hot strong { color: var(--neg); }
@media (max-width: 900px) { .quota-label { display: none; } }
@media (max-width: 720px) { .quota { display: none; } }

/* Primary navigation */
.mainnav { display: flex; gap: 4px; margin-left: auto; margin-right: 20px; }
.mainnav a {
    padding: 7px 14px; border-radius: 7px; font-size: 14px; font-weight: 500;
    color: var(--muted); white-space: nowrap;
}
.mainnav a:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--ink); text-decoration: none; }
.mainnav a.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-dark); }
@media (max-width: 720px) {
    .mainnav { margin-right: 8px; }
    .mainnav a { padding: 7px 9px; font-size: 13px; }
}

/* 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); }
.btn-quiet { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.btn-quiet:hover { background: color-mix(in srgb, var(--neg) 8%, transparent); color: var(--neg); }

/* Settings page */
.settings-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 4px 22px 18px; margin-bottom: 18px; max-width: 980px; }
.settings input:not([type=checkbox]), .settings select { font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.settings input:focus, .settings select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.settings-years { width: auto; margin: 8px 0 10px; }
.settings-years td { vertical-align: middle; }
.settings .field { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.settings .field > span { min-width: 230px; font-weight: 500; }
.inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.image-slot { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.image-slot:first-of-type { border-top: none; }
.image-preview { width: 120px; height: 72px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.image-preview.wide { width: 200px; height: 112px; }
.image-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-preview.wide img { width: 100%; height: 100%; object-fit: cover; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 4px 8px 4px 0; }
.linkish { font: inherit; background: none; border: none; padding: 0; color: var(--link); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.notice { padding: 10px 14px; border-radius: 8px; margin: 14px 0; max-width: 980px; }
.notice ul { margin: 6px 0 0; }
.notice.ok { background: color-mix(in srgb, var(--pos) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--pos) 35%, var(--line)); }
.notice.bad { background: color-mix(in srgb, var(--neg) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--neg) 40%, var(--line)); }

/* 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 the hero uploaded on the Settings page */
.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; }
