/* ==========================================================================
   RAFly Premium Agency OS — Admin Design System (Light Theme Primary)
   ========================================================================== */

:root {
    /* Brand Colors */
    --primary:          #0A63FF;
    --primary-hover:    #0252D4;
    --primary-soft:     #EFF6FF;
    --primary-border:   #BFDBFE;
    
    --deep:             #050F33;
    --secondary-blue:   #0284C7;
    
    --canvas:           #F8FAFC;
    --surface:          #FFFFFF;
    --surface-subtle:   #F1F5F9;
    --surface-hover:    #F8FAFC;
    
    --border:           #E2E8F0;
    --border-subtle:    #F1F5F9;
    
    --text:             #050F33;
    --text-muted:       #64748B;
    --text-light:       #94A3B8;
    
    --ok:               #16A34A;
    --ok-soft:          #F0FDF4;
    --ok-border:        #BBF7D0;
    
    --warn:             #D97706;
    --warn-soft:        #FFFBEB;
    --warn-border:      #FDE68A;
    
    --danger:           #DC2626;
    --danger-soft:      #FEF2F2;
    --danger-border:    #FECACA;
    
    --purple:           #7C3AED;
    --purple-soft:      #F5F3FF;
    --purple-border:    #DDD6FE;

    /* Sizing & Spacing */
    --sidebar-w:        250px;
    --sidebar-collapsed-w: 72px;
    --header-h:         64px;
    --radius-sm:        6px;
    --radius:           10px;
    --radius-lg:        14px;
    --radius-full:      9999px;

    /* Shadows & Elevation */
    --shadow-sm:        0 1px 2px rgba(5, 15, 51, 0.04);
    --shadow:           0 1px 3px rgba(5, 15, 51, 0.05), 0 4px 12px rgba(5, 15, 51, 0.03);
    --shadow-md:        0 4px 6px -1px rgba(5, 15, 51, 0.06), 0 10px 24px -3px rgba(5, 15, 51, 0.06);
    --shadow-lg:        0 12px 32px -4px rgba(5, 15, 51, 0.12);

    /* Transitions */
    --transition-fast:  150ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background-color: var(--canvas);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body > svg:first-of-type {
    display: none !important;
}

/* Universal SVG Icon Engine (Lucide UI Icons) */
.icon,
svg.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Icon Sizing & Style Modifiers */
.icon-xs { width: 12px !important; height: 12px !important; stroke-width: 2; }
.sm-icon, .icon-sm { width: 14px !important; height: 14px !important; stroke-width: 2; }
.icon-md { width: 18px !important; height: 18px !important; stroke-width: 2; }
.icon-lg { width: 22px !important; height: 22px !important; stroke-width: 2; }
.icon-xl { width: 28px !important; height: 28px !important; stroke-width: 1.75; }
.icon-fill { fill: currentColor !important; stroke: none !important; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-hover);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    color: var(--deep);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   LOGIN SCREEN & FORM COMPONENTS
   ========================================================================== */

body.login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #050F33 0%, #0A194F 50%, #050F33 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

body.login::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(10, 99, 255, 0.18) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    pointer-events: none;
    border-radius: 50%;
}

.login-card {
    background: #FFFFFF;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-lg, 16px);
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(5, 15, 51, 0.25), 0 4px 12px rgba(5, 15, 51, 0.1);
    position: relative;
    z-index: 10;
}

.login-card img {
    height: 36px;
    width: auto;
    display: block;
    margin-bottom: 24px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: #050F33;
    margin-bottom: 6px;
}

.login-card p.sub {
    font-size: 14px;
    color: #64748B;
    margin-bottom: 24px;
}

.login-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid #DC2626;
    color: #991B1B;
    padding: 12px 16px;
    border-radius: var(--radius-sm, 8px);
    font-size: 13.5px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* Generic Field Wrappers */
.field {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: #050F33;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field select,
.field textarea {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #050F33;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: var(--radius, 10px);
    transition: all 180ms ease;
    outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: #0A63FF;
    box-shadow: 0 0 0 3px rgba(10, 99, 255, 0.15);
}

.hp-field {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Shell Layout */
.shell {
    display: flex;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    background: var(--canvas);
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    overflow: hidden;
    transition: width var(--transition-normal);
}

.sidebar-brand {
    height: var(--header-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.brand-logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand-img-light {
    height: 28px;
    width: auto;
}
.brand-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-collapse-btn:hover {
    background: var(--surface-subtle);
    color: var(--text);
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
}

.nav-group-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 16px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    position: relative;
}
.nav-link:hover {
    background: var(--surface-subtle);
    color: var(--text);
}
.nav-link.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}
.nav-link.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3.5px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.nav-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
    opacity: 0.8;
}
.nav-link.is-active .nav-icon {
    opacity: 1;
    color: var(--primary);
}

/* Sidebar Foot */
.sidebar-foot {
    margin-top: auto;
    flex-shrink: 0;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    position: relative;
    z-index: 2;
    overflow: hidden;
    width: 100%;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--deep);
    color: #FFF;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--deep);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.dev-role-switcher {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    margin-bottom: 12px;
    font-size: 11px;
}
.dev-tag {
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 9.5px;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}
.dev-links {
    display: flex;
    gap: 6px;
}
.dev-links a {
    color: var(--primary);
    font-weight: 600;
}

.foot-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    gap: 8px;
}
.foot-link {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    transition: color var(--transition-fast);
}
.foot-link:hover {
    color: var(--primary);
}
.foot-link.logout:hover {
    color: var(--danger);
}

/* MAIN WRAPPER */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

/* TOP HEADER */
.top-header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
}

.header-breadcrumbs ol {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    font-size: 13px;
    color: var(--text-muted);
}
.header-breadcrumbs a {
    color: var(--text-muted);
}
.header-breadcrumbs a:hover {
    color: var(--primary);
}
.crumb-separator {
    color: var(--border);
    font-size: 12px;
}
.crumb-active {
    font-weight: 600;
    color: var(--deep);
}

.header-center {
    flex: 1;
    max-width: 440px;
    margin: 0 24px;
}
.global-search-trigger {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.global-search-trigger:hover,
.global-search-trigger:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 99, 255, 0.1);
    outline: none;
}
.search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}
.search-placeholder {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-shortcut {
    font-family: monospace;
    font-size: 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.quick-add-btn {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    border-radius: var(--radius);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 200px;
    max-width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 1000;
    display: none;
}

.dropdown-menu.show {
    display: block;
    animation: fadeInDown 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
.dropdown-menu-right {
    right: 0;
    left: auto;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 13px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--surface-subtle);
    color: var(--primary);
}
.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}
.dropdown-item:hover svg {
    color: var(--primary);
}

.header-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}
.header-icon-btn:hover {
    background: var(--surface-subtle);
    color: var(--text);
}
.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #FFF;
    font-size: 10px;
    font-weight: 700;
    height: 16px;
    min-width: 16px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary-border);
}

/* MAIN CONTENT AREA */
.main-content {
    flex: 1;
    padding: 0;
}
.page-container {
    padding: 28px 32px 48px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Toast Flash */
.toast-flash {
    margin: 20px 32px 0;
    padding: 12px 18px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    box-shadow: var(--shadow-sm);
    animation: fadeInDown 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.flash-content {
    display: flex;
    align-items: center;
    gap: 10px;
}
.flash-icon {
    width: 18px;
    height: 18px;
}
.flash-ok {
    background: var(--ok-soft);
    border: 1px solid var(--ok-border);
    color: var(--ok);
}
.flash-warn {
    background: var(--warn-soft);
    border: 1px solid var(--warn-border);
    color: var(--warn);
}
.flash-danger {
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}
.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: inherit;
    opacity: 0.7;
}

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-title h1 {
    font-size: 26px;
    color: var(--deep);
}
.page-header-title p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 4px;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
}
.btn-lg {
    padding: 12px 22px;
    font-size: 15px;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(10, 99, 255, 0.2);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #FFF;
}

.btn-secondary {
    background: var(--surface-subtle);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--border-subtle);
    color: var(--deep);
}

.btn-outline {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--primary-border);
}
.btn-outline:hover {
    background: var(--primary-soft);
}

.btn-danger {
    background: var(--danger);
    color: #FFF;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: #B91C1C;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius);
}

/* STAT CARDS */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-border);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.stat-title {
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.stat-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon-wrapper svg {
    width: 18px;
    height: 18px;
}

.stat-body {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--deep);
    line-height: 1;
}

.stat-trend {
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: var(--radius-full);
}
.trend-up {
    background: var(--ok-soft);
    color: var(--ok);
}
.trend-down {
    background: var(--danger-soft);
    color: var(--danger);
}
.stat-subtext {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* CARDS & PANELS */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 16px;
    color: var(--deep);
}
.card-body {
    padding: 24px;
}

/* TABLES & LIST TOOLBARS */
.table-wrap,
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

table.data,
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 13.5px;
}

table.data th,
.admin-table th {
    background: var(--surface-subtle);
    padding: 12px 18px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td,
.admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text);
    vertical-align: middle;
}

table.data tr:last-child td,
.admin-table tr:last-child td {
    border-bottom: none;
}

table.data tr:hover td,
.admin-table tr:hover td {
    background: var(--surface-hover);
}

.th-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.th-sort:hover {
    color: var(--primary);
}
.th-sort.is-sorted {
    color: var(--primary);
    font-weight: 700;
}
.sort-arrow {
    font-size: 10px;
    margin-left: 2px;
}

td.num, th.num, .text-right {
    text-align: right !important;
}
.text-center {
    text-align: center !important;
}

/* LIST TOOLBAR */
.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.toolbar .field {
    margin-bottom: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.toolbar .field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.toolbar input[type="search"],
.toolbar input[type="text"],
.toolbar select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: all var(--transition-fast);
}

.toolbar input[type="search"]:focus,
.toolbar input[type="text"]:focus,
.toolbar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 99, 255, 0.12);
}

.toolbar .count {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.toolbar .spacer {
    flex: 1;
}

/* PAGER */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: var(--surface-subtle);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: 13px;
    color: var(--text-muted);
}

.pager .spacer {
    flex: 1;
}

/* ACTIONS CELL & TITLE LINKS */
.actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.post-title-link {
    font-weight: 600;
    color: var(--deep);
    transition: color var(--transition-fast);
}
.post-title-link:hover {
    color: var(--primary);
}

/* EMPTY TABLE STATE */
td.empty {
    padding: 40px 20px !important;
    text-align: center;
}
td.empty .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
td.empty .empty-state svg {
    width: 40px;
    height: 40px;
    color: var(--text-light);
}
td.empty .empty-state-text {
    font-size: 13.5px;
    color: var(--text-muted);
}
td.empty .empty-state-text strong {
    color: var(--deep);
    font-size: 15px;
}


/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: capitalize;
    white-space: nowrap;
}
.badge-ok {
    background: var(--ok-soft);
    color: var(--ok);
    border: 1px solid var(--ok-border);
}
.badge-warn {
    background: var(--warn-soft);
    color: var(--warn);
    border: 1px solid var(--warn-border);
}
.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}
.badge-blue {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-border);
}
.badge-purple {
    background: var(--purple-soft);
    color: var(--purple);
    border: 1px solid var(--purple-border);
}
.badge-muted {
    background: var(--surface-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* FORMS */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--deep);
    margin-bottom: 6px;
}
.form-label .required {
    color: var(--danger);
}
.form-control, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 13px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 99, 255, 0.12);
    outline: none;
}
.form-help {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* LEAD PIPELINE BAR */
.pipeline-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 0;
    width: 100%;
}
.pipeline-step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.pipeline-step:hover, .pipeline-step.is-active {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.pipeline-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.pipeline-step-count {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--deep);
    margin-top: 6px;
}

/* KANBAN BOARD */
.kanban-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.kanban-col {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    max-height: 800px;
}
.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.kanban-col-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--deep);
}
.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: all var(--transition-fast);
}
.kanban-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-border);
}

/* MODAL & DRAWER */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 15, 51, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 150ms ease-out;
}
.modal-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    overflow: hidden;
    animation: scaleIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title {
    font-size: 18px;
    color: var(--deep);
}
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
}
.modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}
.modal-footer {
    padding: 16px 24px;
    background: var(--canvas);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* SEARCH MODAL */
.search-modal-dialog {
    max-width: 640px;
}
.search-modal-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.search-modal-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}
.search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--text);
    background: transparent;
}
.modal-esc-key {
    font-size: 11px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--text-muted);
}
.search-modal-body {
    padding: 16px 20px;
    max-height: 400px;
    overflow-y: auto;
}
.search-hint {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 30px 0;
}
.search-modal-footer {
    padding: 10px 20px;
    background: var(--canvas);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* TABS */
.nav-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab-item {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: all var(--transition-fast);
}
.tab-item:hover {
    color: var(--primary);
}
.tab-item.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* SKELETON */
.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* EMPTY STATES */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-light);
    margin: 0 auto 16px;
}
.empty-title {
    font-size: 18px;
    color: var(--deep);
    margin-bottom: 6px;
}
.empty-desc {
    font-size: 13.5px;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 20px;
}

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* SIDEBAR COLLAPSED STATE */
.shell.nav-collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
}
.shell.nav-collapsed .brand-logo-link img,
.shell.nav-collapsed .brand-badge,
.shell.nav-collapsed .nav-label,
.shell.nav-collapsed .nav-group-header,
.shell.nav-collapsed .user-info,
.shell.nav-collapsed .dev-role-switcher,
.shell.nav-collapsed .foot-actions span {
    display: none !important;
}
.shell.nav-collapsed .sidebar-brand {
    padding: 0 16px;
    justify-content: center;
}
.shell.nav-collapsed .nav-link {
    justify-content: center;
    padding: 10px 0;
}
.shell.nav-collapsed .user-profile-card {
    justify-content: center;
    margin-bottom: 0;
}
.shell.nav-collapsed .foot-actions {
    justify-content: center;
}

/* RESPONSIVE QA BREAKPOINTS */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        box-shadow: var(--shadow-lg);
        z-index: 1000;
    }
    .shell.nav-open .sidebar {
        transform: translateX(0);
    }
    .shell.nav-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(5, 15, 51, 0.4);
        backdrop-filter: blur(2px);
        z-index: 999;
    }
    .mobile-nav-toggle {
        display: block;
    }
    .header-center {
        max-width: 280px;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 0 16px;
    }
    .page-container {
        padding: 20px 16px 36px;
    }
    .header-center {
        display: none;
    }
    .stat-grid {
        grid-template-columns: 1fr;
    }
    .page-header {
        flex-direction: column;
    }
}

/* --- Button Groups ---------------------------------------------------- */
.btn-group {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius);
    background: var(--surface-subtle);
    padding: 3px;
    border: 1px solid var(--border);
}
.btn-group .btn {
    border-radius: var(--radius-sm);
    border: none;
    box-shadow: none;
}
.btn-group .btn:not(.btn-primary) {
    background: transparent;
    color: var(--text-muted);
}
.btn-group .btn:not(.btn-primary):hover {
    color: var(--text);
    background: var(--surface);
}

/* --- Charts (admin/lib/chart.php) ------------------------------------- */
.chart {
    width: 100%;
    height: auto;
    display: block;
}
.chart-empty {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
}
.bar-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 60px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-name {
    font-weight: 500;
    color: var(--text);
}
.bar-track {
    width: 100%;
}
.bar-value {
    text-align: right;
    font-weight: 600;
    font-family: 'Space Grotesk', monospace;
    color: var(--deep);
}
.meter-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
}
.meter-figure {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--deep);
    line-height: 1;
}
.meter-figure span {
    font-size: 18px;
    color: var(--text-muted);
}
.meter-body {
    flex: 1;
}
.meter-key {
    display: flex;
    gap: 12px;
    font-size: 12px;
    margin-top: 6px;
}
.key {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}
.key-ok {
    color: var(--ok);
}
.key-warn {
    color: var(--warn);
}
