/* ===== ROOT VARIABLES ===== */
:root {
    --gold:          #D9BD7D;
    --gold-dark:     #C4A35A;
    --gold-deeper:   #A8833A;
    --gold-pale:     #F5ECD6;
    --gold-light:    #FAF5E8;

    --dark-bg:       #1C1A14;
    --dark-sidebar:  #231F16;
    --dark-mid:      #2E2A1E;

    --body-bg:       #F8F6F0;
    --card-border:   #EDE8DC;
    --card-shadow:   0 2px 12px rgba(0, 0, 0, 0.07);

    --text-dark:     #1C1A14;
    --text-mid:      #5C5035;
    --text-light:    #9E8E6A;
    --text-muted:    #BFB49A;

    --navbar-height: 60px;
    --sidebar-width: 260px;
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }

body {
    background-color: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.925rem;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
}

/* ===== NAVBAR ===== */
.qc-navbar {
    background: var(--dark-bg);
    border-bottom: 2px solid var(--gold-dark);
    height: var(--navbar-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
}

.qc-navbar .brand {
    display: flex;
    align-items: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.03em;
}

.qc-navbar .brand i {
    color: var(--gold);
    margin-right: 0.5rem;
    font-size: 1.3rem;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-right: 0.75rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.sidebar-toggle-btn:hover {
    color: var(--gold);
    background: rgba(217, 189, 125, 0.12);
}

.user-info-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
}

/* Role badges — light background (page content) */
.role-badge {
    font-size: 0.7rem;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-block;
}

.role-badge.it_admin       { background: #FEF3C7; color: #92400E; }
.role-badge.qc_admin       { background: var(--gold-pale); color: var(--gold-deeper); }
.role-badge.management     { background: #E0E7FF; color: #3730A3; }
.role-badge.branch_manager { background: #DCFCE7; color: #166534; }

/* Navbar override — dark background */
.qc-navbar .role-badge.it_admin       { background: rgba(217,189,125,0.2); color: var(--gold); }
.qc-navbar .role-badge.qc_admin       { background: rgba(217,189,125,0.2); color: var(--gold); }
.qc-navbar .role-badge.management     { background: rgba(217,189,125,0.2); color: var(--gold); }
.qc-navbar .role-badge.branch_manager { background: rgba(217,189,125,0.2); color: var(--gold); }

/* ===== LAYOUT WRAPPER ===== */
#wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

/* ===== SIDEBAR ===== */
#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--dark-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    transition: width 0.25s ease, transform 0.25s ease;
    border-right: 1px solid var(--dark-mid);
    scrollbar-width: thin;
    scrollbar-color: rgba(217,189,125,0.15) transparent;
}

.sidebar-main {
    flex: 1;
}

.sidebar-bottom {
    margin-top: auto;
    padding-bottom: 0.5rem;
}

#sidebar-wrapper::-webkit-scrollbar { width: 4px; }
#sidebar-wrapper::-webkit-scrollbar-thumb { background: rgba(217,189,125,0.15); border-radius: 2px; }

#sidebar-wrapper .sidebar-heading {
    padding: 1.5rem 1.25rem 0.4rem;
    color: rgba(217, 189, 125, 0.35);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 700;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.72rem 1.25rem;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-item i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-item:hover {
    background: rgba(217, 189, 125, 0.08);
    color: var(--gold);
    text-decoration: none;
}

.sidebar-item.active {
    background: rgba(217, 189, 125, 0.12);
    border-left-color: var(--gold);
    color: var(--gold);
    font-weight: 600;
}

.sidebar-item-badge {
    margin-left: auto;
    min-width: 1.35rem;
    padding: 0.1rem 0.42rem;
    border-radius: 999px;
    background: var(--gold);
    color: var(--dark-bg);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.25;
    flex-shrink: 0;
    text-align: center;
}

.sidebar-item.active .sidebar-item-badge {
    background: var(--dark-bg);
    color: var(--gold);
}

.sidebar-divider {
    height: 1px;
    background: rgba(217, 189, 125, 0.1);
    margin: 0.5rem 1rem;
}

/* ===== CONTENT AREA ===== */
#page-content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    padding: 1.75rem 1.75rem 0;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
    background: var(--body-bg);
}

/* ===== SIDEBAR HIDDEN STATE ===== */
#wrapper.sidebar-hidden #sidebar-wrapper {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
#wrapper.sidebar-hidden #page-content-wrapper {
    margin-left: 0;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gold-pale);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.page-header .subtitle {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

/* ===== CARDS ===== */
.qc-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.qc-card .card-header-bar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.qc-card .card-header-bar h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

.qc-card .card-body-pad {
    padding: 1.25rem;
}

/* Branch dashboard — today snapshot cards (header + body breathing room) */
.qc-card.branch-snapshot-card .card-header-bar {
    padding: 1.15rem 1.45rem;
}
.qc-card.branch-snapshot-card .branch-snapshot-card__body {
    padding: 1.35rem 1.45rem 1.5rem;
}

/* ===== KPI STAT CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--gold);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* keep semantic left-border colors for data cards */
.stat-card.blue   { border-left-color: #3B82F6; }
.stat-card.green  { border-left-color: #22C55E; }
.stat-card.yellow { border-left-color: var(--gold); }
.stat-card.red    { border-left-color: #EF4444; }
.stat-card.teal   { border-left-color: #14B8A6; }

.stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-light);
    margin-bottom: 0.4rem;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
}

.stat-card .stat-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.07;
    color: var(--text-dark);
}

/* Reports KPI period card: compact toggle row */
.kpi-period-card .kpi-period-toggle-wrap {
    margin: 0.2rem 0 0.1rem;
}
.kpi-period-card .kpi-period-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}
.kpi-period-card #kpiPeriodForm {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}
.kpi-period-card .kpi-period-toggle-row {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
}
.kpi-period-card .kpi-period-btn {
    border: 1px solid #dbe3ee;
    background: #f7fafc;
    color: #2d3748;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}
.kpi-period-card .kpi-period-btn.is-active {
    border-color: #3B82F6;
    background: #e8f1ff;
    color: #1f5fbf;
}
.kpi-period-card .kpi-custom-range-row {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
    align-items: center;
}
.kpi-period-card .kpi-custom-month-wrap,
.kpi-period-card .kpi-custom-date-range-wrap {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
}
.kpi-period-card .is-hidden {
    display: none !important;
}
.kpi-period-card .kpi-custom-date {
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    padding: 0.1rem 0.25rem;
    font-size: 0.66rem;
}
.kpi-period-card .kpi-custom-mode-select {
    border: 1px solid #dbe3ee;
    border-radius: 6px;
    padding: 0.1rem 0.25rem;
    font-size: 0.66rem;
    background: #fff;
    color: #2d3748;
}
.kpi-period-card .kpi-custom-apply-btn {
    border: 1px solid #3B82F6;
    background: #3B82F6;
    color: #fff;
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
    font-size: 0.66rem;
    font-weight: 600;
}
.kpi-period-card .stat-value {
    margin-top: 0.5rem;
}
.kpi-period-card .stat-sub {
    margin-top: 0.15rem;
    margin-bottom: 0;
}

/* Keep summary cards same visual height in reports */
.summary-stats-row > [class*='col-'] {
    display: flex;
}
.summary-stats-row .stat-card {
    width: 100%;
    min-height: 138px;
}

/* ===== BRANCH KPI CARD ===== */
.branch-kpi-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.branch-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.branch-kpi-card .kpi-header {
    background: var(--dark-bg);
    color: #fff;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 2px solid var(--gold-dark);
}

.branch-kpi-card .kpi-header h6 {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.branch-kpi-card .kpi-body {
    padding: 1rem 1.25rem;
}

.kpi-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--gold-light);
    font-size: 0.85rem;
}

.kpi-metric:last-child { border-bottom: none; }
.kpi-metric-label { color: var(--text-light); }
.kpi-metric-value { font-weight: 700; color: var(--text-dark); }

.score-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 800;
    border: 3px solid;
}

.score-circle.excellent { color: #16a34a; border-color: #22c55e; background: #f0fdf4; }
.score-circle.good      { color: var(--gold-deeper); border-color: var(--gold); background: var(--gold-light); }
.score-circle.warning   { color: #d97706; border-color: #f59e0b; background: #fffbeb; }
.score-circle.danger    { color: #dc2626; border-color: #ef4444; background: #fff5f4; }
.score-circle.pending   { color: #9ca3af; border-color: #d1d5db; background: #f9fafb; font-size: 0.7rem; }

/* ===== CHECKLIST FORM ===== */
.checklist-item-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.checklist-item-card:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217, 189, 125, 0.18);
}

.checklist-item-card .item-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--gold-pale);
    color: var(--gold-deeper);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.checklist-item-card .item-text {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
    flex: 1;
}

.checklist-item-card .answer-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-left: 2.1rem;
}

.answer-btn {
    flex: 1;
    max-width: 130px;
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
}

.answer-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.answer-btn:hover { border-color: var(--gold); background: var(--gold-light); color: var(--gold-deeper); }

.answer-btn.yes-btn.selected {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #15803d;
}

.answer-btn.no-btn.selected {
    border-color: #ef4444;
    background: #fff5f4;
    color: #dc2626;
}

.reason-container {
    display: none;
    padding-left: 2.1rem;
    margin-top: 0.6rem;
}

.reason-container textarea {
    width: 100%;
    border: 1.5px solid #fca5a5;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 70px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff5f4;
}

.reason-container textarea:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ===== SUBMISSION VIEW ===== */
.response-row {
    display: flex;
    align-items: flex-start;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--gold-light);
    gap: 0.75rem;
}

.response-row:last-child { border-bottom: none; }

.response-answer {
    flex-shrink: 0;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.response-answer.yes { background: #dcfce7; color: #15803d; }
.response-answer.no  { background: #fee2e2; color: #dc2626; }

/* ===== COMMENT THREAD ===== */
.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    position: relative;
}

.comment-bubble.mine {
    align-self: flex-end;
    background: var(--gold-pale);
    border: 1px solid var(--gold-dark);
    border-bottom-right-radius: 4px;
}

.comment-bubble.theirs {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--card-border);
    border-bottom-left-radius: 4px;
}

.comment-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comment-meta .author { font-weight: 700; color: var(--text-dark); }

/* ===== STATUS BADGES ===== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill.submitted     { background: #dcfce7; color: #15803d; }
.status-pill.pending       { background: var(--gold-pale); color: var(--gold-deeper); }
.status-pill.not-submitted { background: #fee2e2; color: #dc2626; }
.status-pill.scored        { background: var(--gold-pale); color: var(--gold-deeper); }

/* ===== PROGRESS BAR ===== */
.compliance-bar { height: 8px; border-radius: 4px; background: var(--gold-pale); overflow: hidden; }
.compliance-bar .bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.compliance-bar .bar-fill.high   { background: #22c55e; }
.compliance-bar .bar-fill.medium { background: var(--gold); }
.compliance-bar .bar-fill.low    { background: #ef4444; }

/* ===== TABLES ===== */
.qc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.qc-table thead tr {
    background: var(--gold-light);
    border-bottom: 2px solid var(--gold-pale);
}

.qc-table thead th {
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--text-mid);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.qc-table tbody tr {
    border-bottom: 1px solid var(--gold-light);
    transition: background 0.15s;
}

.qc-table tbody tr:last-child { border-bottom: none; }
.qc-table tbody tr:hover { background: var(--gold-light); }
.qc-table tbody td { padding: 0.75rem 1rem; color: var(--text-dark); vertical-align: middle; }
.qc-table tbody tr.clickable { cursor: pointer; }

/* ===== SCORE INPUT ===== */
.score-input-wrap {
    background: var(--gold-light);
    border: 1px solid var(--gold-pale);
    border-radius: 10px;
    padding: 1.25rem;
}

/* Range slider gold tint */
.form-range::-webkit-slider-thumb { background: var(--gold); }
.form-range::-webkit-slider-runnable-track { background: var(--gold-pale); }

/* ===== FILTER FORM ===== */
.filter-bar {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar .filter-group label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold-deeper);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.filter-bar .filter-group select,
.filter-bar .filter-group input {
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-dark);
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
    min-width: 160px;
}

.filter-bar .filter-group select:focus,
.filter-bar .filter-group input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217, 189, 125, 0.2);
}

/* Branch checkbox dropdown (Quality Metrics / reports filter) */
.branch-filter-dropdown {
    position: relative;
    min-width: 220px;
    max-width: 280px;
}

.branch-filter-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-dark);
    background: #fff;
    outline: none;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 2.45rem;
}

.branch-filter-dropdown-toggle:hover {
    border-color: #c9d0da;
}

.branch-filter-dropdown-toggle:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217, 189, 125, 0.2);
}

.branch-filter-dropdown-summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.branch-filter-chevron {
    flex-shrink: 0;
    font-size: 0.75rem;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.branch-filter-dropdown.is-open .branch-filter-chevron {
    transform: rotate(180deg);
}

.branch-filter-dropdown-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    background: #fff;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: min(320px, 55vh);
    overflow-y: auto;
    padding: 0.25rem 0;
}

.branch-filter-brand-option {
    display: block;
    padding: 0.45rem 0.75rem 0.35rem;
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold-deeper);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #f4f5f8;
    border-bottom: 1px solid #e8eaef;
}

.branch-filter-brand-option:not(:first-child) {
    margin-top: 0.2rem;
}

.branch-filter-brand-option span {
    min-width: 0;
    line-height: 1.25;
    display: block;
}

.branch-filter-option {
    display: grid;
    grid-template-columns: 1.125rem 1fr;
    column-gap: 0.55rem;
    align-items: center;
    padding: 0.4rem 0.75rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    transition: background 0.12s;
    line-height: 1.25;
}

.branch-filter-option:hover {
    background: rgba(217, 189, 125, 0.12);
}

.filter-bar .filter-group .branch-filter-option input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    max-width: 1.125rem;
    min-height: 1.125rem;
    max-height: 1.125rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    box-shadow: none;
    accent-color: var(--gold);
    cursor: pointer;
    align-self: center;
    justify-self: center;
    vertical-align: middle;
}

.branch-filter-option span {
    min-width: 0;
    line-height: 1.25;
    align-self: center;
}

/* Search input with icon */
.filter-search-wrap {
    position: relative;
}
.filter-search-wrap .filter-search-icon {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 0.8rem;
    pointer-events: none;
}
.filter-search-wrap input {
    padding-left: 1.85rem !important;
    min-width: 200px;
}

/* ===== BUTTONS ===== */
.btn-qc-primary {
    background: var(--gold);
    color: var(--dark-bg);
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.btn-qc-primary:hover {
    background: var(--gold-dark);
    color: var(--dark-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 189, 125, 0.35);
    text-decoration: none;
}

.btn-qc-primary:active { transform: translateY(0); }

/* Gold “add” control — matches checklist editor + template hub */
.btn-qc-add,
a.btn-qc-add {
    background: var(--gold);
    color: var(--dark-bg);
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    line-height: 1.25;
    transition: background 0.15s;
}

.btn-qc-add:hover,
a.btn-qc-add:hover {
    background: var(--gold-dark);
    color: var(--dark-bg);
    text-decoration: none;
}

.btn-qc-add:focus-visible,
a.btn-qc-add:focus-visible {
    outline: 2px solid var(--gold-deeper);
    outline-offset: 2px;
}

/* Inactive tab / secondary pill — matches card borders & gold accents */
.btn.btn-qc-tab,
a.btn.btn-qc-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    background: #fff;
    color: var(--text-mid);
    border: 1.5px solid #e6ddc8;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn.btn-qc-tab:hover,
a.btn.btn-qc-tab:hover {
    background: var(--gold-light);
    border-color: var(--gold);
    color: var(--text-dark);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.btn.btn-qc-tab:focus-visible,
a.btn.btn-qc-tab:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.btn-qc-success {
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.btn-qc-success:hover { background: #16a34a; color: #fff; text-decoration: none; }

/* ===== FORMS ===== */
.form-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.form-card .form-card-header {
    background: var(--dark-bg);
    border-bottom: 3px solid var(--gold);
    padding: 2rem;
    text-align: center;
    color: #fff;
}

.form-card .form-card-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem;
    color: #fff;
}

.form-card .form-card-header i {
    color: var(--gold);
}

.form-card .form-card-header p {
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
    font-size: 0.875rem;
}

.form-card .form-card-body {
    padding: 2rem;
}

.qc-input-group {
    margin-bottom: 1.1rem;
}

.qc-input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-mid);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.qc-input-group input,
.qc-input-group select,
.qc-input-group textarea {
    width: 100%;
    border: 1.5px solid var(--card-border);
    border-radius: 9px;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    color: var(--text-dark);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.qc-input-group input:focus,
.qc-input-group select:focus,
.qc-input-group textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217, 189, 125, 0.2);
}

.qc-input-group .input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Branch multi-select checklist in admin user forms */
.branch-checkbox-list {
    max-height: 220px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    background: #fff;
}
.branch-checkbox-list__brand {
    font-size: 0.74rem;
    font-weight: 700;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.branch-checkbox-list__brand:not(:first-child) {
    margin-top: 0.45rem;
}
.qc-input-group .branch-checkbox-list__option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.35rem;
    font-size: 0.86rem;
    font-weight: 500;
    color: #344054;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}
.qc-input-group input.branch-checkbox-list__checkbox {
    width: auto;
    min-width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    accent-color: #4e73df;
    box-shadow: none;
}

/* Password field + always-visible show/hide (replaces Edge focus-only native reveal) */
.qc-password-wrap {
    position: relative;
    width: 100%;
}

.qc-password-wrap input {
    padding-right: 2.75rem;
}

.qc-password-wrap input[type="password"]::-ms-reveal {
    display: none;
}

.qc-password-toggle {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-mid);
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.qc-password-toggle:hover {
    color: var(--text-dark);
    background: rgba(15, 23, 42, 0.06);
}

.qc-password-toggle:focus-visible {
    outline: 2px solid var(--gold-deeper);
    outline-offset: 2px;
}

.btn-submit-full {
    width: 100%;
    padding: 0.75rem;
    background: var(--gold);
    color: var(--dark-bg);
    border: none;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
}

.btn-submit-full:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(217, 189, 125, 0.4);
}

/* ===== AUTH PAGE ===== */
.auth-page {
    min-height: calc(100vh - 44px);
    background: var(--dark-bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(217,189,125,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(217,189,125,0.05) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ===== GLOBAL FOOTER ===== */
.app-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    padding: 0.9rem 1rem 1.1rem;
    margin-top: auto;
}

.app-footer-auth {
    color: rgba(255, 255, 255, 0.58);
    background: var(--dark-bg);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 0.75rem; display: block; color: var(--gold); }
.empty-state p { margin: 0; font-size: 0.9rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #sidebar-wrapper { transform: translateX(calc(-1 * var(--sidebar-width))); }
    #wrapper.sidebar-open #sidebar-wrapper { transform: translateX(0); }
    #page-content-wrapper { margin-left: 0; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .filter-bar { flex-direction: column; }
    .filter-bar .filter-group select,
    .filter-bar .filter-group input { min-width: 100%; }
}

/* ===== UTILITIES ===== */
.text-muted-sm { font-size: 0.8rem; color: var(--text-muted); }
.fw-700 { font-weight: 700; }

/* ===== BACK BUTTON ===== */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: #fff;
    border: 1.5px solid #e6ddc8;
    border-radius: 8px;
    padding: .42rem .95rem;
    font-size: .84rem;
    font-weight: 700;
    color: #2d3748;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    transition: border-color .15s, box-shadow .15s;
}
.btn-back:hover {
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    color: #2d3748;
    text-decoration: none;
}
.btn-back i { color: var(--gold); }

/* ===== TABLE FOOTER / PAGINATION (inventory system) ===== */
.qc-card .table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-top: 1px solid #f3f3f3;
    gap: 12px;
}
.table-footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.table-footer-left .entries-info {
    color: #6b7280;
    font-size: 13px;
}
.table-footer-right .pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pagination button,
.pagination a,
.pagination span {
    background: #fff;
    border: 1px solid #eef2f6;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: #374151;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    box-sizing: border-box;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}
.pagination .page-prev,
.pagination .page-next {
    width: 32px;
    min-width: 32px;
    padding: 0;
}
.pagination button img,
.pagination a img,
.pagination span img {
    width: 12px;
    height: 12px;
    display: block;
}
.pagination .page-prev i,
.pagination .page-next i,
.pagination .page-prev .bi,
.pagination .page-next .bi {
    font-size: 12px;
    line-height: 1;
}
.pagination .page-num.active,
.pagination span.page-num.active {
    border: 1.5px solid var(--gold);
    color: var(--gold-deeper);
    font-weight: 600;
}
.pagination .page-dots {
    padding: 0 6px;
    color: #9ca3af;
    border: none;
    background: transparent;
    min-height: auto;
}
.pagination a:hover {
    background: #f9fafb;
}
.pagination span[style*="opacity"] {
    cursor: not-allowed !important;
}

@media (max-width: 768px) {
    .qc-card .table-footer {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }
}
