/* ══════════════════════════════════════════════════════════════════
   AGNP TICKETING — DESIGN SYSTEM
   ══════════════════════════════════════════════════════════════════ */
:root {
    --brand-navy-900: #0a1626;
    --brand-navy-800: #0d1b2a;
    --brand-navy-700: #1b263b;
    --brand-navy-600: #22334d;
    --brand-cyan: #00b4d8;
    --brand-cyan-hover: #0096b8;
    --brand-cyan-soft: rgba(0, 180, 216, 0.12);
    --brand-gold: #d4a017;
    --brand-gold-hover: #b8890f;
    --brand-gold-soft: rgba(212, 160, 23, 0.12);
    --brand-success: #198754;
    --brand-danger: #dc3545;
    --brand-warning: #ffc107;
    --brand-purple: #6f42c1;

    --ink-900: #111827;
    --ink-700: #374151;
    --ink-500: #6b7280;
    --ink-300: #d1d5db;
    --ink-100: #f3f4f6;

    --surface: #ffffff;
    --surface-2: #f8fafc;
    --page-grad: linear-gradient(135deg, #eef2f7 0%, #dde5ef 55%, #d3dce8 100%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 2px 8px rgba(16, 24, 40, .07);
    --shadow-md: 0 6px 18px rgba(16, 24, 40, .10);
    --shadow-lg: 0 14px 34px rgba(16, 24, 40, .16);

    --focus-ring: 0 0 0 3px rgba(0, 180, 216, .22);
}

body {
    background: var(--page-grad);
    background-attachment: fixed;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink-900);
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    /* Colour follows Settings → Side Panel — Logo & Colour. base.html sets
       --sb-from / --sb-to / --sb-accent on this element; the brand navy is the
       fallback when no theme has been chosen. */
    background: linear-gradient(180deg,
                var(--sb-from, var(--brand-navy-900)) 0%,
                var(--sb-to, var(--brand-navy-700)) 100%);
    color: #f8f9fa;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 1040;
    box-shadow: 4px 0 20px rgba(10, 22, 38, 0.35);
    overflow: hidden;
    transition: width .2s ease;
}

.sidebar-header {
    padding: 16px 14px 14px;
    background: rgba(255,255,255,0.03);
    border-bottom: 2px solid var(--sb-accent, var(--brand-gold));
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    color: #f8f9fa; text-decoration: none;
    font-weight: 700; font-size: 1.05rem; letter-spacing: .5px;
}
.sidebar-brand:hover { color: var(--brand-cyan); }
.sidebar-brand i { font-size: 1.4rem; color: var(--brand-gold); }
.sidebar-brand img { border-radius: 6px; }

/* Company logo at the top of the side panel.
   Stacked like a lobby sign: the logo fills the panel width, the PH time card
   sits below it. It is changed in Settings → Side Panel (no camera icon). */
.sidebar-brand-stack {
    display: flex; flex-direction: column; align-items: center;
    position: relative;
}
.sidebar-brand { justify-content: center; width: 100%; }
.sidebar-logo-img {
    /* Fitted, not boxed: fills the panel width, never taller than 112px, and
       keeps its own aspect ratio (object-fit: contain handles wide banners and
       square crests alike). */
    display: block;
    width: 100%;
    max-width: 190px;
    height: auto;
    max-height: 112px;
    margin: 0 auto;
    object-fit: contain;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    filter: drop-shadow(0 8px 18px rgba(3, 9, 18, 0.45));
}
/* Let the PH badge sink onto the sidebar so the colours blend, and keep the
   time card aligned with the logo edges. */
.sidebar-brand-stack .ph-time-card { width: 100%; }

/* ── Philippine time card (sample: dark rounded card, label, big time, date) */
.ph-time-card {
    display: flex; flex-direction: column; align-items: center;
    width: calc(100% - 20px); margin: 10px auto 0;
    padding: 8px 10px 9px;
    border-radius: 14px;
    background: linear-gradient(160deg, #33415a 0%, #22304a 100%);
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 4px 14px rgba(6, 14, 26, 0.45);
    line-height: 1.25;
    user-select: none;
}
.ph-time-zone {
    align-self: flex-start;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 1px;
    color: #0d1b2a; background: #ffc95c;
    padding: 1px 6px; border-radius: 6px; margin-bottom: 2px;
}
.ph-time-label {
    font-size: 0.8rem; font-weight: 700; letter-spacing: .3px;
    color: #f3f6fb;
}
.ph-time-value {
    font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: #ffffff; letter-spacing: .5px;
}
.ph-time-date {
    font-size: 0.72rem; font-weight: 600; color: rgba(255,255,255,0.82);
}
/* The old dashed camera button that sat under the logo is gone — the logo is
   uploaded from Settings → Company Logo (Side Panel Top). */

/* ── Settings → Side Panel Colour: palette chooser cards ────────────────
   Each option previews its own gradient plus the accent rule that appears
   under the sidebar header, so the choice is obvious before saving. */
.sidebar-theme-option {
    display: flex; align-items: flex-start; gap: 9px;
    width: 100%; padding: 10px; background: #fff;
    border: 1px solid var(--ink-300); border-radius: 10px; cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.sidebar-theme-option:hover { border-color: var(--brand-cyan); }
.sidebar-theme-option.active { border-color: var(--brand-cyan); box-shadow: var(--focus-ring); }
.sidebar-theme-swatch {
    position: relative; display: block;
    width: 46px; min-width: 46px; height: 46px;
    border-radius: 9px; border: 1px solid rgba(0,0,0,.18);
}
.sidebar-theme-swatch::after {
    content: ""; position: absolute; left: 6px; right: 6px; bottom: 6px; height: 3px;
    border-radius: 2px; background: var(--sw-accent, #d4a017);
}
.sidebar-theme-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-theme-text strong { font-size: .84rem; }
.sidebar-theme-text small { font-size: .72rem; }

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 10px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.45); }

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    margin: 2px 10px;
    padding: 9px 12px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    transition: all 0.18s ease;
    border-left: 3px solid transparent;
}
.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.09);
    border-left-color: var(--sb-accent, var(--brand-gold));
    transform: translateX(2px);
}
.sidebar-link.active {
    color: #fff;
    /* Neutral highlight so the active tab reads well on every palette. */
    background: linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05));
    border-left-color: var(--sb-accent, var(--brand-gold));
    font-weight: 600;
    box-shadow: inset 3px 0 8px rgba(255,255,255,0.10);
}
.sidebar-link i { font-size: 1rem; width: 18px; min-width: 18px; text-align: center; }
.sidebar-link .badge { font-size: 0.68rem; padding: 0.32em 0.55em; }

.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
    margin: 8px 18px;
}

.sidebar-scroll-indicator {
    position: sticky; bottom: 0; left: 0; right: 0;
    height: 42px;
    background: linear-gradient(transparent, var(--sb-to, rgba(10,22,38,0.98)));
    display: flex; align-items: center; justify-content: center;
    padding: 8px; opacity: 0;
    transition: opacity .3s ease; cursor: pointer; z-index: 10;
}
.sidebar-scroll-indicator.visible { opacity: 1; }
.sidebar-scroll-indicator i { color: var(--sb-accent, var(--brand-cyan)); font-size: 1.35rem; animation: scrollBounce 1.2s ease-in-out infinite; }
.sidebar-scroll-indicator:hover i { color: #fff; }
@keyframes scrollBounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(5px);} }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 2px solid var(--sb-accent, var(--brand-gold));
    background: rgba(255,255,255,0.03);
}
.sidebar-user {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 4px 10px;
    font-size: 0.83rem; color: rgba(255,255,255,0.75);
    border-bottom: 1px dashed rgba(255,255,255,0.12);
    margin-bottom: 8px;
}
.sidebar-user i { color: var(--sb-accent, var(--brand-gold)); }
.sidebar-footer .sidebar-link { margin: 0; padding: 7px 8px; }

/* ══════════════════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════════════════ */
.app-main {
    flex: 1;
    margin-left: 250px;
    min-width: 0;
    padding: 24px 28px 70px;
    min-height: 100vh;
    animation: pageIn .25s ease;
}
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.app-layout:not(:has(.app-sidebar)) .app-main { margin-left: 0; padding: 20px 28px 60px; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE / MOBILE
   ══════════════════════════════════════════════════════════════ */

/* Mobile top bar (shown ≤ 991px) */
.mobile-topbar {
    display: none;
}

@media (max-width: 991px) {
    .mobile-topbar {
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 1050;
        height: 56px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        background: linear-gradient(90deg, #0d1b2a, #1b263b);
        color: #f8f9fa;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    .mobile-burger {
        background: transparent;
        border: none;
        color: #f8f9fa;
        font-size: 1.6rem;
        line-height: 1;
        padding: 6px 8px;
        border-radius: 8px;
    }
    .mobile-burger:active { background: rgba(255,255,255,0.12); }
    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #f8f9fa;
        text-decoration: none;
        font-weight: 700;
        letter-spacing: .5px;
    }
    .mobile-brand img {
        width: 32px; height: 32px;
        object-fit: contain;
        border-radius: 8px;
        background: rgba(255,255,255,0.08);
        padding: 2px;
    }
    .mobile-bell {
        margin-left: auto;
        color: #f8f9fa;
        font-size: 1.25rem;
        text-decoration: none;
        padding: 6px;
    }

    /* Off-canvas sidebar.
       z-index 1055 keeps the panel ABOVE the backdrop (1045) — otherwise the
       backdrop covers the whole screen including the menu and every tap hits
       the backdrop instead of the links (the "sidebar not clickable" bug). */
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: 270px;
        min-width: 270px;
        box-shadow: none;
        z-index: 1055;
        height: 100vh;
        height: 100dvh;   /* follow mobile browser URL-bar collapse */
    }
    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: 6px 0 24px rgba(10, 22, 38, 0.45);
    }
    /* Smaller brand + time card on phones so the menu opens on the links */
    .sidebar-logo-img { max-width: 150px; max-height: 84px; }
    .ph-time-card { margin-top: 6px; padding: 6px 8px 7px; }
    .ph-time-value { font-size: 1.12rem; }
    /* Lock the page behind the open menu */
    body.sidebar-open { overflow: hidden; }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1045;
        background: rgba(10, 22, 38, 0.55);
        backdrop-filter: blur(1px);
    }
    .app-main {
        margin-left: 0 !important;
        padding: calc(56px + 14px) 14px calc(56px + 14px);
    }
    body { padding-top: 0; }
}

/* Phones */
@media (max-width: 576px) {
    .app-main { padding: calc(56px + 10px) 10px calc(56px + 10px); }
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.08rem; }
    .card-body { padding: 0.85rem; }
    .btn { font-size: 0.95rem; }
    .btn-sm { font-size: 0.8rem; }
    /* Tables: horizontal scroll keeps layout intact */
    .table-responsive { margin-bottom: 0; }
    .table th, .table td { white-space: normal; }
    /* Status/quick filter bars wrap instead of overflowing */
    .d-flex.flex-wrap { row-gap: .5rem; }
    /* Modals: full-width sheets near the bottom for thumb reach */
    .modal-dialog { margin: 0.5rem; }
}

/* Very small phones (≤ 360px) */
@media (max-width: 360px) {
    .app-main { padding-left: 6px; padding-right: 6px; }
    .fc-clock { font-size: 1.9rem; }
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1.05rem; }
}

/* Touch devices: bigger hit targets, no hover-dependent UI */
@media (hover: none) and (pointer: coarse) {
    .sidebar-link { padding: 12px 10px; }
    .btn { min-height: 40px; }
    .form-control, .form-select { min-height: 42px; }
    .form-control, .form-select, .btn { font-size: 16px; }  /* prevents iOS zoom-on-focus */
}

/* Sidebar links: comfortable tap targets + no tap delay/highlight on mobile */
.sidebar-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-nav { overscroll-behavior: contain; }   /* don't chain-scroll the page */

/* Close (✕) button inside the sidebar — mobile only */
.sidebar-header { position: relative; }
.sidebar-close {
    position: absolute;
    top: 14px; right: 12px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.25rem;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 8px;
    display: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-close:active { background: rgba(255,255,255,0.12); }
@media (max-width: 991px) {
    .sidebar-close { display: block; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .app-main { animation: none; }
    .app-sidebar { transition: none; }
}

/* ═════════════════════════════════════════════════════════════
   PWA / INSTALLED APP (mobile)
   ═════════════════════════════════════════════════════════════ */

/* Standalone (installed) mode: respect the notch/home-indicator so the
   mobile top bar and footer are never overlapped by system UI. */
@media (display-mode: standalone), (display-mode: fullscreen),
       (display-mode: minimal-ui) {
    .mobile-topbar {
        padding-top: env(safe-area-inset-top);
        height: calc(56px + env(safe-area-inset-top));
    }
    .app-main {
        padding-top: calc(56px + env(safe-area-inset-top) + 14px);
        padding-bottom: calc(56px + env(safe-area-inset-bottom) + 10px);
    }
    footer.app-footer {
        padding-bottom: max(7px, env(safe-area-inset-bottom));
    }
}

/* Offline fallback page (service worker navigations) */
.offline-card { max-width: 480px; }
.offline-icon {
    width: 84px; height: 84px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-cyan-soft);
    color: var(--brand-navy-700);
    font-size: 2.4rem;
}

/* Manage Branches — company group headers */
.branch-company-group {
    border: 1px solid var(--ink-100);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
}
.branch-company-header {
    background: linear-gradient(90deg, var(--brand-navy-800), var(--brand-navy-700));
    color: #f8f9fa;
    font-size: .88rem;
    letter-spacing: .3px;
}
.branch-company-header i { color: var(--brand-gold); }
.branch-company-group .list-group-item { border-radius: 0; border-left: none; border-right: none; }
.branch-company-group .list-group-item:last-child { border-bottom: none; }

/* ═════════════════════════════════════════════════════════════
   TICKET DETAIL — RESPONSIVE POLISH (phones & small tablets)
   ═════════════════════════════════════════════════════════════ */

/* Keep long ticket IDs, names and timestamps from stretching phones */
.card-body p, .card-body .alert, .history-change, .history-meta {
    overflow-wrap: anywhere;
}

@media (max-width: 576px) {
    /* Badge rows wrap neatly instead of overflowing the card */
    .card-body .badge { margin-bottom: .25rem; }

    /* The Assign / Concern / SLA / upload forms stack full-width */
    .card-body form .col-auto,
    .card-body form .col-md-auto { width: 100%; }
    .card-body form .col-auto .btn,
    .card-body form .col-md-auto .btn { width: 100%; }

    /* Attachment rows: action buttons drop under the file name */
    .card-body ul .float-end {
        float: none !important;
        display: inline-block;
        margin-top: .35rem;
    }

    /* Back button row: keep it a comfortable tap target */
    .mb-2 .btn-outline-secondary { min-height: 40px; }
}

/* Print: hide chrome */
@media print {
    .app-sidebar, .mobile-topbar, .sidebar-backdrop, footer.app-footer { display: none !important; }
    .app-main { margin: 0 !important; padding: 0 !important; }
}

/* ══════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════════════════════════════════ */
h1 { font-size: 1.7rem; font-weight: 700; color: var(--ink-900); }
h2 { font-size: 1.45rem; font-weight: 700; color: var(--ink-900); }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }

.text-muted { color: var(--ink-500) !important; }

/* ══════════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════════ */
.card {
    border: 1px solid rgba(16,24,40,0.06);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
    background: var(--surface);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    border-bottom: 1px solid var(--ink-100);
    font-weight: 600;
    background: var(--surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    padding: .8rem 1rem;
}
.card-body { padding: 1rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--ink-100); }

/* ══════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════ */
.table { font-size: 0.87rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: .6px;
    color: #e2e8f0;
    background: linear-gradient(180deg, var(--brand-navy-800), var(--brand-navy-700));
    border-bottom: none;
    white-space: nowrap;
}
.table-light thead th, thead.table-light th {
    color: var(--ink-700);
    background: var(--ink-100);
}
.table-hover > tbody > tr:hover > * { background: var(--brand-cyan-soft); }
.table td { vertical-align: middle; }

/* ══════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════ */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all .18s ease;
    letter-spacing: .1px;
}
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn-sm { font-size: 0.8rem; border-radius: 7px; padding: .3rem .65rem; }

.btn-primary {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    border: none;
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: linear-gradient(135deg, #0b5ed7, #0a4fac); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-success {
    background: linear-gradient(135deg, #198754, #146c43);
    border: none;
}
.btn-success:hover { background: linear-gradient(135deg, #157347, #115c39); transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #b02a37);
    border: none;
}
.btn-danger:hover { background: linear-gradient(135deg, #bb2d3b, #9c2530); transform: translateY(-1px); }

.btn-dark {
    background: linear-gradient(135deg, var(--brand-navy-800), var(--brand-navy-600));
    border: none;
}
.btn-dark:hover { background: linear-gradient(135deg, var(--brand-navy-900), var(--brand-navy-700)); transform: translateY(-1px); }

.btn-gold {
    background: linear-gradient(135deg, var(--brand-gold), var(--brand-gold-hover));
    border: none; color: #fff;
}
.btn-gold:hover { background: linear-gradient(135deg, var(--brand-gold-hover), #9a760d); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-outline-secondary:hover, .btn-outline-primary:hover,
.btn-outline-success:hover, .btn-outline-danger:hover,
.btn-outline-warning:hover, .btn-outline-info:hover { transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════ */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--ink-300);
    font-size: 0.88rem;
    color: var(--ink-900);
    background-color: var(--surface);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-cyan);
    box-shadow: var(--focus-ring);
}
.form-control::placeholder { color: #9ca3af; }
.form-label { font-weight: 600; font-size: 0.83rem; color: var(--ink-700); margin-bottom: .3rem; }
.form-text { font-size: 0.78rem; color: var(--ink-500); }
.input-group-text { background: var(--ink-100); border-color: var(--ink-300); font-size: .85rem; }

/* ══════════════════════════════════════════════════════════════════
   BADGES · ALERTS · TABS · MODALS
   ══════════════════════════════════════════════════════════════════ */
.badge { font-weight: 600; letter-spacing: .3px; padding: .38em .6em; border-radius: 6px; }
.rounded-pill.badge { padding-inline: .7em; }

.alert { border-radius: var(--radius-md); font-size: 0.88rem; border: none; box-shadow: var(--shadow-xs); }
.alert-success { background: #e8f6ee; color: #146c43; }
.alert-danger  { background: #fdecee; color: #b02a37; }
.alert-warning { background: #fff7dc; color: #8a6d00; }
.alert-info    { background: #e3f5fb; color: #056a86; }

.nav-tabs { border-bottom: 2px solid var(--ink-100); gap: 4px; }
.nav-tabs .nav-link {
    font-weight: 500; font-size: 0.88rem;
    border: none; border-bottom: 2px solid transparent;
    color: var(--ink-500); border-radius: 0;
    margin-bottom: -2px; padding: .55rem 1rem;
}
.nav-tabs .nav-link:hover { color: var(--brand-navy-700); border-bottom-color: var(--ink-300); }
.nav-tabs .nav-link.active { color: var(--brand-navy-800); font-weight: 600; border-bottom-color: var(--brand-cyan); background: transparent; }

.nav-pills .nav-link { border-radius: var(--radius-sm); font-size: .86rem; font-weight: 500; color: var(--ink-700); }
.nav-pills .nav-link.active { background: var(--brand-navy-800); }

.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--ink-100); }
.modal-footer { border-top: 1px solid var(--ink-100); }
.modal-backdrop.show { opacity: .45; }

.list-group-item { font-size: 0.88rem; border-color: var(--ink-100); }
.list-group-item:first-child { border-top: none; }

.dropdown-menu { border: none; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.dropdown-item { font-size: .87rem; padding: .5rem 1rem; }
.dropdown-item:active { background: var(--brand-navy-800); }

/* ══════════════════════════════════════════════════════════════════
   PAGE HEADERS
   ══════════════════════════════════════════════════════════════════ */
.app-main h2 i, .app-main h1 i { color: var(--brand-cyan); }
.app-main h2 { display: flex; align-items: center; }

/* ══════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════════ */
.login-wrap {
    max-width: 400px;
    margin: 8vh auto 0;
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.login-brand {
    background: linear-gradient(135deg, var(--brand-navy-900), var(--brand-navy-700));
    color: #fff; text-align: center; padding: 26px 20px 22px;
    border-bottom: 3px solid var(--brand-gold);
}
.login-logo {
    width: 80px; height: 80px; object-fit: contain; border-radius: 50%;
    background: rgba(255,255,255,0.84); padding: 8px; margin-bottom: 10px;
    border: 2px solid rgba(212, 160, 23, 0.45);
    animation: logoGlowPulse 4s ease-in-out infinite;
}
@keyframes logoGlowPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        border-color: rgba(212, 160, 23, 0.35);
        box-shadow: 0 0 8px rgba(212, 160, 23, 0.15);
    }
    50% {
        transform: scale(1.06) rotate(4deg);
        border-color: rgba(0, 180, 216, 0.55);
        box-shadow: 0 0 18px rgba(0, 180, 216, 0.25), 0 0 6px rgba(212, 160, 23, 0.20);
    }
}
.login-brand i { font-size: 2.2rem; color: var(--brand-cyan); display: block; margin-bottom: 8px; }
.login-brand h1 { color: #fff; font-size: 1.25rem; margin: 0; letter-spacing: .4px; }
.login-brand p { color: rgba(255,255,255,.65); font-size: .8rem; margin: 4px 0 0; }
.login-body { padding: 26px 26px 24px; }
.login-body .form-control { padding: .6rem .8rem; }
.login-body .btn { padding: .65rem; font-weight: 600; letter-spacing: .3px; }

/* ══════════════════════════════════════════════════════════════════
   KANBAN TICKET BOARD
   ══════════════════════════════════════════════════════════════════ */
.ticket-card {
    border-radius: var(--radius-sm) !important;
    transition: transform .15s ease, box-shadow .15s ease !important;
}
.ticket-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }
.ticket-card .badge { font-size: .66rem; }

/* ══════════════════════════════════════════════════════════════════
   TIMELINE (unchanged classes, refined)
   ══════════════════════════════════════════════════════════════════ */
.history-timeline { margin: 0; padding: 4px 0; }
.history-timeline > li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 16px; transition: background-color .15s ease; }
.history-timeline > li:hover { background-color: var(--surface-2); }
.history-timeline > li:not(:last-child) { border-bottom: 1px solid #eef1f4; }
.history-timeline > li.empty { display: block; text-align: center; padding: 28px 16px; color: var(--ink-500); }

.history-dot {
    width: 28px; height: 28px; flex: 0 0 28px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #fff; margin-top: 1px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.history-dot.created     { background-color: var(--brand-success); }
.history-dot.approved    { background-color: var(--brand-purple); }
.history-dot.reassigned  { background-color: #0d6efd; }
.history-dot.updated     { background-color: var(--brand-warning); color: #5c4300; }
.history-dot.replacement { background-color: #fd7e14; }
.history-dot.accepted    { background-color: #0d6efd; }
.history-dot.rated       { background-color: #b8860b; }
.history-dot.notified    { background-color: #6c757d; }

.star-btn { background: none; border: none; font-size: 1.6rem; line-height: 1; padding: 0 2px; cursor: pointer; transition: transform .1s ease; color: #adb5bd; }
.star-btn:hover { transform: scale(1.2); }

.history-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.history-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; line-height: 1.4; }
.history-change .text-decoration-line-through { color: var(--brand-danger); }
.history-change .fw-semibold { color: var(--brand-success); }
.history-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12px; color: var(--ink-500); }
.history-time { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }

/* ══════════════════════════════════════════════════════════════════
   SCROLLBARS (main content)
   ══════════════════════════════════════════════════════════════════ */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c3ccd8; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #9aa7b8; background-clip: content-box; }

/* ══════════════════════════════════════════════════════════════════
   MISC POLISH
   ══════════════════════════════════════════════════════════════════ */
.font-monospace { font-size: .82em; letter-spacing: .2px; }

footer {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(10, 22, 38, 0.92);
    backdrop-filter: blur(6px);
    color: rgba(255,255,255,0.75);
    font-size: 0.75rem;
    text-align: center;
    padding: 7px;
    z-index: 1035;
    border-top: 1px solid rgba(255,255,255,0.08);
}

a { color: #0a6ebd; }
a:hover { color: var(--brand-cyan-hover); }

hr { border-color: var(--ink-100); opacity: 1; }

::selection { background: rgba(0,180,216,.25); }

/* ══════════════════════════════════════════════════════════════════
   DASHBOARD KPI + GOLD ACCENT BADGES
   ══════════════════════════════════════════════════════════════════ */
.kpi-card {
    border-left: 4px solid var(--brand-gold);
    border-radius: var(--radius-sm);
    transition: box-shadow .18s ease, transform .15s ease;
}
.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.kpi-card .list-group-item {
    border-left: none;
    padding: .65rem .9rem;
    font-size: .88rem;
    transition: background .15s ease;
}
.kpi-card .list-group-item:hover {
    background: var(--brand-gold-soft);}
.kpi-card .list-group-item:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.kpi-card .list-group-item:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Gold-themed status badges */
.badge-status-open      { background: var(--brand-danger); color: #fff; }
.badge-status-progress  { background: var(--brand-gold); color: #fff; }
.badge-status-hold      { background: #0dcaf0; color: #000; }
.badge-status-approved  { background: #6f42c1; color: #fff; }
/* Finished tickets: Successful (was "Closed") and its Unsuccessful counterpart.
   badge-status-closed is kept for any un-migrated historical row. */
.badge-status-successful    { background: var(--brand-success); color: #fff; }
.badge-status-unsuccessful  { background: #b02a37; color: #fff; }
.badge-status-closed    { background: var(--brand-success); color: #fff; }

.badge-gold {
    background: linear-gradient(135deg, var(--brand-gold), var(--brand-gold-hover));
    color: #fff;
    border: none;
}

.badge-gold-soft {
    background: var(--brand-gold-soft);
    color: #8a6d00;
    border: 1px solid rgba(212, 160, 23, 0.25);
}
