/* ============================================================================
   BVTCMS DESIGN SYSTEM
   A registry/ledger-inspired aesthetic for a state vocational training system.
   Palette draws on Kanuri indigo-dye textiles and leatherwork craft rather
   than generic SaaS blue/purple gradients.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
    /* -- Palette --------------------------------------------------------- */
    --ink:          #262220;   /* body text */
    --ink-muted:    #6B6259;
    --parchment:    #F5EEDD;   /* app background */
    --paper:        #FDFBF3;   /* panel background, slightly lighter than parchment */
    --indigo:       #23375F;   /* brand / sidebar */
    --indigo-deep:  #16233D;   /* sidebar depth, hovers */
    --indigo-soft:  #E6EAF2;   /* tinted backgrounds on indigo-adjacent UI */
    --rust:         #A6432B;   /* danger / non-functional / high risk */
    --rust-soft:    #F3E1DA;
    --gold:         #A9781F;   /* attention / needs-repair / staff accent */
    --gold-soft:    #F2E8D3;
    --moss:         #4C6B3D;   /* success / functional / active */
    --moss-soft:    #E4EBDD;
    --sky:          #3E6E86;   /* informational / centres accent */
    --sky-soft:     #DEEAEF;
    --line:         #DDD2B4;   /* hairline borders on parchment */
    --line-soft:    #EAE1C8;

    --radius-sm: 3px;
    --radius-md: 5px;
    --shadow-panel: 0 1px 2px rgba(38, 34, 32, 0.06), 0 1px 0 rgba(38, 34, 32, 0.04);

    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--parchment);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 0.4em;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.9rem; font-weight: 500; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; max-width: 62ch; }

a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Subtle woven texture on the parchment background, echoing hand-loomed cloth */
.app-shell {
    min-height: 100vh;
    display: flex;
    background-image:
        repeating-linear-gradient(0deg, rgba(38,34,32,0.014) 0px, rgba(38,34,32,0.014) 1px, transparent 1px, transparent 3px);
}

/* ---------------------------------------------------------------------------
   SIDEBAR
--------------------------------------------------------------------------- */
.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--indigo) 0%, var(--indigo-deep) 100%);
    color: #EDEFF5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 4px;
}

.sidebar-brand .brand-text {
    line-height: 1.2;
}

.sidebar-brand .brand-text strong {
    font-family: var(--font-display);
    font-size: 1.02rem;
    display: block;
    color: #fff;
}

.sidebar-brand .brand-text span {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.55);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
}

.sidebar-section-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    padding: 14px 12px 6px;
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.82);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.sidebar-nav .nav-icon { flex-shrink: 0; }

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.07);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: #EDEFF5;
    color: var(--indigo-deep);
}

.sidebar-foot {
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
}

.sidebar-foot strong { color: rgba(255,255,255,0.8); display:block; font-size: 0.85rem;}

/* ---------------------------------------------------------------------------
   MAIN
--------------------------------------------------------------------------- */
.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-menu-btn {
    display: none;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 1.15rem;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
}

.mobile-menu-btn:hover { border-color: var(--indigo); color: var(--indigo); }

.sidebar-overlay { display: none; }

.topbar h1 { margin: 0; font-size: 1.35rem; }
.topbar .subtitle { color: var(--ink-muted); font-size: 0.85rem; margin-top: 2px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.user-chip .role-tag {
    font-size: 0.72rem;
    color: var(--ink-muted);
    display: block;
}

.content {
    padding: 28px 32px 60px;
    max-width: 1280px;
}

/* ---------------------------------------------------------------------------
   PANELS — ledger-style, left border keyed to module, not uniform shadow cards
--------------------------------------------------------------------------- */
.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 4px solid var(--indigo);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-panel);
}

.panel.accent-moss  { border-left-color: var(--moss); }
.panel.accent-gold  { border-left-color: var(--gold); }
.panel.accent-rust  { border-left-color: var(--rust); }
.panel.accent-sky   { border-left-color: var(--sky); }

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.panel-head h2, .panel-head h3 { margin: 0; }

/* Stat record — presented like a stamped ledger entry, not a gradient hero number */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-record {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    position: relative;
}

.stat-record::before {
    content: '';
    position: absolute;
    top: 12px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--moss);
}

.stat-record.tone-gold::before { background: var(--gold); }
.stat-record.tone-rust::before { background: var(--rust); }
.stat-record.tone-sky::before  { background: var(--sky); }

.stat-record .stat-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 6px;
    color: var(--ink);
}

.stat-record .stat-label {
    font-size: 0.82rem;
    color: var(--ink-muted);
}

.stat-record .stat-detail {
    font-size: 0.76rem;
    color: var(--ink-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}

/* ---------------------------------------------------------------------------
   TABLES — logbook feel
--------------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper);
}

table.registry {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.registry thead th {
    text-align: left;
    font-weight: 600;
    color: var(--ink-muted);
    padding: 11px 14px;
    border-bottom: 2px solid var(--line);
    background: var(--line-soft);
    font-size: 0.78rem;
    white-space: nowrap;
}

table.registry tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

table.registry tbody tr:last-child td { border-bottom: none; }
table.registry tbody tr:hover { background: rgba(35,55,95,0.03); }

.reg-no {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   BADGES — stamped, not pill-gradient
--------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 3px;
    font-size: 0.76rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-moss  { background: var(--moss-soft); color: var(--moss); }
.badge-moss::before { background: var(--moss); }
.badge-gold  { background: var(--gold-soft); color: var(--gold); }
.badge-gold::before { background: var(--gold); }
.badge-rust  { background: var(--rust-soft); color: var(--rust); }
.badge-rust::before { background: var(--rust); }
.badge-sky   { background: var(--sky-soft); color: var(--sky); }
.badge-sky::before { background: var(--sky); }
.badge-ink-muted { background: #EAE6DC; color: var(--ink-muted); }
.badge-ink-muted::before { background: var(--ink-muted); }

/* ---------------------------------------------------------------------------
   FORMS
--------------------------------------------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px 20px;
}

.field { margin-bottom: 4px; }
.field.full { grid-column: 1 / -1; }

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 5px;
}

.field .hint {
    font-size: 0.74rem;
    color: var(--ink-muted);
    margin-top: 4px;
}

input[type=text], input[type=date], input[type=email], input[type=tel],
input[type=password], input[type=number], select, textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

fieldset {
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin: 4px 0 18px;
}

fieldset legend {
    font-family: var(--font-display);
    font-size: 0.95rem;
    padding: 0 8px;
    color: var(--indigo);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

/* ---------------------------------------------------------------------------
   BUTTONS
--------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.86rem;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-deep); }

.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--indigo); color: var(--indigo); }

.btn-danger { background: transparent; border-color: var(--rust); color: var(--rust); }
.btn-danger:hover { background: var(--rust); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 0.78rem; }

/* ---------------------------------------------------------------------------
   FLASH MESSAGES
--------------------------------------------------------------------------- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    font-size: 0.88rem;
    border-left: 4px solid;
}

.flash-success { background: var(--moss-soft); border-color: var(--moss); color: #2F4526; }
.flash-error   { background: var(--rust-soft); border-color: var(--rust); color: #6B2A19; }

/* ---------------------------------------------------------------------------
   LOGIN PAGE
--------------------------------------------------------------------------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--indigo);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,0.05), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,0.04), transparent 40%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--paper);
    border-radius: var(--radius-md);
    padding: 38px 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.login-crest {
    text-align: center;
    margin-bottom: 22px;
}

.login-crest img {
    width: 108px;
    height: 108px;
    object-fit: contain;
    margin-bottom: 14px;
}

.login-crest h1 {
    font-size: 1.15rem;
    line-height: 1.3;
    margin-bottom: 2px;
}

.login-crest .ministry {
    font-size: 0.78rem;
    color: var(--ink-muted);
}

.login-card .field { margin-bottom: 16px; }

.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }

.login-foot {
    text-align: center;
    margin-top: 20px;
    font-size: 0.76rem;
    color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   PUBLIC HOMEPAGE
--------------------------------------------------------------------------- */
.public-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 40px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.public-nav .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-nav .brand img { width: 50px; height: 50px; object-fit: contain; }

.public-nav .brand strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    display: block;
    color: var(--ink);
}

.public-nav .brand span { font-size: 0.72rem; color: var(--ink-muted); }

.public-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
}

.public-nav .nav-links a:not(.btn) {
    color: var(--ink-muted);
    font-size: 0.88rem;
    font-weight: 500;
}
.public-nav .nav-links a:not(.btn):hover { color: var(--indigo); }

.public-hero {
    background: linear-gradient(180deg, var(--indigo) 0%, var(--indigo-deep) 100%);
    color: #fff;
    padding: 56px 40px 64px;
}

.public-hero .hero-inner { max-width: 1100px; margin: 0 auto; }

.letterhead {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.letterhead img { width: 92px; height: 92px; object-fit: contain; }

.letterhead .lh-text { line-height: 1.35; }
.letterhead .lh-text strong { display: block; font-size: 0.92rem; letter-spacing: 0.02em; }
.letterhead .lh-text span { font-size: 0.78rem; color: rgba(255,255,255,0.6); }

.public-hero h1 {
    color: #fff;
    font-size: 2.15rem;
    line-height: 1.2;
    max-width: 24ch;
    margin-bottom: 16px;
}

.public-hero .hero-sub {
    color: rgba(255,255,255,0.78);
    font-size: 1.05rem;
    max-width: 56ch;
    margin-bottom: 28px;
}

.hero-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.hero-actions .btn-primary {
    background: var(--gold);
    color: #2A2110;
}
.hero-actions .btn-primary:hover { background: #C08F32; }

.hero-actions .text-link {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.35);
    padding-bottom: 2px;
}
.hero-actions .text-link:hover { color: #fff; text-decoration: none; border-color: #fff; }

.public-section {
    padding: 56px 40px;
    max-width: 1100px;
    margin: 0 auto;
}

.public-section .section-head { max-width: 62ch; margin-bottom: 30px; }
.public-section .section-head h2 { font-size: 1.6rem; margin-bottom: 8px; }
.public-section .section-head p { color: var(--ink-muted); margin: 0; }

.stats-strip {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0 40px;
}
.stats-strip .stat-grid { max-width: 1100px; margin: -34px auto 0; padding-bottom: 34px; position: relative; z-index: 2; }
.stats-strip .stat-record { box-shadow: 0 8px 24px rgba(22,35,61,0.12); }

.trade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.trade-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 4px solid var(--moss);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}
.trade-card.tone-sky { border-left-color: var(--sky); }
.trade-card h3 { font-size: 1rem; margin-bottom: 4px; }
.trade-card p { font-size: 0.82rem; color: var(--ink-muted); margin: 0; }

.sponsor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.sponsor-item { padding: 4px 0 4px 16px; border-left: 2px solid var(--line); }
.sponsor-item strong { display: block; font-family: var(--font-display); font-size: 1.02rem; margin-bottom: 4px; }
.sponsor-item p { font-size: 0.86rem; color: var(--ink-muted); margin: 0; }

.cta-band {
    background: var(--gold-soft);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 40px;
    text-align: center;
}
.cta-band h2 { margin-bottom: 8px; }
.cta-band p { margin: 0 auto 20px; color: var(--ink-muted); }

.public-footer {
    background: var(--indigo-deep);
    color: rgba(255,255,255,0.65);
    padding: 30px 40px;
    font-size: 0.82rem;
    text-align: center;
}
.public-footer strong { color: rgba(255,255,255,0.9); }

@media (max-width: 760px) {
    .public-nav { padding: 12px 18px; }
    .public-nav .nav-links { gap: 14px; }
    .public-nav .nav-links a:not(.btn) { display: none; }
    .public-hero { padding: 40px 20px 52px; }
    .public-hero h1 { font-size: 1.9rem; max-width: none; }
    .public-section { padding: 40px 20px; }
    .stats-strip { padding: 0 16px; }
}

/* ---------------------------------------------------------------------------
   MISC
--------------------------------------------------------------------------- */
.muted { color: var(--ink-muted); }
.text-right { text-align: right; }
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--ink-muted);
}
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}

.filter-bar select, .filter-bar input {
    width: auto;
    min-width: 170px;
}

.progress-track {
    background: var(--line-soft);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--moss);
    border-radius: 20px;
}

@media (max-width: 900px) {
    .sidebar { position: fixed; left: -248px; z-index: 40; transition: left 0.2s ease; }
    .sidebar.open { left: 0; }
    .mobile-menu-btn { display: inline-flex; }
    .sidebar-overlay.open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(22, 35, 61, 0.45);
        z-index: 35;
    }
    .content { padding: 20px 16px 50px; }
    .topbar { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
