/*
 * Slate theme — cosmetic reskin only, no layout changes.
 *
 * Loaded after site.css on selected pages to override colours, fonts, borders,
 * buttons, badges, and form controls while preserving all existing layout.
 *
 * Palette:
 *   Cyan accent   #06b6d4    (headings, active, primary buttons)
 *   Slate-900     #0f172a    (body bg dark end)
 *   Slate-800     #1e293b    (body bg light end, card surface)
 *   Card surface  rgba(15,23,42,0.7)
 *   Card border   rgba(6,182,212,0.15)
 *   Text          #e2e8f0 / #cbd5e1 / #94a3b8 / #475569
 *   Green         #10b981    Yellow #f59e0b    Red #ef4444    Blue #3b82f6
 *
 * Scope: only active when .slate-theme is on the <html> element AND
 * data-bs-theme="dark". Light mode is untouched.
 */

/* ═══════════════════════════════════════════════════════════════
   1. CSS custom property overrides (dark mode only)
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] {
    /* Surfaces */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --navbar-bg: rgba(7,13,27,0.92);
    --card-bg: rgba(15,23,42,0.7);
    --table-bg: rgba(15,23,42,0.7);
    --table-hover: rgba(6,182,212,0.06);
    --dropdown-bg: #1e293b;

    /* Borders */
    --border-color: rgba(6,182,212,0.15);

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Accent (replaces maroon) */
    --ventura-primary: #06b6d4;
    --ventura-primary-light: #22d3ee;
    --ventura-primary-dark: #0891b2;

    /* Alerts */
    --alert-bg: rgba(6,182,212,0.08);
    --alert-border: rgba(6,182,212,0.22);
    --alert-text: #67e8f9;
}


/* ═══════════════════════════════════════════════════════════════
   2. Body background gradient
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    background-attachment: fixed !important;
}


/* ═══════════════════════════════════════════════════════════════
   3. Typography — system font stack replaces M730
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

html.slate-theme[data-bs-theme="dark"] .ventura-heading,
html.slate-theme[data-bs-theme="dark"] .dashboard-heading,
html.slate-theme[data-bs-theme="dark"] .m730-link-font,
html.slate-theme[data-bs-theme="dark"] .navbar-brand {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

html.slate-theme[data-bs-theme="dark"] .dashboard-heading {
    color: #06b6d4 !important;
    font-weight: 700;
    letter-spacing: 0;
}

html.slate-theme[data-bs-theme="dark"] .navbar-brand.ventura-heading {
    color: #06b6d4 !important;
    font-weight: 700;
}

html.slate-theme[data-bs-theme="dark"] h1,
html.slate-theme[data-bs-theme="dark"] h2,
html.slate-theme[data-bs-theme="dark"] h3,
html.slate-theme[data-bs-theme="dark"] h4,
html.slate-theme[data-bs-theme="dark"] h5,
html.slate-theme[data-bs-theme="dark"] h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}


/* ═══════════════════════════════════════════════════════════════
   4. Cards — translucent surface with cyan-tinted border
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .card {
    background-color: rgba(15,23,42,0.7) !important;
    border: 1px solid rgba(6,182,212,0.15) !important;
    border-radius: 9px !important;
}

html.slate-theme[data-bs-theme="dark"] .card-header {
    background-color: rgba(6,182,212,0.04) !important;
    border-bottom: 1px solid rgba(6,182,212,0.1) !important;
}

html.slate-theme[data-bs-theme="dark"] .card-header h5,
html.slate-theme[data-bs-theme="dark"] .card-header h6,
html.slate-theme[data-bs-theme="dark"] .card-header .mb-0 {
    color: #06b6d4 !important;
    font-weight: 700;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}


/* ═══════════════════════════════════════════════════════════════
   5. Tables — dark surface, cyan-tinted headers
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(6,182,212,0.06);
    --bs-table-border-color: rgba(255,255,255,0.04);
    color: #e2e8f0 !important;
}

html.slate-theme[data-bs-theme="dark"] .table thead th {
    font-size: 0.72em !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    border-bottom: 1px solid rgba(6,182,212,0.15) !important;
    padding: 10px 14px !important;
}

html.slate-theme[data-bs-theme="dark"] .table-light,
html.slate-theme[data-bs-theme="dark"] .table thead.table-light {
    --bs-table-bg: transparent !important;
    background-color: transparent !important;
}

html.slate-theme[data-bs-theme="dark"] .table td {
    border-bottom-color: rgba(255,255,255,0.04) !important;
    color: #cbd5e1 !important;
    font-size: 0.88em;
}

html.slate-theme[data-bs-theme="dark"] .table td .fw-medium,
html.slate-theme[data-bs-theme="dark"] .table td .fw-semibold {
    color: #e2e8f0 !important;
}


/* ═══════════════════════════════════════════════════════════════
   6. Category group rows (Maintenance accordion headers)
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .category-group-cell {
    background-color: rgba(6,182,212,0.04) !important;
    border-bottom: 1px solid rgba(6,182,212,0.1) !important;
}

html.slate-theme[data-bs-theme="dark"] .category-group-cell .category-name {
    color: #06b6d4 !important;
}


/* ═══════════════════════════════════════════════════════════════
   7. Buttons — framed (outline) style; no solid fills
   Primary actions sit between Bootstrap's default .btn and .btn-sm.
   ═══════════════════════════════════════════════════════════════ */

/* Mid-size for default (non-sm) action buttons — between Save-chunky and Upload-sm */
html.slate-theme[data-bs-theme="dark"] .btn:not(.btn-sm):not(.btn-lg) {
    padding: 0.3rem 0.7rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

html.slate-theme[data-bs-theme="dark"] .btn-primary,
html.slate-theme[data-bs-theme="dark"] .btn-outline-primary {
    background-color: transparent !important;
    border: 1px solid rgba(6,182,212,0.45) !important;
    color: #06b6d4 !important;
    font-weight: 600;
}

html.slate-theme[data-bs-theme="dark"] .btn-primary:hover,
html.slate-theme[data-bs-theme="dark"] .btn-primary:focus,
html.slate-theme[data-bs-theme="dark"] .btn-outline-primary:hover,
html.slate-theme[data-bs-theme="dark"] .btn-outline-primary:focus {
    background-color: rgba(6,182,212,0.12) !important;
    border-color: rgba(6,182,212,0.65) !important;
    color: #22d3ee !important;
}

/* Primary gets a slightly stronger border so Save still reads as the main action */
html.slate-theme[data-bs-theme="dark"] .btn-primary {
    border-color: rgba(6,182,212,0.55) !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-outline-secondary,
html.slate-theme[data-bs-theme="dark"] .btn-secondary {
    background-color: transparent !important;
    border: 1px solid rgba(6,182,212,0.25) !important;
    color: #94a3b8 !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-outline-secondary:hover,
html.slate-theme[data-bs-theme="dark"] .btn-secondary:hover {
    color: #cbd5e1 !important;
    background-color: rgba(6,182,212,0.06) !important;
    border-color: rgba(6,182,212,0.4) !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-success,
html.slate-theme[data-bs-theme="dark"] .btn-outline-success {
    background-color: transparent !important;
    border: 1px solid rgba(16,185,129,0.45) !important;
    color: #10b981 !important;
    font-weight: 600;
}

html.slate-theme[data-bs-theme="dark"] .btn-success:hover,
html.slate-theme[data-bs-theme="dark"] .btn-success:focus,
html.slate-theme[data-bs-theme="dark"] .btn-outline-success:hover,
html.slate-theme[data-bs-theme="dark"] .btn-outline-success:focus {
    background-color: rgba(16,185,129,0.12) !important;
    border-color: rgba(16,185,129,0.65) !important;
    color: #34d399 !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-outline-danger,
html.slate-theme[data-bs-theme="dark"] .btn-danger {
    background-color: transparent !important;
    border: 1px solid rgba(239,68,68,0.4) !important;
    color: #ef4444 !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-outline-danger:hover,
html.slate-theme[data-bs-theme="dark"] .btn-danger:hover {
    background-color: rgba(239,68,68,0.12) !important;
    color: #f87171 !important;
    border-color: rgba(239,68,68,0.6) !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-info,
html.slate-theme[data-bs-theme="dark"] .btn-outline-info {
    background-color: transparent !important;
    border: 1px solid rgba(59,130,246,0.45) !important;
    color: #60a5fa !important;
    font-weight: 600;
}

html.slate-theme[data-bs-theme="dark"] .btn-info:hover,
html.slate-theme[data-bs-theme="dark"] .btn-info:focus,
html.slate-theme[data-bs-theme="dark"] .btn-outline-info:hover,
html.slate-theme[data-bs-theme="dark"] .btn-outline-info:focus {
    background-color: rgba(59,130,246,0.12) !important;
    border-color: rgba(59,130,246,0.65) !important;
    color: #93c5fd !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-warning,
html.slate-theme[data-bs-theme="dark"] .btn-outline-warning {
    background-color: transparent !important;
    border: 1px solid rgba(245,158,11,0.45) !important;
    color: #f59e0b !important;
    font-weight: 600;
}

html.slate-theme[data-bs-theme="dark"] .btn-warning:hover,
html.slate-theme[data-bs-theme="dark"] .btn-warning:focus,
html.slate-theme[data-bs-theme="dark"] .btn-outline-warning:hover,
html.slate-theme[data-bs-theme="dark"] .btn-outline-warning:focus {
    background-color: rgba(245,158,11,0.12) !important;
    border-color: rgba(245,158,11,0.65) !important;
    color: #fbbf24 !important;
}

html.slate-theme[data-bs-theme="dark"] .btn-dark,
html.slate-theme[data-bs-theme="dark"] .btn-outline-dark {
    background-color: transparent !important;
    border: 1px solid rgba(148,163,184,0.4) !important;
    color: #cbd5e1 !important;
    font-weight: 600;
}

html.slate-theme[data-bs-theme="dark"] .btn-dark:hover,
html.slate-theme[data-bs-theme="dark"] .btn-dark:focus,
html.slate-theme[data-bs-theme="dark"] .btn-outline-dark:hover,
html.slate-theme[data-bs-theme="dark"] .btn-outline-dark:focus {
    background-color: rgba(148,163,184,0.12) !important;
    border-color: rgba(148,163,184,0.6) !important;
    color: #e2e8f0 !important;
}


/* ═══════════════════════════════════════════════════════════════
   8. Badges — tinted backgrounds instead of solid fills
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .badge.bg-primary {
    background-color: rgba(6,182,212,0.14) !important;
    color: #06b6d4 !important;
    border: 1px solid rgba(6,182,212,0.22);
    font-weight: 700;
}

html.slate-theme[data-bs-theme="dark"] .badge.bg-success {
    background-color: rgba(16,185,129,0.14) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16,185,129,0.22);
}

html.slate-theme[data-bs-theme="dark"] .badge.bg-warning {
    background-color: rgba(245,158,11,0.14) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245,158,11,0.22);
}

html.slate-theme[data-bs-theme="dark"] .badge.bg-danger {
    background-color: rgba(239,68,68,0.14) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239,68,68,0.22);
}

html.slate-theme[data-bs-theme="dark"] .badge.bg-info {
    background-color: rgba(59,130,246,0.14) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59,130,246,0.22);
}

html.slate-theme[data-bs-theme="dark"] .badge.bg-secondary {
    background-color: rgba(71,85,105,0.2) !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(71,85,105,0.2);
}

html.slate-theme[data-bs-theme="dark"] .badge.bg-dark {
    background-color: rgba(239,68,68,0.14) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239,68,68,0.22);
}


/* ═══════════════════════════════════════════════════════════════
   9. Form controls — dark surfaces, subtle borders
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .form-control,
html.slate-theme[data-bs-theme="dark"] .form-select {
    background-color: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(6,182,212,0.15) !important;
    color: #e2e8f0 !important;
    border-radius: 6px;
}

html.slate-theme[data-bs-theme="dark"] .form-control:focus,
html.slate-theme[data-bs-theme="dark"] .form-select:focus {
    border-color: rgba(6,182,212,0.4) !important;
    box-shadow: 0 0 0 2px rgba(6,182,212,0.1) !important;
    background-color: rgba(255,255,255,0.06) !important;
}

html.slate-theme[data-bs-theme="dark"] .form-control::placeholder {
    color: #475569 !important;
}

html.slate-theme[data-bs-theme="dark"] .form-label,
html.slate-theme[data-bs-theme="dark"] .control-label {
    color: #94a3b8 !important;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

html.slate-theme[data-bs-theme="dark"] .form-text {
    color: #475569 !important;
}

html.slate-theme[data-bs-theme="dark"] .input-group-text {
    background-color: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(6,182,212,0.15) !important;
    color: #94a3b8 !important;
}


/* ═══════════════════════════════════════════════════════════════
   10. Navbar — dark slate with cyan accent
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .navbar {
    background-color: rgba(7,13,27,0.92) !important;
    border-bottom: 1px solid rgba(6,182,212,0.1) !important;
}

html.slate-theme[data-bs-theme="dark"] .navbar .nav-link,
html.slate-theme[data-bs-theme="dark"] .navbar .custom-nav-link {
    color: #475569 !important;
    font-weight: 500;
}

html.slate-theme[data-bs-theme="dark"] .navbar .nav-link:hover,
html.slate-theme[data-bs-theme="dark"] .navbar .custom-nav-link:hover {
    color: #cbd5e1 !important;
}

html.slate-theme[data-bs-theme="dark"] .navbar .nav-link.active {
    color: #06b6d4 !important;
}

html.slate-theme[data-bs-theme="dark"] .navbar-brand {
    color: #06b6d4 !important;
}

html.slate-theme[data-bs-theme="dark"] .navbar .text-primary {
    color: #06b6d4 !important;
}


/* ═══════════════════════════════════════════════════════════════
   11. Alerts — tinted backgrounds
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .alert-info {
    background-color: rgba(6,182,212,0.08) !important;
    border-color: rgba(6,182,212,0.22) !important;
    color: #67e8f9 !important;
}

html.slate-theme[data-bs-theme="dark"] .alert-success {
    background-color: rgba(16,185,129,0.08) !important;
    border-color: rgba(16,185,129,0.22) !important;
    color: #34d399 !important;
}

html.slate-theme[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(245,158,11,0.08) !important;
    border-color: rgba(245,158,11,0.22) !important;
    color: #fbbf24 !important;
}

html.slate-theme[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(239,68,68,0.08) !important;
    border-color: rgba(239,68,68,0.22) !important;
    color: #f87171 !important;
}


/* ═══════════════════════════════════════════════════════════════
   12. Mobile bottom nav — match navbar surface
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .mobile-bottom-nav {
    background-color: rgba(7,13,27,0.92) !important;
    border-top-color: rgba(6,182,212,0.1) !important;
}

/* Direct-link tabs (Dashboard, Contacts) are <a> and would otherwise pick up the
   global cyan link colour; expanding tabs are <button>s. Keep every tab the same. */
html.slate-theme[data-bs-theme="dark"] .mobile-bottom-nav__item,
html.slate-theme[data-bs-theme="dark"] a.mobile-bottom-nav__item {
    color: #e2e8f0 !important;
}

html.slate-theme[data-bs-theme="dark"] .mobile-bottom-nav__item:hover,
html.slate-theme[data-bs-theme="dark"] .mobile-bottom-nav__item:focus,
html.slate-theme[data-bs-theme="dark"] a.mobile-bottom-nav__item:hover,
html.slate-theme[data-bs-theme="dark"] a.mobile-bottom-nav__item:focus {
    color: #ffffff !important;
}

html.slate-theme[data-bs-theme="dark"] .mobile-bottom-nav__item.is-active,
html.slate-theme[data-bs-theme="dark"] a.mobile-bottom-nav__item.is-active {
    color: #ffffff !important;
    font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════
   13. Dropdown menus
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b !important;
    border: 1px solid rgba(6,182,212,0.15) !important;
}

html.slate-theme[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

html.slate-theme[data-bs-theme="dark"] .dropdown-item:hover,
html.slate-theme[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(6,182,212,0.08) !important;
    color: #e2e8f0 !important;
}

html.slate-theme[data-bs-theme="dark"] .dropdown-divider {
    border-color: rgba(255,255,255,0.05) !important;
}


/* ═══════════════════════════════════════════════════════════════
   14. Footer
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] footer,
html.slate-theme[data-bs-theme="dark"] .border-top {
    border-color: rgba(6,182,212,0.1) !important;
}


/* ═══════════════════════════════════════════════════════════════
   15. Bottom sheets (offcanvas)
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .nav-sheet {
    background-color: #0f172a !important;
}

html.slate-theme[data-bs-theme="dark"] .nav-sheet__link {
    border-bottom-color: rgba(255,255,255,0.04) !important;
}

html.slate-theme[data-bs-theme="dark"] .nav-sheet__link:hover {
    background-color: rgba(6,182,212,0.06) !important;
}

html.slate-theme[data-bs-theme="dark"] .nav-sheet__link.is-current {
    color: #06b6d4 !important;
}


/* ═══════════════════════════════════════════════════════════════
   16. Scrollbar
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

html.slate-theme[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: transparent;
}

html.slate-theme[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(6,182,212,0.2);
    border-radius: 3px;
}

html.slate-theme[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(6,182,212,0.35);
}


/* ═══════════════════════════════════════════════════════════════
   17. Misc text helpers used throughout the app
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

html.slate-theme[data-bs-theme="dark"] .text-primary {
    color: #06b6d4 !important;
}

html.slate-theme[data-bs-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

html.slate-theme[data-bs-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

html.slate-theme[data-bs-theme="dark"] a {
    color: #06b6d4;
}

html.slate-theme[data-bs-theme="dark"] a:hover {
    color: #22d3ee;
}

html.slate-theme[data-bs-theme="dark"] hr {
    border-color: rgba(6,182,212,0.1) !important;
    opacity: 1;
}

/* Shadow removal — the dashboard is flat */
html.slate-theme[data-bs-theme="dark"] .shadow-sm,
html.slate-theme[data-bs-theme="dark"] .shadow {
    box-shadow: none !important;
}


/* ═══════════════════════════════════════════════════════════════
   18. List-group items (used in offcanvas sheets and some panels)
   ═══════════════════════════════════════════════════════════════ */

html.slate-theme[data-bs-theme="dark"] .list-group-item {
    background-color: transparent !important;
    border-color: rgba(255,255,255,0.04) !important;
    color: #cbd5e1 !important;
}
