/* =============================================================
   print_schools.css  —  v2 shared styles for all print reports
   ============================================================= */

:root {
    --ink:        #0d1117;
    --ink-mid:    #374151;
    --ink-light:  #6b7280;
    --rule:       #c8cdd4;
    --rule-heavy: #374151;
    --accent:     #1a3c5e;
    --accent-alt: #c8992a;
    --green:      #1b5e20;
    --surface:    #ffffff;
    --tint:       #f3f6f9;
    --tint-alt:   #e8f0f8;
    --font:       "Arial Narrow", Arial, sans-serif;
    --font-label: "Arial Narrow", Arial, sans-serif;
    --font-body:  "Arial Narrow", Arial, sans-serif;
    --size-xs:  8px;  --xs: 8px;
    --size-sm:  9px;  --sm: 9px;
    --size-md:  10px; --md: 10px;
    --size-lg:  12px; --lg: 12px;
    --size-xl:  15px; --xl: 15px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: var(--md);
    color: var(--ink);
    background: #d1d5db;
    padding: 14px;
    line-height: 1.3;
}

/* ── TOOLBAR ─────────────────────────────────────────────── */
.toolbar {
    display: flex; gap: 8px; justify-content: center; margin-bottom: 12px;
}
.toolbar a {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px; background: var(--accent); color: #fff;
    text-decoration: none; font-size: var(--sm); font-weight: 700;
    letter-spacing: .4px;
}
.toolbar a:hover { background: #0f2740; }

/* ── PAGE ────────────────────────────────────────────────── */
.page {
    background: var(--surface);
    width: 100%; max-width: 1600px;
    margin: 0 auto;
    padding: 14px 18px 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,.15);
}

/* ── HEADER ──────────────────────────────────────────────── */
.doc-header {
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 2.5px solid var(--accent);
    margin-bottom: 6px;
}
.doc-header h1, .doc-header-center h1 {
    font-family: var(--font); font-size: 18px; font-weight: 900;
    letter-spacing: .8px; text-transform: uppercase; color: var(--green);
}
.doc-header h2, .doc-header-center h2 {
    font-family: var(--font); font-size: var(--sm); font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase; color: var(--ink-mid); margin-top: 1px;
}
.ribbon { height: 2px; background: var(--accent); margin: 4px 0 3px; }
.region-badge {
    display: inline-block; margin: 3px 0 2px;
    padding: 3px 18px; background: var(--green); color: #fff;
    font-size: var(--md); font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
}
.doc-header h3, .doc-header-center h3 {
    font-family: var(--font); font-size: var(--xl); font-weight: 900;
    text-transform: uppercase; color: var(--accent); margin-top: 4px; letter-spacing: .4px;
}
.doc-header h4, .doc-header-center h4 {
    font-family: var(--font); font-size: var(--lg); font-weight: 800;
    text-transform: uppercase; color: var(--green); margin-top: 2px;
}

/* ── SECTION LABEL ───────────────────────────────────────── */
.section-label {
    font-size: var(--sm); font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: #fff;
    background: var(--accent); padding: 4px 8px;
    margin: 8px 0 0; display: block;
}

/* ── TABLES ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: var(--sm); }
th, td {
    border: 1px solid var(--rule); padding: 3px 5px;
    text-align: center; vertical-align: middle;
}
thead th, thead td {
    background: var(--accent); color: #fff;
    font-size: var(--xs); font-weight: 700;
    letter-spacing: .3px; text-transform: uppercase;
}
tbody tr:nth-child(even) td { background: var(--tint); }
td.left, th.left, td[align="left"] { text-align: left; padding-left: 6px; }
td.num { font-weight: 600; }
td.pos { font-weight: 800; color: var(--accent); }

/* multi-row header rows */
thead tr:nth-child(2) th, thead tr:nth-child(2) td {
    background: #1e4d78; color: #fff;
    font-size: var(--xs); font-weight: 700;
}
thead tr:nth-child(3) th, thead tr:nth-child(3) td {
    background: var(--tint-alt); color: var(--accent);
    font-size: var(--xs); font-weight: 700;
    border-bottom: 2px solid var(--accent);
}

/* rotated headers */
th.vertical, .vertical {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    height: 70px; padding: 4px 2px; white-space: nowrap;
}

/* totals / tfoot */
tfoot td, tr.totals td {
    background: var(--accent) !important; color: #fff !important;
    font-weight: 800; font-size: var(--xs);
    border-color: rgba(255,255,255,.3) !important;
}

/* ── GRADE HEADER COLOURS ────────────────────────────────── */
thead th.g-a, th.g-a { background: #1b5e20 !important; color: #fff !important; }
thead th.g-b, th.g-b { background: #2e7d32 !important; color: #fff !important; }
thead th.g-c, th.g-c { background: #f9a825 !important; color: #000 !important; }
thead th.g-d, th.g-d { background: #e65100 !important; color: #fff !important; }
thead th.g-f, th.g-f { background: #b71c1c !important; color: #fff !important; }

/* ── GRADE DATA CELL COLOURS ─────────────────────────────── */
td.d-a { background: #c8e6c9 !important; color: #1b5e20; font-weight: 700; }
td.d-b { background: #dcedc8 !important; color: #33691e; font-weight: 700; }
td.d-c { background: #fff9c4 !important; color: #7b5a00; font-weight: 700; }
td.d-d { background: #ffccbc !important; color: #bf360c; font-weight: 700; }
td.d-f { background: #ffcdd2 !important; color: #b71c1c; font-weight: 700; }

/* ── DIVISION COLOURS ────────────────────────────────────── */
thead th.div-header, th.div-header { background: #1565c0 !important; color: #fff !important; }
td.d-div  { background: #bbdefb !important; color: #0d47a1; font-weight: 700; }
td.d-div0 { background: #ffcdd2 !important; color: #b71c1c; font-weight: 700; }

/* inline division cell shading (used by main-table approach) */
td.div-i   { background: #c8e6c9 !important; color: #1b5e20; font-weight: 700; }
td.div-ii  { background: #dcedc8 !important; color: #33691e; font-weight: 700; }
td.div-iii { background: #fff9c4 !important; color: #7b5a00; font-weight: 600; }
td.div-iv  { background: #ffccbc !important; color: #bf360c; }
td.div-0   { background: #ffcdd2 !important; color: #b71c1c; font-weight: 700; }
td.pct-good { color: var(--green); font-weight: 700; }
td.pct-bad  { color: #b71c1c; font-weight: 700; }

/* ── DIVISION SUMMARY BAR ────────────────────────────────── */
.division-summary {
    background: #e1ecf7; border: 1.5px solid #aac4df;
    padding: 5px 12px; text-align: center;
    font-size: var(--md); font-weight: 700; letter-spacing: .2px;
    margin-top: 0;
}

/* ── KEY BAR ─────────────────────────────────────────────── */
.key-bar {
    font-size: var(--xs); color: var(--ink-light);
    padding: 5px 10px; background: var(--tint);
    border-left: 3px solid var(--accent-alt);
    margin-bottom: 8px; display: flex;
    flex-wrap: wrap; gap: 6px 20px; align-items: center;
}
.key-bar strong { color: var(--ink); }

/* ── FOOTER ──────────────────────────────────────────────── */
.doc-footer {
    margin-top: 14px; border-top: 2px solid var(--accent);
    padding-top: 5px; display: flex;
    justify-content: space-between;
    font-size: var(--xs); color: var(--ink-light);
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
    body { background: #fff; padding: 0; margin: 0;
           -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .toolbar { display: none !important; }
    .page { box-shadow: none; padding: 6mm 8mm 10mm; max-width: 100%; }
    table { page-break-inside: auto; font-size: 8px; }
    tr    { page-break-inside: avoid; page-break-after: auto; }
    thead { display: table-header-group; }
    th, td { padding: 2px 3px; font-size: 7.5px; }
    th.vertical, .vertical { height: 55px; }
    .section-label { background: var(--accent) !important; color: #fff !important; }
    .doc-header h1, .doc-header-center h1 { color: var(--green) !important; }
    .region-badge { background: var(--green) !important; color: #fff !important; }
    .ribbon { background: var(--accent) !important; }
    /* grade headers */
    th.g-a { background: #1b5e20 !important; color: #fff !important; }
    th.g-b { background: #2e7d32 !important; color: #fff !important; }
    th.g-c { background: #f9a825 !important; color: #000 !important; }
    th.g-d { background: #e65100 !important; color: #fff !important; }
    th.g-f { background: #b71c1c !important; color: #fff !important; }
    /* grade data */
    td.d-a { background: #c8e6c9 !important; }
    td.d-b { background: #dcedc8 !important; }
    td.d-c { background: #fff9c4 !important; }
    td.d-d { background: #ffccbc !important; }
    td.d-f { background: #ffcdd2 !important; }
    /* divisions */
    th.div-header { background: #1565c0 !important; color: #fff !important; }
    td.d-div  { background: #bbdefb !important; }
    td.d-div0 { background: #ffcdd2 !important; }
    td.div-i  { background: #c8e6c9 !important; }
    td.div-ii { background: #dcedc8 !important; }
    td.div-iii{ background: #fff9c4 !important; }
    td.div-iv { background: #ffccbc !important; }
    td.div-0  { background: #ffcdd2 !important; }
    /* thead rows */
    thead th, thead td { background: var(--accent) !important; color: #fff !important; }
    thead tr:nth-child(2) th { background: #1e4d78 !important; color: #fff !important; }
    thead tr:nth-child(3) th { background: var(--tint-alt) !important; color: var(--accent) !important; }
    tbody tr:nth-child(even) td { background: var(--tint) !important; }
    tfoot td { background: var(--accent) !important; color: #fff !important; }
}
