/* ============================================================
   GT Par Index — PGA Premier Light Theme
   Noto Sans body · Noto Sans Mono for numbers
   Tight spacing — no wasted real estate
   ============================================================ */

/* ---- Design tokens ---- */
:root {
    --primary-bg:     #E3E2DE;
    --primary-accent: #1351AA;
    --primary-text:   #141414;
    --secondary-text: #444343;
    --muted-text:     #7A7A7A;
    --border-color:   #C7C7C7;

    --year-band-a:    #E3E2DE;
    --year-band-b:    #D9D8D3;

    --text:           #141414;
    --text-mid:       #444343;
    --text-muted:     #7A7A7A;

    --shadow-xs: none; --shadow-sm: none; --shadow: none; --shadow-lg: none;
    --grad-navy: none; --grad-gold: none; --grad-green: none;

    --font-sans: 'General Sans', 'Aileron', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --nav-height: 48px;
}

[data-bs-theme="light"] {
    --bs-body-bg:          #E3E2DE;
    --bs-body-color:       #141414;
    --bs-link-color:       #1351AA;
    --bs-link-hover-color: #0d3a7f;
    --bs-border-color:     #C7C7C7;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 15px;
    background: var(--primary-bg);
    scroll-behavior: smooth;
}
@media (min-width: 768px)  { html { font-size: 16px; } }
@media (min-width: 1200px) { html { font-size: 17px; } }

body {
    background: var(--primary-bg);
    color: var(--primary-text);
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

a { color: var(--primary-accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-text); }

/* ============================================================
   NAVIGATION — compact 48px bar
   ============================================================ */
.gtpar-nav {
    background: rgba(227, 226, 222, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: var(--nav-height);
    padding: 0 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand { padding: 0; line-height: 1; }

.brand-name {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: var(--primary-text);
}
.brand-name strong {
    font-weight: 900;
    color: var(--primary-accent);
    font-size: 1.1rem;
}

.gtpar-nav .nav-link {
    color: var(--primary-text) !important;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 0;
    transition: color 0.2s;
}
.gtpar-nav .nav-link:hover { color: var(--primary-accent) !important; background: none; }

.navbar-toggler {
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.2rem 0.4rem;
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23141414' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 20px; height: 20px;
}

@media (max-width: 767px) {
    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        background: rgba(227, 226, 222, 0.97);
        border-top: 1px solid var(--border-color);
        padding: 0.4rem 0.75rem;
        margin: 0 -0.75rem;
    }
}

/* ---- Dropdown ---- */
.dropdown-menu {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.2rem 0;
    min-width: 180px;
    margin-top: 0 !important;
}
@media (max-width: 767px) {
    .dropdown-menu {
        background: var(--primary-bg);
        border: 1px solid var(--border-color);
        border-radius: 0;
        padding: 0.2rem 0;
    }
    .dropdown-menu .dropdown-item {
        color: var(--primary-text) !important;
        border-bottom-color: var(--border-color) !important;
    }
    .dropdown-menu .dropdown-item:hover {
        background: var(--year-band-b) !important;
        color: var(--primary-accent) !important;
        border-left-color: var(--primary-accent) !important;
    }
    .dropdown-divider { border-color: var(--border-color) !important; }
}
.dropdown-menu .dropdown-item {
    font-family: var(--font-sans);
    color: var(--primary-text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--border-color);
}
.dropdown-menu .dropdown-item:last-child { border-bottom: none; }
.dropdown-menu .dropdown-item:hover {
    background: var(--year-band-b);
    color: var(--primary-accent);
    border-left-color: var(--primary-accent);
}
.dropdown-divider { border-color: var(--border-color); margin: 0.15rem 0; }

/* ---- Banner ---- */
.site-banner-wrap {
    width: 100%;
    max-height: 140px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}
@media (max-width: 575px) {
    .site-banner-wrap { max-height: 80px; }
}
.site-banner-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
@media (max-width: 575px) {
    .site-banner-img { height: 80px; }
}

/* ---- Footer ---- */
.gtpar-footer {
    background: var(--primary-text);
    border-top: 1px solid var(--border-color);
    color: var(--primary-bg);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 0.6rem 0;
    text-align: center;
    margin-top: auto;
}

/* ============================================================
   GT PAR DEFINITION — collapsible, tight
   ============================================================ */
.gt-par-definition {
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    padding: 0.6rem 0.75rem;
}
.definition-content { margin: 0; }
.definition-content h2 {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-accent);
    margin: 0 0 0.35rem 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.definition-content p {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--secondary-text);
    margin: 0 0 0.35rem 0;
}
.definition-content p:last-child { margin-bottom: 0; }
.def-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.35rem 0;
}
.def-list li {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--secondary-text);
    padding: 0.1rem 0 0.1rem 0.75rem;
    position: relative;
}
.def-list li::before {
    content: "\2022";
    color: var(--primary-accent);
    font-weight: 700;
    position: absolute;
    left: 0;
}
.def-list strong {
    color: var(--primary-accent);
    font-weight: 700;
}
/* Desktop: show full text, hide mobile */
.def-desktop { display: block; }
.def-mobile  { display: none; }

/* ============================================================
   PAGE HEADER — compact single line
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--primary-text);
    margin: 0;
    white-space: nowrap;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Info toggle button */
.btn-info-toggle {
    height: 26px;
    border-radius: 13px;
    background: var(--primary-accent);
    border: none;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    gap: 4px;
    white-space: nowrap;
}
.btn-info-toggle .info-icon {
    font-weight: 800;
}
.btn-info-toggle .info-label {
    font-size: 0.75rem;
    font-weight: 600;
}
.btn-info-toggle:hover { background: #0d3a7f; }

/* ============================================================
   COURSE TABLE — desktop
   ============================================================ */
.courses-panel {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-top: none;
}

.courses-panel .table-responsive {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.courses-panel .table {
    margin: 0;
    color: var(--primary-text);
    font-size: 0.9rem;
    border-collapse: collapse;
    width: 100%;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: transparent;
    --bs-table-color: var(--primary-text);
    --bs-table-striped-color: var(--primary-text);
    --bs-table-hover-color: var(--primary-text);
    --bs-table-border-color: var(--border-color);
}

/* Table header */
.courses-panel .table thead th {
    background: var(--primary-bg);
    color: var(--primary-text);
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-bottom: 1px solid var(--border-color);
    border-top: none;
    padding: 0.4rem 0.35rem;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.courses-panel .table thead th a {
    color: var(--primary-text);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.15s;
}
.courses-panel .table thead th a:hover { color: var(--primary-accent); }

/* Rows — year bands */
.courses-panel .table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    background: var(--year-band-a);
}
.courses-panel .table tbody tr.band-b { background: var(--year-band-b); }
.courses-panel .table tbody tr:hover:not(.history-row) { background: rgba(19, 81, 170, 0.04); }
.courses-panel .table tbody tr:last-child { border-bottom: none; }

.courses-panel .table tbody td {
    padding: 0.2rem 0.35rem;
    vertical-align: middle;
    border: none;
    background-color: transparent !important;
    color: var(--primary-text);
}

/* Logo column */
.col-logo { width: 50px; overflow: hidden; }
.course-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    display: block;
    background: transparent;
    border: none;
}

/* Expand column */
.col-expand { width: 30px; }

/* Course name — takes remaining space, truncates long names */
.col-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-name-link {
    font-family: var(--font-sans);
    font-weight: 600;
    color: #141414;
    font-size: 0.88rem;
    line-height: 1.3;
    transition: color 0.15s;
}
.course-name-link:hover { color: #1351AA; }

/* Year inline — shown on mobile next to course name */
.course-year-inline {
    display: none;
    font-size: 0.7rem;
    color: var(--muted-text);
    font-weight: 500;
    margin-left: 0.3rem;
}

/* Year column */
.col-hide-sm { width: 55px; }

/* Year badge — desktop */
.cry-badge {
    display: inline-block;
    font-family: var(--font-mono);
    background: var(--border-color);
    color: var(--primary-text);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--border-color);
    letter-spacing: 0.02em;
}

/* Par columns */
.col-par { width: 50px; overflow: hidden; }

.par-label {
    display: none; /* hidden on desktop, shown on mobile */
}

.stat-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.03em;
    display: block;
    margin: 0;
    padding: 0;
}
.stat-high { color: #dc2626; }
.stat-avg  { color: var(--primary-accent); }
.stat-low  { color: #22c55e; }

/* Agreement cell */
.agreement-cell { width: 60px; text-align: center; padding: 0.15rem 0.25rem !important; }
.agreement-bar  { display: none; }
.agreement-fill { display: none; }
.agreement-pct {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-accent);
    display: block;
    margin: 0;
}
.vote-counts { display: none; }
.sort-arrow { color: var(--primary-accent); font-size: 0.6rem; }

/* Notes */
.col-notes { width: 100px; }
.notes-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-text);
    font-size: 0.8rem;
    font-style: italic;
}

/* ---- Vote buttons ---- */
.vote-col { width: 110px; white-space: nowrap; }
.vote-btns { display: flex; gap: 3px; align-items: center; }

.vote-icon { margin-right: 0.2rem; font-weight: 700; }

.btn-vote-agree {
    background: var(--primary-accent);
    border: none;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 28px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}
.btn-vote-agree:hover:not(:disabled) { background: #0d3a7f; transform: translateY(-1px); }
.btn-vote-agree:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-vote-agree.voted-agree {
    background: #16a34a;
    border: 2px solid #16a34a;
    color: #fff;
}

.btn-vote-disagree {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 28px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}
.btn-vote-disagree:hover:not(:disabled) { border-color: var(--primary-accent); color: var(--primary-accent); transform: translateY(-1px); }
.btn-vote-disagree.voted-disagree {
    background: #dc2626;
    border: 2px solid #dc2626;
    color: #fff;
}

/* ---- Expand button ---- */
.btn-expand {
    width: 22px;
    height: 22px;
    border-radius: 0;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.btn-expand:hover { background: var(--primary-accent); border-color: var(--primary-accent); color: #fff; }
.btn-expand.expanded { background: var(--primary-accent); border-color: var(--primary-accent); color: #fff; }

/* ---- History row ---- */
.history-row td {
    padding: 0 !important;
    background: var(--year-band-b) !important;
    border-bottom: 1px solid var(--border-color) !important;
    border-top: 1px solid var(--border-color) !important;
}
.history-inner {
    padding: 3px 8px 3px 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
}
.history-entry { white-space: nowrap; overflow-x: auto; }
.h-date  { color: var(--muted-text); }
.h-who   { color: var(--secondary-text); font-weight: 600; }
.h-src   { color: var(--muted-text); font-style: italic; }
.h-to-h  { color: var(--primary-accent); font-weight: 700; }
.h-to-a  { color: var(--primary-accent); font-weight: 700; }
.h-to-l  { color: var(--primary-accent); font-weight: 700; }
.history-no-data {
    font-family: var(--font-mono);
    color: var(--muted-text);
    font-size: 0.8rem;
    font-style: italic;
}

/* ---- Search ---- */
.course-search {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    border-radius: 0;
    padding: 0.25rem 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    width: 100%;
    max-width: 180px;
    transition: all 0.15s;
}
.course-search:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(19, 81, 170, 0.1);
}
.course-search::placeholder { color: var(--muted-text); }

/* ---- Empty state ---- */
.empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================================
   RESPONSIVE — MOBILE (<576px)
   Compact list: each course is one tight row
   Logo (36px) | Name + Year | H A L scores inline
   ============================================================ */
@media (max-width: 575px) {
    :root { --nav-height: 44px; }

    .col-hide-sm { display: none !important; }
    .col-hide-mobile { display: none !important; }

    /* Show year inline with name */
    .course-year-inline { display: inline; }

    /* Page header compact */
    .page-header {
        padding: 0.3rem 0.5rem;
        gap: 0.35rem;
    }
    .page-title { font-size: 0.95rem; }
    .course-search { max-width: 120px; font-size: 0.8rem; padding: 0.2rem 0.5rem; }

    /* Table stays as table — NOT cards. Compact rows. */
    .courses-panel .table thead { display: none; }

    .courses-panel .table-responsive {
        max-height: none;
        overflow-y: visible;
        overflow-x: hidden;
    }

    .courses-panel .table {
        border-collapse: collapse;
        table-layout: auto;
        width: 100%;
    }

    /* Each row is a compact flex strip */
    .courses-panel .table tbody tr.course-data-row {
        display: flex;
        align-items: center;
        padding: 0.3rem 0.4rem;
        gap: 0;
        border-bottom: 1px solid var(--border-color);
        min-height: 0;
    }

    .courses-panel .table tbody td {
        display: block;
        padding: 0 !important;
        border: none;
        margin: 0;
    }

    /* Expand button */
    .col-expand {
        flex: 0 0 24px;
        display: flex !important;
        align-items: center;
    }
    .btn-expand { width: 20px; height: 20px; font-size: 0.75rem; }

    /* Logo — small */
    .col-logo {
        flex: 0 0 38px;
        width: 38px !important;
        display: flex !important;
        align-items: center;
        padding-left: 0.2rem !important;
    }
    .course-logo { width: 34px; height: 34px; }

    /* Name + year — shrink to content, don't hog space */
    .col-name {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
        padding-left: 0.3rem !important;
        padding-right: 0.3rem !important;
        display: flex !important;
        align-items: baseline;
        flex-wrap: nowrap;
    }
    .course-name-link {
        font-size: 0.82rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: baseline;
    }
    .course-year-inline {
        font-size: 0.65rem;
        flex-shrink: 0;
    }

    /* Par scores — fixed-width cells so values always align */
    .col-par {
        flex: 0 0 32px;
        width: 32px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
    }
    .par-label { display: none; }
    .stat-num {
        font-size: 0.88rem;
        display: inline;
        font-weight: 800;
        font-variant-numeric: tabular-nums;
    }

    /* Hide notes and agree % on mobile */
    .notes-cell { display: none !important; }

    /* Compact vote on mobile — icon-only buttons */
    .vote-cell.col-hide-mobile {
        display: flex !important;
        flex: 0 0 auto;
        align-items: center;
        padding-left: 0.35rem !important;
    }
    .vote-cell .vote-btns {
        gap: 2px;
    }
    .vote-cell .btn-vote-agree,
    .vote-cell .btn-vote-disagree {
        font-size: 0;       /* hide text */
        padding: 0.2rem 0.35rem;
        min-height: 24px;
        min-width: 24px;
    }
    .vote-cell .btn-vote-agree .vote-icon,
    .vote-cell .btn-vote-disagree .vote-icon {
        font-size: 0.75rem;
        margin: 0;
    }

    /* History row on mobile */
    .history-row {
        display: block !important;
    }
    .history-row td {
        display: block !important;
    }
    .history-inner {
        padding: 4px 8px;
        font-size: 0.72rem;
        overflow-x: auto;
    }

    /* Definition panel mobile — show short version */
    .gt-par-definition { padding: 0.4rem 0.5rem; }
    .def-desktop { display: none; }
    .def-mobile  { display: block; }
    .definition-content h2 { font-size: 0.78rem; margin-bottom: 0.25rem; }
    .definition-content p  { font-size: 0.75rem; line-height: 1.4; }
}

/* Tablet — hide year column, keep everything else */
@media (min-width: 576px) and (max-width: 767px) {
    .col-hide-sm { display: none !important; }
    .course-year-inline { display: inline; }

    .page-title { font-size: 1rem; }

    .courses-panel .table-responsive {
        max-height: calc(100vh - 130px);
    }

    .course-logo { width: 40px; height: 40px; }
    .col-logo { width: 46px; }
}

/* Desktop 768px+ — everything visible */
@media (min-width: 768px) {
    .col-hide-mobile { display: table-cell !important; }

    .courses-panel .table-responsive {
        max-height: calc(100vh - 120px);
    }
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: 0;
    font-size: 0.9rem;
    border-width: 1px;
    padding: 0.45rem 0.75rem;
}
.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--primary-text);
    border-left: 4px solid #22c55e;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--primary-text);
    border-left: 4px solid #ef4444;
}
.alert-info {
    background: rgba(19, 81, 170, 0.1);
    border-color: rgba(19, 81, 170, 0.3);
    color: var(--primary-text);
    border-left: 4px solid var(--primary-accent);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--primary-text);
}
.modal-header {
    background: var(--primary-accent);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.6rem 0.75rem;
}
.modal-header .modal-title { color: #fff; font-weight: 700; font-size: 0.95rem; }
.modal-header .btn-close   { filter: brightness(0) invert(1); }
.modal-footer              { border-top: 1px solid var(--border-color); padding: 0.5rem 0.75rem; background: var(--primary-bg); }
.modal-body                { padding: 0.75rem; font-size: 0.9rem; background: var(--primary-bg); }

/* ============================================================
   ADMIN PANELS
   ============================================================ */
.admin-panel {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.75rem 1rem;
}
.admin-panel h2, .admin-panel h3 {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: var(--primary-accent);
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}
.admin-panel h2::after, .admin-panel h3::after { content: ''; display: none; }

/* ---- Forms ---- */
.form-label {
    font-family: var(--font-sans);
    color: var(--secondary-text);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    display: block;
}
.form-control, .form-select {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 400;
    padding: 0.35rem 0.7rem;
    transition: all 0.15s;
}
.form-control:focus, .form-select:focus {
    background: #fff;
    border-color: var(--primary-accent);
    color: var(--primary-text);
    box-shadow: 0 0 0 2px rgba(19, 81, 170, 0.1);
    outline: none;
}
.form-control::placeholder { color: var(--muted-text); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 0;
    padding: 0.35rem 0.9rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
    border: none;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary-accent); border: none; color: #fff; }
.btn-primary:hover { background: #0d3a7f; color: #fff; }

.btn-success { background: #22c55e; border: none; color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-danger { background: #ef4444; border: none; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-secondary { background: #fff; border: 1px solid var(--border-color); color: var(--secondary-text); }
.btn-secondary:hover { background: var(--year-band-b); border-color: var(--border-color); color: var(--primary-text); }

.btn-outline-success { border: 1px solid #22c55e; color: #22c55e; background: transparent; }
.btn-outline-success:hover { background: #22c55e; color: #fff; border-color: #22c55e; }

.btn-outline-secondary { border: 1px solid var(--border-color); color: var(--muted-text); background: transparent; }
.btn-outline-secondary:hover { background: var(--year-band-b); border-color: var(--border-color); color: var(--primary-text); }

.btn-info { background: var(--primary-accent); border: none; color: #fff; }
.btn-info:hover { background: #0d3a7f; }

.btn-sm { font-size: 0.8rem; padding: 0.2rem 0.6rem; }

/* ============================================================
   GENERIC TABLE (admin)
   ============================================================ */
.table { color: var(--primary-text); border-color: var(--border-color); font-size: 0.9rem; }
.table > :not(caption) > * > * { border-color: var(--border-color); color: var(--primary-text); }
.table thead th {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}
.table-striped > tbody > tr:nth-of-type(odd) > * { background: #fff; color: var(--primary-text); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.75rem 0.6rem;
    text-align: center;
    transition: all 0.15s;
    border-top: 3px solid var(--primary-accent);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 55%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}
.stat-card:hover { transform: translateY(-1px); }
.stat-card .big-num {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1;
    color: var(--primary-accent);
    letter-spacing: -0.04em;
}
.stat-card .big-num.pending { color: var(--muted-text); }
.stat-card p {
    font-family: var(--font-sans);
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin: 0.2rem 0 0.3rem;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb { background: transparent; padding: 0; margin-bottom: 0.5rem; font-size: 0.9rem; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted-text); }
.breadcrumb-item a { color: var(--muted-text); transition: color 0.15s; }
.breadcrumb-item a:hover { color: var(--primary-accent); }
.breadcrumb-item.active { color: var(--muted-text); }

/* ============================================================
   BADGES
   ============================================================ */
.badge { border-radius: 0; font-family: var(--font-sans); letter-spacing: 0.04em; font-size: 0.78rem; font-weight: 700; }
.badge.bg-success { background: #22c55e !important; color: #fff !important; }
.badge.bg-secondary { background: #fff !important; color: var(--muted-text) !important; border: 1px solid var(--border-color); }

/* ============================================================
   IMPORT RESULTS
   ============================================================ */
.import-result-list { list-style: none; padding: 0; margin: 0.3rem 0; font-size: 0.9rem; max-height: 160px; overflow-y: auto; }
.import-result-list li { padding: 0.2rem 0; border-bottom: 1px solid var(--border); color: var(--text-mid); }
.import-result-list li:last-child { border-bottom: none; }

.diff-changed { background: rgba(19, 81, 170, 0.08) !important; border-left: 3px solid var(--primary-accent) !important; }

/* ============================================================
   COURSE DETAILS PAGE
   ============================================================ */
.course-detail-card {
    background: #fff;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.course-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.course-detail-logo { flex-shrink: 0; }
.course-detail-logo img { width: 64px; height: 64px; object-fit: contain; display: block; }

.course-detail-title h2 {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-text);
}
.course-detail-year {
    font-size: 0.85rem;
    color: var(--muted-text);
    margin-top: 0.2rem;
    font-weight: 500;
}
.course-detail-stats {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.stat-group {
    text-align: center;
    flex: 1;
    min-width: 70px;
    padding: 0.15rem 0;
}
.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--secondary-text);
    margin-bottom: 0.3rem;
    display: block;
}
.stat-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-accent);
    line-height: 1;
    margin: 0;
    padding: 0;
}
.stat-group:nth-child(1) .stat-value { color: #dc2626; }
.stat-group:nth-child(2) .stat-value { color: var(--primary-accent); }
.stat-group:nth-child(3) .stat-value { color: #22c55e; }
.stat-group:nth-child(4) .stat-value { color: var(--primary-accent); }

/* Detail page — back link bar */
.detail-top-bar {
    padding: 0.35rem 0;
    margin-bottom: 0.4rem;
}
.back-link {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-accent);
    transition: color 0.15s;
}
.back-link:hover { color: var(--primary-text); }

/* Detail page — voting section */
.course-detail-vote {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--year-band-b);
}
.detail-vote-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.detail-vote-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text);
}
.detail-vote-btns {
    display: flex;
    gap: 4px;
}
.detail-vote-counts {
    font-size: 0.78rem;
    color: var(--muted-text);
    margin-top: 0.3rem;
}

.course-detail-notes {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}
.course-detail-actions {
    padding: 0.75rem 1rem;
    background: var(--year-band-b);
}

.course-history-section {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 1rem;
}
.course-history-section h3 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-accent);
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.history-list { display: flex; flex-direction: column; gap: 1rem; }
.history-item { border-left: 3px solid var(--primary-accent); padding-left: 0.75rem; }
.history-meta {
    display: flex;
    gap: 0.4rem;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}
.history-date { font-weight: 600; color: var(--primary-text); }
.history-by   { color: var(--secondary-text); }
.history-source { color: var(--muted-text); font-style: italic; }
.history-changes { display: flex; flex-direction: column; gap: 0.3rem; }
.change-pair {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}
.change-label { font-weight: 600; min-width: 40px; color: var(--secondary-text); }
.change-old   { color: var(--muted-text); text-decoration: line-through; }
.change-arrow { color: var(--primary-accent); font-weight: 700; }
.change-new   { font-weight: 600; color: var(--primary-accent); }

@media (max-width: 575px) {
    .course-detail-header {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.5rem;
    }
    .course-detail-title h2 { font-size: 1.1rem; }
    .course-detail-stats { padding: 0.6rem; gap: 0.3rem; }
    .stat-group { min-width: 60px; }
    .stat-value { font-size: 1.3rem; }
    .change-pair { flex-wrap: wrap; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--primary-bg); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-text); }
