/* ============================================================
   SUSMS Design System
   Palette: Navy (authority/records) · Teal (action/live data) · Gold (honors/seal)
   Type: Cambria (headings, registrar-document feel) / Calibri (body, readable at scale)
   Signature: grade badges + double-rule "ledger" treatment on official documents
   ============================================================ */

:root {
    --navy: #0B2545;
    --navy-light: #16345E;
    --navy-pale: #EDF1F7;
    --teal: #0E8C82;
    --teal-dark: #096B63;
    --teal-pale: #E4F4F2;
    --gold: #C9A227;
    --gold-light: #F4E4B0;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7789;
    --border: #E2E6EC;
    --red: #C0392B;
    --red-pale: #FBEAE8;
    --green: #1E8A5F;
    --green-pale: #E7F5EE;
    --blue: #2E6FD9;
    --blue-pale: #EAF1FD;
    --amber: #D68910;
    --amber-pale: #FCF1E1;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(11,37,69,0.08), 0 1px 2px rgba(11,37,69,0.06);
    --shadow-lg: 0 10px 30px rgba(11,37,69,0.12);
    --font-head: Cambria, Georgia, "Times New Roman", serif;
    --font-body: Calibri, Candara, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}
h1, h2, h3, h4, h5 { font-family: var(--font-head); color: var(--navy); margin: 0 0 .4em; font-weight: 700; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy) 0%, #0A1F3B 100%);
    color: #EAF0FA;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
    padding: 22px 20px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .mark {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--gold); color: var(--navy);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head); font-weight: 700; font-size: 16px;
    border: 2px solid rgba(255,255,255,.35);
}
.sidebar-brand .name { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: #fff; line-height: 1.1; }
.sidebar-brand .sub { font-size: 11px; color: #9FB3D1; letter-spacing: .05em; text-transform: uppercase; }

.sidebar-nav { padding: 14px 10px; flex: 1; }
.sidebar-nav .group-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: #7C93B8; margin: 18px 10px 6px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; color: #D6E1F2;
    font-size: 14.5px; margin-bottom: 2px; text-decoration: none;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); }
.sidebar-nav a.active { background: var(--teal); color: #fff; font-weight: 600; }
.sidebar-nav a .ico { width: 18px; text-align: center; opacity: .9; }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12.5px; color: #93A9C9; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 14px 26px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .crumbs { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--teal-pale); color: var(--teal-dark);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-head);
}
.user-chip .meta { line-height: 1.2; }
.user-chip .meta .role { font-size: 11.5px; color: var(--text-muted); text-transform: capitalize; }

.content { padding: 26px; flex: 1; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); border-left: 4px solid var(--teal);
}
.stat-card.gold { border-left-color: var(--gold); }
.stat-card.navy { border-left-color: var(--navy); }
.stat-card.red  { border-left-color: var(--red); }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-family: var(--font-head); font-size: 30px; color: var(--navy); font-weight: 700; margin-top: 4px; }
.stat-card .foot { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 10px 18px; border-radius: 8px; font-size: 14.5px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; font-family: var(--font-body);
    transition: filter .12s ease;
}
.btn:hover { filter: brightness(0.94); text-decoration: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: var(--navy-light); }
input, select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-family: var(--font-body); font-size: 14.5px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-pale); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.help-text { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--navy-pale); color: var(--navy); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #FAFBFD; }
.table-wrap { overflow-x: auto; }
td input { padding: 6px 8px; font-size: 13.5px; }

/* ---------- Badges (signature element) ---------- */
.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
    font-family: var(--font-head); font-weight: 700; font-size: 14px;
}
.badge-gold  { background: var(--gold-light); color: #7A5E0C; }
.badge-teal  { background: var(--teal-pale);  color: var(--teal-dark); }
.badge-blue  { background: var(--blue-pale);  color: var(--blue); }
.badge-amber { background: var(--amber-pale); color: var(--amber); }
.badge-red   { background: var(--red-pale);   color: var(--red); }
.badge-grey  { background: #EEF1F5; color: var(--text-muted); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-active { background: var(--green-pale); color: var(--green); }
.pill-inactive { background: var(--red-pale); color: var(--red); }

/* ---------- Alerts / flash ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--green-pale); color: var(--green); border-color: #BFE6D3; }
.alert-error   { background: var(--red-pale); color: var(--red); border-color: #F2C6C1; }
.alert-info    { background: var(--blue-pale); color: var(--blue); border-color: #CBDCF7; }

/* ---------- Auth pages ---------- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at top left, #123258 0%, var(--navy) 45%, #071A31 100%);
    padding: 20px;
}
.auth-card {
    width: 100%; max-width: 400px; background: #fff; border-radius: 14px;
    box-shadow: var(--shadow-lg); padding: 36px 34px; text-align: center;
}
.auth-card .mark {
    width: 58px; height: 58px; border-radius: 50%; background: var(--gold); color: var(--navy);
    font-family: var(--font-head); font-weight: 700; font-size: 22px;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
    border: 3px solid var(--navy-pale);
}
.auth-card h1 { font-size: 22px; margin-bottom: 2px; }
.auth-card .tagline { color: var(--text-muted); font-size: 13.5px; margin-bottom: 24px; }
.auth-card form { text-align: left; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: #9FB3D1; }

/* ---------- Report card (ledger / registrar-document signature) ---------- */
.report-card {
    background: #fff; border: 3px double var(--navy); border-radius: 4px;
    max-width: 780px; margin: 0 auto; padding: 30px 34px;
}
.report-card .rc-header { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid var(--gold); padding-bottom: 16px; margin-bottom: 18px; }
.report-card .rc-seal {
    width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--navy);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: 12px; text-align: center; line-height: 1.1;
}
.report-card .rc-titles { flex: 1; }
.report-card .rc-titles .org { font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.report-card .rc-titles h2 { margin: 2px 0; font-size: 21px; }
.report-card .rc-titles .doc-title { font-size: 13px; color: var(--teal-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.report-card .rc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 20px; margin-bottom: 18px; font-size: 13.5px; }
.report-card .rc-meta div span { display: block; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; }
.report-card table { font-size: 13.5px; }
.report-card .rc-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.report-card .rc-summary .box { background: var(--navy-pale); border-radius: 8px; padding: 12px 14px; text-align: center; }
.report-card .rc-summary .box .n { font-family: var(--font-head); font-size: 22px; color: var(--navy); font-weight: 700; }
.report-card .rc-summary .box .l { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; }
.report-card .rc-comments { margin-top: 18px; font-size: 13.5px; }
.report-card .rc-comments .line { border-bottom: 1px dashed var(--border); padding: 10px 0; }
.report-card .rc-sign { display: flex; justify-content: space-between; margin-top: 30px; }
.report-card .rc-sign div { text-align: center; width: 180px; border-top: 1px solid var(--text); padding-top: 6px; font-size: 12px; color: var(--text-muted); }

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .report-card { border-width: 2px; box-shadow: none; margin: 0; max-width: 100%; }
}

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

@media (max-width: 900px) {
    .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .grid-2, .rc-meta, .rc-summary { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}
