/* ==========================================================================
   Directorate of Labour — Government of Khyber Pakhtunkhwa
   Main Stylesheet  v3
   ========================================================================== */

/* ── Variables ── */
:root {
    --sidebar-w: 240px;
    --topbar-h: 26px;
    --inner-h: 56px;

    --navy:        #1a2332;
    --navy-dk:     #0f1722;
    --navy-lt:     #243447;
    --navy-border: rgba(255,255,255,0.08);
    --accent:      #2c5aa0;
    --accent-hov:  #1e4880;
    --green:       #166534;
    --success:     #16a34a;
    --red:         #991b1b;
    --amber:       #92400e;
    --blue:        #1e40af;
    --purple:      #5b21b6;

    --bg:      #f1f4f8;
    --surface: #ffffff;
    --border:  #dde3ea;
    --text:    #1a2332;
    --muted:   #64748b;
    --xs:      #94a3b8;

    --shadow:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --r:    6px;
    --r-lg: 10px;

    /* backward-compat variable aliases */
    --primary:      var(--navy);
    --gray-100:     var(--bg);
    --gray-200:     #e2e8f0;
    --gray-400:     var(--xs);
    --gray-500:     var(--muted);
    --white:        var(--surface);
    --text-primary: var(--text);
    --radius:       var(--r);
    --shadow-sm:    var(--shadow);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}
a { text-decoration: none; color: var(--accent); }
a:hover { color: var(--accent-hov); }
img { max-width: 100%; }

/* ── Helpers ── */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-muted   { color: var(--muted) !important; }
.text-xs      { font-size: 0.75rem; }
.text-sm      { font-size: 0.84rem; }
.text-danger  { color: #dc2626 !important; }
.text-success { color: #16a34a !important; }
.text-accent  { color: var(--accent) !important; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */

/* Government top strip */
.govt-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--topbar-h);
    background: #060d16;
    color: rgba(255,255,255,0.5);
    font-size: 0.595rem;
    font-weight: 600;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

/* App shell (authenticated wrapper) */
.app-shell {
    display: flex;
    padding-top: var(--topbar-h);
    min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    width: var(--sidebar-w);
    height: calc(100vh - var(--topbar-h));
    background: var(--navy);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    scrollbar-width: none;
    transition: transform 0.25s ease;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem;
    border-bottom: 1px solid var(--navy-border);
    flex-shrink: 0;
}
.sidebar-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.sidebar-brand-name { color: #fff; font-size: 0.8rem; font-weight: 700; line-height: 1.25; }
.sidebar-brand-sub  { color: rgba(255,255,255,0.38); font-size: 0.6rem; font-weight: 500;
                      text-transform: uppercase; letter-spacing: 0.5px; }

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 0.6rem 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
    padding: 0.65rem 1rem 0.2rem;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.28);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.54rem 1rem;
    color: rgba(255,255,255,0.62);
    font-size: 0.81rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.14s;
    text-decoration: none;
}
.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}
.nav-link.active {
    color: #fff;
    background: rgba(44,90,160,0.35);
    border-left-color: #4f85d0;
    font-weight: 600;
}
.nav-link i {
    width: 15px;
    font-size: 0.75rem;
    text-align: center;
    opacity: 0.7;
    flex-shrink: 0;
}
.nav-link.active i { opacity: 1; }

/* Sub-links (indented under a group) */
.nav-sub .nav-link {
    padding-left: 2.4rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
}
.nav-sub .nav-link.active { color: #fff; }
.nav-sub .nav-link:hover  { color: rgba(255,255,255,0.88); }

/* Nav group header (non-clickable label with icon) */
.nav-group-hd {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.54rem 1rem 0.2rem;
    color: rgba(255,255,255,0.38);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.nav-group-hd i { width: 15px; font-size: 0.72rem; text-align: center; flex-shrink: 0; }

/* Footer */
.sidebar-footer {
    border-top: 1px solid var(--navy-border);
    padding: 0.4rem 0;
    flex-shrink: 0;
}
.nav-link.nav-danger       { color: rgba(248,113,113,0.7); }
.nav-link.nav-danger:hover { color: #f87171; background: rgba(220,38,38,0.1); }

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}
.sidebar-overlay.visible { display: block; }

/* ==========================================================================
   MAIN AREA
   ========================================================================== */
.main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-h));
    min-width: 0;
}

/* Inner topbar */
.inner-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--inner-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}
.topbar-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.05rem;
    padding: 0.3rem;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--r);
    transition: background 0.15s;
}
.topbar-hamburger:hover { background: var(--bg); }
.topbar-search {
    flex: 1;
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.38rem 0.875rem;
}
.topbar-search i { color: var(--xs); font-size: 0.78rem; }
.topbar-search input {
    border: none;
    background: transparent;
    font-size: 0.84rem;
    color: var(--text);
    width: 100%;
    outline: none;
}
.topbar-search input::placeholder { color: var(--xs); }
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.topbar-icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.82rem;
    transition: background 0.14s;
}
.topbar-icon-btn:hover { background: var(--bg); }
.topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.user-meta-name { font-size: 0.81rem; font-weight: 600; color: var(--text); }
.user-meta-role { font-size: 0.67rem; color: var(--muted); }

/* Flash messages */
.flash-bar .alert {
    border-radius: 0;
    border: none;
    border-left: 4px solid;
    margin-bottom: 0;
}
.flash-bar .alert-success { border-left-color: #16a34a; }
.flash-bar .alert-danger  { border-left-color: #dc2626; }
.flash-bar .alert-warning { border-left-color: #d97706; }
.flash-bar .alert-info    { border-left-color: #2563eb; }

/* Page body */
.page-body {
    flex: 1;
    padding: 2rem;
    overflow-x: hidden;
}
.page-body.no-pad { padding: 0; }

/* App footer */
.app-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.74rem;
    color: var(--muted);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 1.2rem; }

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.page-title    { font-size: 1.35rem; font-weight: 700; color: var(--navy); margin: 0; }
.page-subtitle { font-size: 0.82rem; color: var(--muted); margin: 0.25rem 0 0; }
.page-actions  { display: flex; gap: 0.5rem; flex-shrink: 0; align-items: center; }

/* ==========================================================================
   STAT CARDS
   ========================================================================== */
.stat-card {
    background: var(--surface);
    border-radius: var(--r);
    padding: 1.375rem 1.5rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    position: relative;
    height: 100%;
}
.stat-card .stat-icon {
    position: absolute;
    top: 1.125rem; right: 1.125rem;
    width: 32px; height: 32px;
    border-radius: 7px;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.84rem;
    color: var(--muted);
}
.stat-card .stat-number {
    font-size: 1.9rem; font-weight: 700;
    color: var(--text); line-height: 1.1; margin-bottom: 0.3rem;
}
.stat-card .stat-label {
    font-size: 0.71rem; color: var(--muted);
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px;
}
/* Variants */
.stat-primary { border-left-color: var(--navy); }
.stat-primary .stat-icon { background: rgba(26,35,50,0.07); color: var(--navy); }
.stat-accent  { border-left-color: var(--accent); }
.stat-accent  .stat-icon { background: rgba(44,90,160,0.1);  color: var(--accent); }
.stat-success { border-left-color: #16a34a; }
.stat-success .stat-icon { background: rgba(22,163,74,0.1);   color: #16a34a; }
.stat-danger  { border-left-color: #dc2626; }
.stat-danger  .stat-icon { background: rgba(220,38,38,0.1);   color: #dc2626; }
.stat-warning { border-left-color: #d97706; }
.stat-warning .stat-icon { background: rgba(217,119,6,0.1);   color: #d97706; }
.stat-info    { border-left-color: #2563eb; }
.stat-info    .stat-icon { background: rgba(37,99,235,0.1);    color: #2563eb; }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    background: var(--surface);
}
.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}
.card-title-icon {
    width: 26px; height: 26px;
    background: rgba(44,90,160,0.09);
    border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 0.74rem; flex-shrink: 0;
}
.card-body { padding: 1.5rem; }

/* Chart card */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem 1.75rem;
    height: 100%;
    box-shadow: var(--shadow);
}
.chart-card-title { font-size: 0.9rem; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.chart-card-sub   { font-size: 0.75rem; color: var(--muted); margin-bottom: 1.25rem; }
.chart-wrap       { position: relative; height: 200px; }

/* Inspector chips */
.inspector-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem; font-weight: 500; color: var(--text);
}
.inspector-chip i { color: var(--accent); font-size: 0.7rem; }

/* ==========================================================================
   TABLES
   ========================================================================== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 0.875rem 1.25rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 0.925rem 1.25rem;
    font-size: 0.845rem;
    border-bottom: 1px solid #eef0f4;
    vertical-align: middle;
    color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f7f9fc; }

/* ==========================================================================
   BADGES
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 0.22rem 0.65rem;
    border-radius: 3px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.25px;
    text-transform: uppercase;
}
.badge-draft               { background: #f1f5f9; color: #475569; }
.badge-submitted           { background: #fef3c7; color: #92400e; }
.badge-under_review        { background: #dbeafe; color: #1e40af; }
.badge-inspection_pending  { background: #ede9fe; color: #5b21b6; }
.badge-inspection_completed{ background: #d1fae5; color: #065f46; }
.badge-approved            { background: #d1fae5; color: #065f46; }
.badge-rejected            { background: #fee2e2; color: #991b1b; }
.badge-reverted            { background: #fef3c7; color: #92400e; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0.44rem 1rem;
    border-radius: var(--r);
    font-size: 0.84rem; font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer; text-decoration: none;
    transition: all 0.14s; line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.77rem; }
.btn-primary     { background: var(--navy);   color: #fff; border-color: var(--navy);    }
.btn-primary:hover { background: var(--navy-dk); color: #fff; }
.btn-accent      { background: var(--accent); color: #fff; border-color: var(--accent);  }
.btn-accent:hover  { background: var(--accent-hov); color: #fff; }
.btn-success     { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger      { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover  { background: #b91c1c; color: #fff; }
.btn-warning     { background: #d97706; color: #fff; border-color: #d97706; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-outline     { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--text); }
.btn-outline-accent { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline-accent:hover { background: rgba(44,90,160,0.07); }
.btn-outline-secondary { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-outline-secondary:hover { background: var(--bg); color: var(--text); }

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.form-label {
    font-size: 0.82rem; font-weight: 600;
    color: var(--text); margin-bottom: 0.45rem; display: block;
}
.form-control, .form-select {
    width: 100%;
    padding: 0.575rem 0.875rem;
    font-size: 0.875rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); outline: none;
    font-family: inherit; transition: border-color 0.15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(44,90,160,0.12);
}
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 12px;
    padding-right: 2.25rem;
}

/* ==========================================================================
   STATUS PILLS (applicant dashboard)
   ========================================================================== */
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 0.71rem; font-weight: 600; }
.status-draft               { background: #f1f5f9; color: #475569; }
.status-submitted           { background: #fef3c7; color: #92400e; }
.status-under_review        { background: #dbeafe; color: #1e40af; }
.status-inspection_pending  { background: #ede9fe; color: #5b21b6; }
.status-inspection_completed{ background: #d1fae5; color: #065f46; }
.status-approved            { background: #d1fae5; color: #065f46; }
.status-rejected            { background: #fee2e2; color: #991b1b; }
.status-reverted            { background: #fef3c7; color: #92400e; }

/* ==========================================================================
   APPLICANT SUB-LAYOUT
   ========================================================================== */
.appl-layout { display: flex; flex: 1; overflow: hidden; }
.appl-sidebar {
    width: 280px; flex-shrink: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.appl-sidebar-header { padding: 1.25rem 1.125rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.appl-sidebar-header h6 {
    font-size: 0.63rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem;
}
.appl-new-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 0.52rem 1rem; background: var(--navy); color: #fff;
    border-radius: var(--r); font-size: 0.8rem; font-weight: 600; text-decoration: none;
}
.appl-new-btn:hover { background: var(--navy-dk); color: #fff; }
.appl-apps { padding: 0.5rem 0; flex: 1; overflow-y: auto; }
.appl-app-item {
    display: block; padding: 0.875rem 1.125rem;
    border-left: 3px solid transparent;
    transition: all 0.14s; text-decoration: none; color: var(--text);
}
.appl-app-item:hover { background: var(--bg); color: var(--text); }
.appl-app-item.active { border-left-color: var(--accent); background: rgba(44,90,160,0.05); }
.appl-item-label { font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.appl-item-meta  { font-size: 0.71rem; color: var(--muted); }
.appl-content    { flex: 1; padding: 2rem; overflow-y: auto; min-width: 0; }

/* Applicant detail */
.detail-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--border); padding: 1.5rem; margin-bottom: 1.25rem; }
.detail-card .section-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 1rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--border); }
.comment-card { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; padding: 1.25rem 1.5rem; margin-bottom: 0.875rem; box-shadow: var(--shadow); }
.comment-card.revert_reason    { border-left-color: #dc2626; background: #fff8f8; }
.comment-card.rejection_reason { border-left-color: #dc2626; background: #fff8f8; }
.comment-card.approval_note    { border-left-color: #16a34a; background: #f0fdf4; }
.comment-author { font-size: 0.8rem; font-weight: 700; }
.comment-role   { font-size: 0.72rem; color: var(--muted); margin-left: 6px; }
.comment-date   { font-size: 0.71rem; color: var(--xs); }
.comment-text   { font-size: 0.875rem; margin-top: 0.4rem; line-height: 1.5; }
.cert-cta { background: linear-gradient(135deg, #166534 0%, #16a34a 100%); border-radius: var(--r-lg); padding: 1.75rem 2rem; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.cert-cta h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.25rem; }
.cert-cta p  { font-size: 0.83rem; opacity: 0.85; margin: 0; }
.reverted-alert { background: #fffbeb; border: 1.5px solid #fbbf24; border-radius: var(--r-lg); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.reverted-alert h5 { font-size: 0.9rem; font-weight: 700; color: #92400e; margin-bottom: 0.2rem; }
.reverted-alert p  { font-size: 0.82rem; color: #92400e; margin: 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; }
.empty-state .es-icon { font-size: 2.5rem; opacity: 0.2; margin-bottom: 1rem; }

/* ==========================================================================
   REPORTS
   ========================================================================== */
.report-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.75rem;
    text-align: center;
    height: 100%;
    box-shadow: var(--shadow);
}
.report-kpi-value { font-size: 2.2rem; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 0.35rem; }
.report-kpi-label { font-size: 0.71rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.report-kpi-sub   { font-size: 0.72rem; color: var(--muted); margin-top: 0.25rem; }

/* ==========================================================================
   AUTH
   ========================================================================== */
.auth-shell,
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1722 0%, #1a2a40 50%, #0f1722 100%);
    padding: 2rem 1.5rem;
}
.auth-card {
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
}
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy);
    margin: 0 0 0.3rem;
}
.auth-header p {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0;
}
.auth-logo {
    width: 56px; height: 56px;
    background: var(--navy);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff;
    margin: 0 auto 1rem;
}
.auth-dept  { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 0.25rem; }
.auth-title { font-size: 1.3rem; font-weight: 800; color: var(--navy); text-align: center; margin-bottom: 0.3rem; }
.auth-sub   { font-size: 0.81rem; color: var(--muted); text-align: center; margin-bottom: 2rem; }
.auth-alert { background: #fee2e2; border: 1px solid #fca5a5; border-radius: var(--r); padding: 0.65rem 0.9rem; font-size: 0.82rem; color: #991b1b; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 8px; }

/* ==========================================================================
   MULTI-STEP FORMS / ESTABLISHMENT APPLICATION
   ========================================================================== */
.page-container {
    padding: 2.5rem 1.5rem 4rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}
.page-container .page-header h1 { font-size: 1.3rem; font-weight: 800; color: var(--navy); margin: 0; }
.page-container .page-header > p  { font-size: 0.82rem; color: var(--muted); margin: 0.2rem 0 0; }

/* ── Horizontal stepper ── */
.stepper {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 0;
}
.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    min-width: 56px;
}
.stepper-circle {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}
.stepper-label {
    font-size: 0.68rem; font-weight: 600;
    color: var(--muted); white-space: nowrap; text-align: center;
}
.stepper-step.active .stepper-circle { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper-step.active .stepper-label  { color: var(--accent); font-weight: 700; }
.stepper-step.done   .stepper-circle { background: #16a34a; border-color: #16a34a; color: #fff; }
.stepper-step.done   .stepper-label  { color: #16a34a; }
.stepper-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 20px;
    align-self: flex-start;
    margin-top: 14px; /* (30px circle / 2 - 1px border) */
    flex-shrink: 0;
}
.stepper-line.done { background: #16a34a; }

/* declaration box */
.declaration-box {
    background: #f8f9fc; border: 1px solid var(--border);
    border-radius: var(--r); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
}
.declaration-box h6 {
    font-size: 0.82rem; font-weight: 700; color: var(--navy);
    margin-bottom: 0.5rem; display: flex; align-items: center; gap: 6px;
}
.declaration-box p { font-size: 0.78rem; color: var(--muted); margin: 0; line-height: 1.6; }

/* form nav buttons */
.btn-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 2.5rem; flex-wrap: wrap; }
.right-btns { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; }
.btn-save { background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: var(--r); padding: 0.44rem 1rem; font-size: 0.84rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.14s; }
.btn-save:hover { background: var(--border); color: var(--text); }

.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.category-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--r-lg); padding: 1.5rem; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; transition: all 0.2s; text-decoration: none; color: var(--text); }
.category-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(44,90,160,0.15); color: var(--text); }
.category-card.selected { border-color: var(--accent); background: rgba(44,90,160,0.04); }
.category-card .cat-icon { width: 52px; height: 52px; background: rgba(44,90,160,0.09); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--accent); margin-bottom: 0.75rem; }
.form-section-title { font-size: 0.69rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 1rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--border); }

/* document grid (step 6 review) */
.document-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.document-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.doc-preview { height: 90px; display: flex; align-items: center; justify-content: center; }
.doc-info { padding: 0.75rem; }
.doc-info h6 { font-size: 0.78rem; font-weight: 700; color: var(--navy); margin-bottom: 0; }

/* alert variants */
.alert-info-custom { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--r); padding: 0.85rem 1rem; font-size: 0.82rem; color: #1e3a5f; margin-bottom: 0; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.visible { display: block; }
    .topbar-hamburger { display: flex; }
    .main-area { margin-left: 0; }
}

@media (max-width: 768px) {
    .page-body { padding: 1.25rem; }
    .appl-layout  { flex-direction: column; }
    .appl-sidebar { width: 100%; }
    .appl-content { padding: 1.25rem; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .btn-row { flex-direction: column; }
    .stat-card .stat-icon { display: none; }
    .stat-card { padding: 1.125rem 1.25rem; }
    .inner-topbar { padding: 0 1.25rem; }
    .app-footer { padding: 0.875rem 1.25rem; }
    .page-container { padding: 1.5rem 1rem 3rem; }
    .card-header { padding: 0.875rem 1.25rem; }
    .card-body { padding: 1.25rem; }
    .section-card .card-body, .section-card > div:not(.section-title) { padding: 1.25rem; }
    .section-title { padding: 0.875rem 1.25rem; }
    .page-header { margin-bottom: 1.5rem; }
}

/* ==========================================================================
   BACKWARD-COMPAT ALIASES (for older templates not yet migrated)
   ========================================================================== */
.btn-outline-custom   { background: transparent; color: var(--navy); border: 1px solid var(--border); border-radius: var(--r); padding: 0.44rem 1rem; font-size: 0.84rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; transition: background 0.14s; }
.btn-outline-custom:hover { background: var(--bg); color: var(--navy); text-decoration: none; }
.btn-outline-custom.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.77rem; }

.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 1.5rem; overflow: hidden; }
.section-card .card-body, .section-card > div:not(.section-title) { padding: 1.5rem; }

.section-title { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 700; color: var(--navy); padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--border); }
.section-title .icon { width: 26px; height: 26px; background: rgba(44,90,160,0.09); border-radius: 5px; display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 0.74rem; flex-shrink: 0; }

.table-custom { width: 100%; border-collapse: collapse; }
.table-custom thead th { background: var(--bg); font-weight: 600; font-size: 0.69rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 0.875rem 1.25rem; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table-custom tbody td { padding: 0.925rem 1.25rem; font-size: 0.845rem; border-bottom: 1px solid #eef0f4; vertical-align: middle; color: var(--text); }
.table-custom tbody tr:last-child td { border-bottom: none; }
.table-custom tbody tr:hover { background: #f7f9fc; }

.badge-status { display: inline-block; padding: 0.22rem 0.65rem; border-radius: 3px; font-size: 0.67rem; font-weight: 700; letter-spacing: 0.25px; text-transform: uppercase; }

.dash-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.dash-title   { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin: 0; }
.dash-subtitle{ font-size: 0.8rem; color: var(--muted); margin: 0.15rem 0 0; }
.dash-meta    { text-align: right; flex-shrink: 0; }
.dash-meta-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.dash-meta-value { font-size: 0.82rem; color: var(--text); font-weight: 500; }

.stat-card.primary { border-left-color: var(--navy); }
.stat-card.primary .stat-icon { background: rgba(26,35,50,0.07); color: var(--navy); }
.stat-card.accent  { border-left-color: var(--accent); }
.stat-card.accent  .stat-icon { background: rgba(44,90,160,0.1); color: var(--accent); }
.stat-card.success { border-left-color: #16a34a; }
.stat-card.success .stat-icon { background: rgba(22,163,74,0.1); color: #16a34a; }
.stat-card.danger  { border-left-color: #dc2626; }
.stat-card.danger  .stat-icon { background: rgba(220,38,38,0.1); color: #dc2626; }
.stat-card.warning { border-left-color: #d97706; }
.stat-card.warning .stat-icon { background: rgba(217,119,6,0.1); color: #d97706; }
.stat-card.info    { border-left-color: #2563eb; }
.stat-card.info    .stat-icon { background: rgba(37,99,235,0.1); color: #2563eb; }

/* ---------- additional backward-compat ---------- */
.badge-under-review { background: #dbeafe; color: #1e40af; }

.btn-primary-custom  { background: var(--navy);   color: #fff; border: 1px solid var(--navy);   border-radius: var(--r); padding: 0.44rem 1rem; font-size: 0.84rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; transition: all 0.14s; line-height:1.4; }
.btn-primary-custom:hover  { background: var(--navy-dk); color: #fff; text-decoration: none; }
.btn-success-custom  { background: #16a34a; color: #fff; border: 1px solid #16a34a; border-radius: var(--r); padding: 0.44rem 1rem; font-size: 0.84rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; transition: all 0.14s; line-height:1.4; }
.btn-success-custom:hover  { background: #15803d; color: #fff; text-decoration: none; }
.btn-outline-primary { background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: var(--r); padding: 0.3rem 0.65rem; font-size: 0.77rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; transition: all 0.14s; }
.btn-outline-primary:hover { background: rgba(44,90,160,0.07); color: var(--accent); text-decoration: none; }

.review-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 0.75rem 1.5rem; border-bottom: 1px solid #eef0f4; gap: 1rem; }
.review-item:last-child { border-bottom: none; }
.review-item .label { font-size: 0.77rem; font-weight: 600; color: var(--muted); min-width: 120px; flex-shrink: 0; }
.review-item .value { font-size: 0.83rem; color: var(--text); font-weight: 500; }

.radio-card { display: flex; align-items: center; gap: 1rem; padding: 0.85rem 1rem; border: 2px solid var(--border); border-radius: var(--r); cursor: pointer; transition: all 0.15s; background: var(--surface); }
.radio-card:hover { border-color: var(--accent); background: rgba(44,90,160,0.04); }
.radio-card.selected { border-color: var(--accent); background: rgba(44,90,160,0.08); }
.radio-card .radio-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.radio-card input[type="radio"] { display: none; }

.info-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.info-item { flex: 1; min-width: 130px; }
.info-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 3px; }
.info-value { font-size: 0.88rem; font-weight: 600; color: var(--text); }

/* ==========================================================================
   REGISTRATION FORM — MISSING COMPONENT STYLES
   ========================================================================== */

/* Alert colour variants (only alert-info-custom existed before) */
.alert-warning-custom {
    background: #fffbeb; border: 1px solid #fde68a;
    border-radius: var(--r); padding: 0.875rem 1rem;
    font-size: 0.82rem; color: #78350f;
    display: flex; align-items: flex-start; gap: 0.625rem;
}
.alert-danger-custom {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: var(--r); padding: 0.875rem 1rem;
    font-size: 0.82rem; color: #7f1d1d;
    display: flex; align-items: flex-start; gap: 0.625rem;
}

/* section-card: form direct children get the same padding as div children */
.section-card > form { padding: 1.5rem; }

/* section-card: tables go edge-to-edge (th/td have their own cell padding) */
.section-card > .table-responsive { padding: 0; }

/* Workers / Machinery stat strip above list pages */
.worker-stats { display: flex; gap: 0.875rem; flex-wrap: wrap; }
.worker-stat-item {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r); padding: 0.875rem 1.5rem;
    flex: 1; min-width: 90px; text-align: center;
    box-shadow: var(--shadow);
}
.worker-stat-item .number {
    font-size: 1.6rem; font-weight: 700; line-height: 1.1; margin-bottom: 0.2rem;
}
.worker-stat-item .label {
    font-size: 0.69rem; color: var(--muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
}

/* Inline add-row button (appears inside form cards) */
.btn-add-row {
    background: var(--accent); color: #fff;
    border: 1px solid var(--accent); border-radius: var(--r);
    padding: 0.44rem 1.125rem; font-size: 0.84rem; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer; text-decoration: none; transition: all 0.14s;
    white-space: nowrap; line-height: 1.4;
}
.btn-add-row:hover { background: #1e4080; border-color: #1e4080; color: #fff; }

/* Drag-and-drop upload zone (brick kiln site plan, factory step 3) */
.upload-area {
    border: 2px dashed var(--border); border-radius: var(--r-lg);
    padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--bg); margin-bottom: 0.75rem;
}
.upload-area:hover { border-color: var(--accent); background: rgba(44,90,160,0.025); }
.upload-area .upload-icon { font-size: 2rem; color: var(--muted); margin-bottom: 0.5rem; }
.upload-area p { margin: 0.25rem 0; font-size: 0.84rem; color: var(--text); }
.upload-area .browse-link { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Compliance checklist (brick kiln step 2) */
.compliance-list { list-style: none; padding: 0; margin: 0; }
.compliance-list li {
    display: flex; align-items: center;
    padding: 0.575rem 0; border-bottom: 1px solid var(--border);
    font-size: 0.84rem; color: var(--text); gap: 0.625rem;
}
.compliance-list li:last-child { border-bottom: none; }
.compliance-list .check-icon { color: var(--muted); }

/* Site plan / map sample-template placeholder */
.map-placeholder {
    background: #f8f9fc; border: 1px dashed var(--border);
    border-radius: var(--r-lg); min-height: 160px;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); padding: 2rem; text-align: center;
}

/* Signature pad area (brick kiln step 1) */
.signature-area {
    border: 2px dashed var(--border); border-radius: var(--r);
    padding: 1.5rem; text-align: center; background: #fafafa;
    min-height: 90px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 0.3rem;
}

/* Mobile: stack worker stats */
@media (max-width: 576px) {
    .worker-stats { gap: 0.5rem; }
    .worker-stat-item { padding: 0.625rem 0.875rem; }
    .worker-stat-item .number { font-size: 1.3rem; }
}
