/* Lynx CPSR — Enterprise Design System */
/* Inter is loaded via <link rel="stylesheet"> preconnect in base.html for optimal performance */

/* ============================================================
   BOOTSTRAP CSS VARIABLE OVERRIDES — must precede other tokens
   so Bootstrap's own components pick up the brand palette
   ============================================================ */
:root {
    --bs-primary:        #0FA8A8;
    --bs-primary-rgb:    15, 168, 168;
    --bs-link-color:     #0FA8A8;
    --bs-link-hover-color: #0A7A7A;
    --bs-focus-ring-color: rgba(15, 168, 168, 0.25);
}

/* ============================================================
   DESIGN TOKENS — Slate + Teal palette (2026 edition)
   ============================================================ */
:root {
    /* Brand — Navy/Teal (2026 brand refresh) */
    --brand-600:      #0FA8A8;
    --brand-700:      #0A7A7A;
    --brand-500:      #14B8B8;
    --brand-50:       rgba(15, 168, 168, 0.08);
    --brand-100:      rgba(15, 168, 168, 0.15);

    /* Sidebar — Deep Navy */
    --sidebar-bg:     #0B1E3D;
    --sidebar-hover:  #162A4A;
    --sidebar-active: #0FA8A8;
    --sidebar-border: rgba(255,255,255,0.06);
    --sidebar-text:   #9CA3AF;
    --sidebar-title:  #6B7280;

    /* Semantic */
    --success:        #10B981;
    --success-bg:     rgba(16,185,129,0.1);
    --warning:        #F59E0B;
    --warning-bg:     rgba(245,158,11,0.1);
    --danger:         #EF4444;
    --danger-bg:      rgba(239,68,68,0.1);
    --info:           #1A4A8A;
    --info-bg:        rgba(26,74,138,0.1);

    /* Surface */
    --bg:             #F8FAFC;
    --surface:        #FFFFFF;
    --surface-raised: #FFFFFF;
    --border:         #E2E8F0;
    --border-strong:  #CBD5E1;

    /* Text */
    --text-primary:   #111827;
    --text-secondary: #374151;
    --text-muted:     #9CA3AF;

    /* Shadow — slightly warmer than pure grey */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:  0 10px 20px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);

    /* Layout */
    --sidebar-width:           220px;
    --sidebar-collapsed-width: 60px;

    /* Radius */
    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 12px;

    /* Transition */
    --ease: all 0.18s ease;

    /* Aliases for older variable names (backward-compat) */
    --primary-blue:    #0FA8A8;
    --success-green:   #10B981;
    --warning-yellow:  #F59E0B;
    --info-blue:       #1A4A8A;
    --bg-secondary:    #F8FAFC;
    --bg-tertiary:     #F1F5F9;
    --bg-card:         #FFFFFF;
    --border-light:    #E2E8F0;
    --border-medium:   #CBD5E1;
    --transition-base: all 0.18s ease;
}

/* ============================================================
   GLOBAL RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

*:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-size: 0.9375rem;
}

/* Global link color — brand teal replaces Bootstrap default blue */
a { color: var(--brand-600); }
a:hover { color: var(--brand-700); }

/* Bootstrap brand overrides — keep Bootstrap primitives on-palette */
.text-primary    { color: var(--brand-600) !important; }
.link-primary    { color: var(--brand-600) !important; }
.link-primary:hover { color: var(--brand-700) !important; }

/* Spinner */
.spinner-border.text-primary,
.spinner-grow.text-primary   { color: var(--brand-600) !important; }

/* Pagination */
.page-link { color: var(--brand-600); }
.page-link:hover { color: var(--brand-700); background: var(--bg); }
.page-item.active .page-link {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: white;
}
.page-item.disabled .page-link { color: var(--text-muted); }

/* Nav tabs — active state uses brand teal */
.nav-tabs .nav-link.active {
    color: var(--brand-600) !important;
    border-bottom-color: var(--brand-600) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    background: transparent !important;
    font-weight: 600 !important;
}
.nav-tabs .nav-link:not(.active) { color: var(--text-secondary) !important; background: transparent !important; }
.nav-tabs .nav-link:hover:not(.active) { color: var(--text-primary) !important; background: var(--bg) !important; }

/* Card visual standardization — consistent across all surfaces */
.card { transition: box-shadow 0.2s ease !important; }
.card:hover { box-shadow: var(--shadow-md) !important; }

/* ============================================================
   FIXED OVERLAY SUPPRESSION
   ============================================================ */
.toast-container,
.position-fixed.end-0:not(#floatingBugBtn):not(#ariaKopilot),
.position-fixed.top-0.end-0,
.position-fixed[style*="right"]:not(#floatingBugBtn):not(#ariaKopilot) {
    display: none !important;
}

body::before, body::after,
.main-wrapper::before, .main-wrapper::after,
.main-content::before, .main-content::after,
.top-bar::before, .top-bar::after,
.top-bar-actions::before, .top-bar-actions::after,
.container-fluid::before, .container-fluid::after { content: none !important; }

.site-footer::before, .site-footer::after { content: initial !important; }
.site-footer small, .site-footer .copyright-text { display: block !important; }

@media (max-width: 767px) {
    body.app-layout {
        padding-left: 0;
    }
    .sidebar {
        transform: translateX(-100%);
        /* Mobile: slide in/out horizontally only — no width animation */
        transition: transform 0.25s ease;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    /* Desktop collapse toggle should have no effect on mobile */
    .sidebar.collapsed {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }
    .sidebar.collapsed.mobile-open {
        transform: translateX(0);
    }
    body.app-layout.sidebar-collapsed {
        padding-left: 0;
    }
    .mobile-sidebar-toggle {
        display: flex;
    }
}

/* ============================================================
   GLOBAL HORIZONTAL OVERFLOW PREVENTION
   ============================================================ */
html {
    overflow-x: hidden;
    max-width: 100%;
}
body {
    overflow-x: hidden;
    max-width: 100%;
}
.main-wrapper {
    overflow-x: hidden;
    min-width: 0;
    width: 100%;
}

/* ============================================================
   NAVIGATION LOADING PROGRESS BAR
   ============================================================ */
#navProgress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--brand-600);
    z-index: 9999;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.15s ease;
    pointer-events: none;
}
#navProgress.loading {
    opacity: 1;
    width: 75%;
    transition: width 8s cubic-bezier(0.1, 0.5, 0.2, 1), opacity 0.1s ease;
}
#navProgress.done {
    width: 100% !important;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.3s ease 0.15s;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

body.app-layout {
    padding-left: var(--sidebar-width);
    transition: padding-left 0.2s ease;
}

body.app-layout.sidebar-collapsed {
    padding-left: var(--sidebar-collapsed-width);
}

/* ============================================================
   SIDEBAR — CHARCOAL GRADIENT
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0B1E3D 0%, #071428 100%);
    border-right: 1px solid rgba(255,255,255,0.05);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: #162A4A transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

/* ── Mobile off-canvas backdrop ──────────────────────────────────────── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 999; /* directly under .sidebar's 1000 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }
@media (min-width: 768px) {
    .sidebar-backdrop { display: none !important; }
}
/* Lock page scroll behind the drawer while it's open on mobile */
body.mobile-nav-open { overflow: hidden; }

/* ── Collapsed icon-only rail (desktop toggle) ────────────────────────── */
/* Hide text labels so collapsing the width doesn't cause vertical wrapping */
.sidebar.collapsed .brand-text       { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-text         { display: none; }
.sidebar.collapsed .nav-section-title { display: none !important; }
.sidebar.collapsed .nav-link .badge  { display: none !important; }
/* Keep brand icon centred in the narrowed header */
.sidebar.collapsed .sidebar-brand    { justify-content: center; }
/* Flip toggle chevron to point right (expand direction) */
.sidebar.collapsed .sidebar-toggle svg,
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
/* Centre nav icons when text is hidden */
.sidebar.collapsed .nav-link         { justify-content: center !important; padding-left: 0.625rem !important; padding-right: 0.625rem !important; }
.sidebar.collapsed .nav-item         { padding: 0 0.375rem; }

/* Sidebar Header */
.sidebar-header {
    padding: 1rem 0.875rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0B1E3D;
    position: sticky;
    top: 0;
    z-index: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.brand-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    box-shadow: 0 2px 6px rgba(15, 168, 168, 0.35);
}

.brand-icon svg, .brand-icon i { color: white !important; width: 16px; height: 16px; }

.brand-text {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #F1F5F9 !important;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    transition: opacity 0.15s ease, width 0.15s ease;
}

/* Sidebar Toggle */
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--ease);
}
.sidebar-toggle:hover { background: var(--sidebar-hover); color: white; }

/* Sidebar Nav */
.sidebar-nav { padding: 0.75rem 0; }

.nav-section {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    border: none !important;
}

.nav-section-title {
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
    color: var(--sidebar-title) !important;
    padding: 1rem 1rem 0.375rem !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.375rem !important;
}

.nav-section-title .badge { display: none !important; }

.nav-section-title svg,
.nav-section-title i {
    width: 12px !important;
    height: 12px !important;
    color: var(--sidebar-title) !important;
}

.nav-item { padding: 0 0.5rem; }

.nav-link {
    display: flex !important;
    align-items: center !important;
    padding: 0.5rem 0.625rem !important;
    border-radius: var(--radius) !important;
    color: var(--sidebar-text) !important;
    text-decoration: none !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    gap: 0.625rem !important;
    transition: var(--ease) !important;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 1px;
    background: transparent !important;
    border: none !important;
}

.nav-link:hover {
    background: var(--sidebar-hover) !important;
    color: #F1F5F9 !important;
}

.nav-link.active {
    background: rgba(15, 168, 168, 0.18) !important;
    color: #7EC8C8 !important;
    border-left: 2px solid var(--brand-500) !important;
    padding-left: calc(0.625rem - 2px) !important;
}

.nav-link.active .nav-icon,
.nav-link.active svg {
    color: #7EC8C8 !important;
    opacity: 1;
}

.nav-icon, .nav-link svg {
    width: 15px !important;
    height: 15px !important;
    flex-shrink: 0 !important;
    color: var(--sidebar-text) !important;
    opacity: 0.8;
}

.nav-link:hover .nav-icon,
.nav-link:hover svg {
    color: #F1F5F9 !important;
    opacity: 1;
}

.nav-text {
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link .badge {
    font-size: 0.6rem !important;
    padding: 0.15em 0.4em !important;
    margin-left: auto !important;
    opacity: 0.9;
}

/* CPSR Report nav item - special highlight */
.nav-link[onclick*="showQuickCPSRModal"],
.nav-link[onclick*="CPSR"] {
    background: var(--brand-600) !important;
    color: white !important;
}

.nav-link[onclick*="showQuickCPSRModal"]:hover,
.nav-link[onclick*="CPSR"]:hover {
    background: var(--brand-700) !important;
}

.nav-link[onclick*="showQuickCPSRModal"] .nav-icon,
.nav-link[onclick*="showQuickCPSRModal"] svg,
.nav-link[onclick*="CPSR"] .nav-icon,
.nav-link[onclick*="CPSR"] svg {
    color: white !important;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border-top: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.page-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
}

/* ── Top-bar AI Action Buttons (GIGI + Bug Report) ─────────────────────── */
.btn-topbar-ai {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    position: relative;
    line-height: 1;
}
.btn-topbar-gigi {
    color: var(--brand-600);
    font-weight: 600;
}
.btn-topbar-gigi:hover {
    background: rgba(15, 168, 168, 0.08);
    color: var(--brand-700, #0A7A7A);
}
.btn-topbar-gigi svg {
    stroke: var(--brand-600);
}
.btn-topbar-bug:hover {
    background: #fef2f2;
    color: #dc2626;
}
.btn-topbar-bug:hover svg {
    stroke: #dc2626;
}
.topbar-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 2px;
    opacity: 0.7;
}
.topbar-ai-label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0em;
}
.topbar-ai-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 15px;
    height: 15px;
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
    border: 1.5px solid #fff;
    font-size: 0.58rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

/* User Dropdown */
.user-profile .btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.375rem 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--ease);
}

.user-profile .btn-ghost:hover {
    background: var(--bg);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    background: var(--brand-600);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    overflow-x: hidden;
    padding: 0 1.5rem 2rem;
    flex: 1;
}

/* Full-bleed pages: remove all padding and footer when .builder-container is present */
.main-content:has(.builder-container) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove top-bar bottom margin so the builder sits flush below the topbar */
.main-wrapper:has(.builder-container) .top-bar {
    margin-bottom: 0 !important;
}

/* Hide site footer in the builder so it doesn't eat into viewport height */
.main-wrapper:has(.builder-container) .site-footer {
    display: none !important;
}

.content-container {
    max-width: min(1400px, 100%);
    margin: 0 auto;
    overflow-x: hidden;
}

.content-container-fluid {
    max-width: 100%;
    width: 100%;
    margin: 0;
    overflow-x: hidden;
    padding: 0;
}

.main-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-top: none;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-messages-container {
    padding: 0.5rem 1.5rem 0;
    z-index: 100;
    position: relative;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 { font-size: 1.5rem;   font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); line-height: 1.25; }
h2 { font-size: 1.25rem;  font-weight: 700; letter-spacing: -0.015em; color: var(--text-primary); line-height: 1.3; }
h3 { font-size: 1.0625rem; font-weight: 600; color: var(--text-primary); line-height: 1.35; }
h4 { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
h5 { font-size: 0.875rem;  font-weight: 600; color: var(--text-primary); line-height: 1.4; }
h6 { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }

p { color: var(--text-secondary); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.text-muted { color: var(--text-muted) !important; }
.text-primary-custom { color: var(--brand-600) !important; }

small { font-size: 0.8125rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: box-shadow 0.25s ease, transform 0.25s ease !important;
}

.card:hover { box-shadow: var(--shadow-md) !important; }

.card-header {
    background: var(--bg) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0.875rem 1.25rem !important;
    border-top-left-radius: var(--radius-lg) !important;
    border-top-right-radius: var(--radius-lg) !important;
}

.card-body { padding: 1.25rem !important; }

.card-title {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-footer {
    background: var(--bg) !important;
    border-top: 1px solid var(--border) !important;
    padding: 0.875rem 1.25rem !important;
}

/* Stat cards */
.stat-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    padding: 1.25rem !important;
    box-shadow: var(--shadow-sm) !important;
}

.stat-card-body { padding: 0; }

.stat-card-value,
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card-label,
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg, .stat-icon i { width: 20px; height: 20px; }

.stat-icon-brand { background: var(--brand-50); color: var(--brand-600); }
.stat-icon-success { background: var(--success-bg); color: var(--success); }
.stat-icon-warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon-danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon-info { background: var(--info-bg); color: var(--info); }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    color: var(--text-primary) !important;
    background: var(--surface) !important;
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg) !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0.75rem 1rem !important;
}

.table tbody tr {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:last-child { border-bottom: none; }

.table td {
    background: inherit !important;
    color: var(--text-primary) !important;
    vertical-align: middle;
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid var(--border) !important;
}

.table-hover tbody tr:hover {
    background: var(--bg) !important;
}

.table-light { background: var(--bg) !important; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    line-height: 1.4;
    transition: var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn svg, .btn i { width: 15px; height: 15px; }

.btn-primary {
    background: var(--brand-600) !important;
    border-color: var(--brand-600) !important;
    color: #ffffff !important;
}

.btn-primary:hover {
    background: var(--brand-700) !important;
    border-color: var(--brand-700) !important;
    color: #ffffff !important;
}

.btn-secondary {
    background: var(--surface) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-secondary) !important;
}

.btn-secondary:hover {
    background: var(--bg) !important;
    color: var(--text-primary) !important;
}

.btn-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: white !important;
}

.btn-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

.btn-outline-primary {
    color: var(--brand-600) !important;
    border-color: var(--brand-600) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: var(--brand-600) !important;
    color: white !important;
}

.btn-outline-secondary {
    color: var(--text-secondary) !important;
    border-color: var(--border-strong) !important;
    background: transparent !important;
}

.btn-outline-secondary:hover {
    background: var(--bg) !important;
    color: var(--text-primary) !important;
}

.btn-outline-success {
    color: var(--success) !important;
    border-color: var(--success) !important;
    background: transparent !important;
}

.btn-outline-success:hover {
    background: var(--success) !important;
    color: white !important;
}

.btn-outline-danger {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: transparent !important;
}

.btn-outline-danger:hover {
    background: var(--danger) !important;
    color: white !important;
}

.btn-outline-dark {
    color: var(--text-primary) !important;
    border-color: var(--border-strong) !important;
    background: transparent !important;
}

.btn-outline-dark:hover {
    background: var(--text-primary) !important;
    color: white !important;
}

.btn-outline-info {
    color: var(--info) !important;
    border-color: var(--info) !important;
    background: transparent !important;
}

.btn-outline-info:hover {
    background: var(--info) !important;
    color: white !important;
}

.btn-outline-warning {
    color: var(--warning) !important;
    border-color: var(--warning) !important;
    background: transparent !important;
}

.btn-outline-warning:hover {
    background: var(--warning) !important;
    color: var(--text-primary) !important;
}

.btn-ghost {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
}

.btn-ghost:hover {
    background: var(--bg) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary) !important;
}

.btn-sm {
    font-size: 0.8125rem !important;
    padding: 0.3125rem 0.625rem !important;
}

.btn-lg {
    font-size: 1rem !important;
    padding: 0.75rem 1.5rem !important;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25em 0.6em;
    border-radius: 999px;
    letter-spacing: 0.01em;
}

.bg-success { background: var(--success) !important; color: white !important; }
.bg-warning { background: var(--warning) !important; color: white !important; }
.bg-danger  { background: var(--danger)  !important; color: white !important; }
.bg-info    { background: var(--info)    !important; color: white !important; }
.bg-primary { background: var(--brand-600) !important; color: white !important; }
.bg-secondary { background: #64748B !important; color: white !important; }
.bg-light   { background: var(--bg) !important; color: var(--text-primary) !important; }
.bg-dark    { background: var(--text-primary) !important; color: white !important; }

/* Status badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-status-active    { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.25); }
.badge-status-success   { background: var(--success-bg); color: var(--success); border-color: rgba(16,185,129,0.25); }
.badge-status-draft     { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,158,11,0.25); }
.badge-status-completed { background: var(--info-bg); color: var(--info); border-color: rgba(26,74,138,0.25); }
.badge-status-info      { background: var(--info-bg); color: var(--info); border-color: rgba(26,74,138,0.25); }
.badge-status-inactive  { background: var(--bg); color: var(--text-muted); border-color: var(--border); }
.badge-status-danger    { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.25); }
.badge-status-warning   { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,158,11,0.25); }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
    transition: var(--ease);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px var(--brand-50);
    outline: none;
    background: var(--surface);
    color: var(--text-primary);
}

.form-control::placeholder { color: var(--text-muted); }
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.375rem; }
.form-text  { font-size: 0.8rem; color: var(--text-muted); }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    background: var(--brand-600);
    transition: width 0.6s ease;
}

.progress-bar.bg-success { background: var(--success) !important; }
.progress-bar.bg-warning { background: var(--warning) !important; }
.progress-bar.bg-danger  { background: var(--danger)  !important; }
.progress-bar.bg-primary { background: var(--brand-600) !important; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--radius);
    border: 1px solid;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
}

.alert-success { background: var(--success-bg); border-color: rgba(16,185,129,0.3); color: #065F46; }
.alert-warning { background: var(--warning-bg); border-color: rgba(245,158,11,0.3); color: #92400E; }
.alert-danger  { background: var(--danger-bg);  border-color: rgba(239,68,68,0.3);  color: #991B1B; }
.alert-info    { background: var(--info-bg);    border-color: rgba(26,74,138,0.3); color: #1A4A8A; }

/* ============================================================
   DROPDOWNS & MODALS
   ============================================================ */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    font-size: 0.875rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    transition: var(--ease);
}

.dropdown-item:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.dropdown-divider { border-color: var(--border); margin: 0.25rem 0; }

.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.modal-body   { padding: 1.5rem; }
.modal-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

/* ============================================================
   QUICK ACTION ITEMS
   ============================================================ */
.quick-action-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--ease);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    gap: 0.625rem;
}

.quick-action-item:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.quick-action-item svg,
.quick-action-item i {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.quick-action-item:hover svg,
.quick-action-item:hover i {
    color: var(--text-secondary);
}

.quick-action-item.quick-action-primary {
    background: var(--brand-50);
    color: var(--brand-600);
    font-weight: 600;
}

.quick-action-item.quick-action-primary:hover {
    background: var(--brand-100);
}

.quick-action-item.quick-action-primary svg,
.quick-action-item.quick-action-primary i {
    color: var(--brand-600);
}

.quick-action-item.quick-action-success {
    background: var(--success-bg);
    color: var(--success);
}

.quick-action-item.quick-action-success:hover {
    background: rgba(16,185,129,0.15);
}

.quick-action-item.quick-action-danger {
    color: var(--danger);
}

.quick-action-item.quick-action-danger:hover {
    background: var(--danger-bg);
}

.quick-action-item.quick-action-danger svg,
.quick-action-item.quick-action-danger i {
    color: var(--danger);
}

/* ============================================================
   PAGE HEADER BLOCK
   ============================================================ */
.page-header-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1.125rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.page-header-block h1,
.page-header-block h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.page-header-block .page-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.page-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text-primary);
}

.page-header-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* ============================================================
   QUESTION TEXT — NEVER TRUNCATE
   ============================================================ */
.question-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    display: block !important;
    hyphens: auto;
    line-height: 1.5 !important;
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

/* ============================================================
   AUDIT LINK
   ============================================================ */
.audit-link {
    color: var(--brand-600) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

.audit-link:hover {
    color: var(--brand-700) !important;
    text-decoration: underline !important;
}

/* ============================================================
   GRADIENT TEXT HELPER
   ============================================================ */
.gradient-text {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
.fade-in  { animation: fadeIn 0.4s ease; }
.slide-up { animation: slideUp 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ============================================================
   BOOTSTRAP UTILITY SHIMS
   ============================================================ */
.d-grid { display: grid; }
.d-flex { display: flex; }
.table-responsive { overflow-x: auto; }

/* ============================================================
   MISC OVERRIDES
   ============================================================ */
hr { border-color: var(--border); opacity: 1; }

.bg-white  { background: var(--surface) !important; }
.bg-light  { background: var(--bg) !important; }

.border    { border-color: var(--border) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow    { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.rounded   { border-radius: var(--radius) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

/* Text color utilities */
.text-dark    { color: var(--text-primary) !important; }
.text-body    { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-info    { color: var(--info)    !important; }
.text-primary { color: var(--brand-600) !important; }
.text-white   { color: #ffffff !important; }
.text-white-50 { color: rgba(255,255,255,0.6) !important; }

/* fw utilities */
.fw-medium { font-weight: 500; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    min-height: 200px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--brand-50);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--brand-600);
}

.empty-state-icon svg,
.empty-state-icon i {
    width: 28px !important;
    height: 28px !important;
    color: var(--brand-600) !important;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.empty-state-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 380px;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* ============================================================
   LAYOUT UTILITY
   ============================================================ */
.min-width-0 { min-width: 0; }

/* ============================================================
   LIST GROUP OVERRIDES
   ============================================================ */
.list-group-item {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary);
}

.list-group-item-action:hover {
    background: var(--bg) !important;
    color: var(--text-primary);
}

.list-group-item-action:focus {
    background: var(--bg) !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* 768px and below: hide nav labels (sidebar is already off-screen via transform on mobile) */
@media (max-width: 768px) {
    .nav-text  { display: none; }
    .brand-text { display: none; }
    .main-content { padding: 0 1rem 1.5rem; }

    /* Top bar — allow wrapping at narrow viewports */
    .top-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
    }
    /* The actual space-between row lives one level deeper (Bootstrap
       .d-flex utility, no custom class to hook) — let it wrap too, and
       let its flex children shrink instead of forcing overflow. */
    .top-bar .container-fluid > .d-flex {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }
    .top-bar .container-fluid > .d-flex > .d-flex {
        min-width: 0;
    }
    .page-breadcrumb { min-width: 0; }
    .page-breadcrumb .page-title { min-width: 0; }

    .page-title { font-size: 1.125rem !important; }

    /* Top-bar AI actions — icon-only to avoid wrapping into extra rows */
    .topbar-ai-label { display: none; }
    .btn-topbar-ai { padding: 0.35rem 0.5rem; }

    /* User menu — avatar + caret only, hide name/role text */
    .user-profile .btn-ghost .ms-2 { display: none; }
    .user-profile .btn-ghost { padding: 0.375rem; gap: 0; }

    /* Nav tabs — horizontal scroll instead of wrapping */
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-link { white-space: nowrap; }

    /* Stat cards — allow 2-col grid */
    .stat-card { padding: 1rem !important; }
    .stat-value { font-size: 1.375rem !important; }

    /* Page header block — allow wrap */
    .page-header-block {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    /* Filter rows — ensure labels are visible */
    .form-label { font-size: 0.8125rem; }

    /* Ticket / card action rows */
    .ticket-card .card-body .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    /* Table cells — allow wrapping, prevent hard overflow */
    .table td, .table th { word-break: break-word; overflow-wrap: break-word; }

    /* Empty state tighter on mobile */
    .empty-state { padding: 2rem 1rem; }
    .empty-state-icon { width: 52px; height: 52px; }
}

/* 375px and below: further tighten layout */
@media (max-width: 375px) {
    .main-content { padding: 0 0.75rem 1.25rem; }
    .top-bar { padding: 0.75rem; }
    .card-body { padding: 1rem !important; }
    .stat-value { font-size: 1.25rem !important; }
    .page-header-title { font-size: 1.125rem !important; }

    .btn { padding: 0.4375rem 0.75rem; font-size: 0.8125rem; }
    .btn-sm { padding: 0.25rem 0.5rem !important; font-size: 0.75rem !important; }
}

@media (min-width: 1400px) {
    .main-content { padding: 0 2.5rem 2rem; }
}

/* ============================================================
   LAYOUT NORMALISATION
   Remove the extra top-padding that some templates apply via py-* on
   their outermost container-fluid / container wrapper. The top-bar's
   margin-bottom already supplies the correct vertical rhythm, so the
   first child of .content-container should start flush at the top.
   This brings those pages in line with pages that use .page-header-block.
   ============================================================ */
.content-container > .container,
.content-container > .container-fluid {
    padding-top: 0;
}

/* ============================================================
   BREADCRUMB — TOP-BAR CONTEXT
   Compact trail rendered beneath page-title inside .page-breadcrumb
   ============================================================ */
.page-breadcrumb .breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
    font-size: 0.75rem;
    line-height: 1.4;
    flex-wrap: nowrap;
    overflow: hidden;
    white-space: nowrap;
}
.page-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
    content: "/";
    padding: 0 0.3rem;
}
.page-breadcrumb .breadcrumb-item a {
    color: var(--brand-600);
    text-decoration: none;
    font-weight: 500;
}
.page-breadcrumb .breadcrumb-item a:hover {
    text-decoration: underline;
    color: var(--brand-700);
}
.page-breadcrumb .breadcrumb-item.active {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    display: inline-block;
    vertical-align: bottom;
}

/* ============================================================
   ROW-CLICKABLE
   Apply to <tr> elements to give them pointer-cursor + hover
   affordance without losing action button click areas.
   ============================================================ */
.row-clickable {
    cursor: pointer;
    transition: background 0.1s;
}
.row-clickable:hover {
    background: var(--bg) !important;
}
/* Left accent bar — animates in on hover */
.row-clickable td:first-child {
    position: relative;
}
.row-clickable td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    border-radius: 2px;
    background: var(--brand-600);
    opacity: 0;
    transition: height 0.15s, opacity 0.15s;
}
.row-clickable:hover td:first-child::before {
    height: 60%;
    opacity: 1;
}

/* Right-chevron "View →" affordance on the last cell */
.row-clickable td:last-child {
    position: relative;
}
/* CSS ::after chevron that appears on hover for every row-clickable table */
.row-clickable td:last-child::after {
    content: "›";
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--brand-600);
    opacity: 0;
    transition: opacity 0.15s, right 0.15s;
    pointer-events: none;
}
.row-clickable:hover td:last-child::after {
    opacity: 0.7;
    right: 4px;
}
/* Explicit "View ›" cell (used in dashboard recent-audits table) */
.row-clickable td.row-nav-cell {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    user-select: none;
    transition: color 0.15s;
}
.row-clickable:hover td.row-nav-cell {
    color: var(--brand-600);
}
/* Hide pseudo-chevron on cells that already show explicit "View ›" text */
.row-clickable td.row-nav-cell::after {
    display: none;
}

/* ============================================================
   WIZARD STEP PROGRESS
   Named step indicator for multi-step report wizard.
   ============================================================ */
.wizard-steps {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 0.25rem;
    position: relative;
}
.wizard-steps::before {
    content: "";
    position: absolute;
    top: 14px;
    left: calc(12.5% + 14px);
    right: calc(12.5% + 14px);
    height: 2px;
    background: var(--border);
    z-index: 0;
}
.wizard-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    position: relative;
    z-index: 1;
}
.wizard-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    transition: all 0.2s;
}
.wizard-step.active .wizard-step-circle {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(15, 168, 168, 0.15);
}
.wizard-step.completed .wizard-step-circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.wizard-step-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}
.wizard-step.active .wizard-step-label {
    color: var(--brand-600);
    font-weight: 600;
}
.wizard-step.completed .wizard-step-label {
    color: var(--success);
}

/* Connector line fill for completed steps */
.wizard-steps[data-step="2"]::before { background: linear-gradient(to right, var(--success) 33%, var(--border) 33%); }
.wizard-steps[data-step="3"]::before { background: linear-gradient(to right, var(--success) 66%, var(--border) 66%); }
.wizard-steps[data-step="4"]::before { background: var(--success); }

/* .step-progress is the canonical utility alias (see also .wizard-steps above) */
.step-progress { /* extends .wizard-steps */ }
.step-progress { display: flex; align-items: flex-start; gap: 0; margin-bottom: 0.25rem; position: relative; }
.step-progress::before { content: ""; position: absolute; top: 14px; left: calc(12.5% + 14px); right: calc(12.5% + 14px); height: 2px; background: var(--border); z-index: 0; }
.step-progress .step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.375rem; position: relative; z-index: 1; }
.step-progress .step .step-circle { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; border: 2px solid var(--border); background: var(--surface); color: var(--text-muted); }
.step-progress .step.active .step-circle { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 0 0 3px rgba(15,168,168,0.15); }
.step-progress .step.completed .step-circle { background: var(--success); border-color: var(--success); color: #fff; }
.step-progress .step .step-label { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); text-align: center; white-space: nowrap; }
.step-progress .step.active .step-label { color: var(--brand-600); font-weight: 600; }
.step-progress .step.completed .step-label { color: var(--success); }

/* ============================================================
   MICRO-FEEDBACK — SUBMIT SPINNER
   Add data-loading attribute to <button type="submit"> to get
   a spinner + disabled state on form submit.
   ============================================================ */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}
.btn-loading .btn-text { visibility: hidden; }
.btn-loading::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.65s linear infinite;
}
@keyframes btn-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

