/* ============================================================================
   TODSS — features.css
   Shared stylesheet for Tier 1 Feature pages.
   Extends / mirrors the design language of style.css (v2.8).
   Link this in every feature page alongside Font Awesome.
   ============================================================================ */

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

/* ── Base ──────────────────────────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    background-attachment: fixed;
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.4); }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.5); }

/* ============================================================================
   PAGE LAYOUT — matches admin.html sidebar + main-content pattern
   ============================================================================ */

.feature-container {
    display: flex;
    min-height: 100vh;
}

/* ── Left Sidebar ───────────────────────────────────────────────────────────── */
.feature-sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(148, 163, 184, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.feature-sidebar::-webkit-scrollbar { width: 4px; }
.feature-sidebar::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); }

/* Sidebar header — brand + feature name */
.sidebar-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #0f172a;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 10px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Feature title inside sidebar header */
.sidebar-feature-title {
    font-size: 13px;
    font-weight: 700;
    color: #0ea5e9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-feature-title i { font-size: 14px; }

/* Nav sections */
.nav-section {
    padding: 0 12px;
    margin-top: 8px;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    padding: 10px 8px 5px;
}

/* Nav items — same as admin.html */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(56, 189, 248, 0.1);
    color: #e2e8f0;
}

.nav-item.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
}

.nav-item i { width: 18px; text-align: center; font-size: 13px; }

.nav-item .nav-badge {
    margin-left: auto;
    background: rgba(148, 163, 184, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.nav-item.active .nav-badge {
    background: rgba(255, 255, 255, 0.2);
}

/* Sidebar data section (non-nav) */
.sb-section {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.sb-section:last-of-type { border-bottom: none; }

.sb-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sb-section-title i { color: #0ea5e9; font-size: 11px; }

/* Sidebar metrics grid (2-col) */
.sb-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sb-metric {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sb-metric:hover { border-color: rgba(14, 165, 233, 0.3); }

.sb-metric.active { 
    border-color: rgba(14, 165, 233, 0.5);
    background: rgba(14, 165, 233, 0.1);
}

.sb-metric-val {
    font-size: 22px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.1;
}

.sb-metric-val.green  { color: #22c55e; }
.sb-metric-val.yellow { color: #eab308; }
.sb-metric-val.orange { color: #f97316; }
.sb-metric-val.red    { color: #ef4444; }
.sb-metric-val.blue   { color: #0ea5e9; }
.sb-metric-val.purple { color: #a78bfa; }

.sb-metric-lbl {
    font-size: 9px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

/* Back to dashboard link — sits at bottom of sidebar like admin.html */
.sidebar-back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    color: #64748b;
    text-decoration: none;
    font-size: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    margin-top: auto;
    transition: color 0.2s;
}

.sidebar-back-link:hover { color: #0ea5e9; }

/* RBAC user pill in sidebar footer */
.sidebar-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(30, 41, 59, 0.4);
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
    font-size: 13px;
}

.logout-btn:hover { color: #ef4444; }

/* ── Main Content ───────────────────────────────────────────────────────────── */
.feature-main {
    flex: 1;
    margin-left: 280px;
    padding: 24px 28px;
    min-height: 100vh;
    /* v2.13: a flex child defaults to min-width:auto, so a wide table (the
       36-column duty register, the 22-column sign-on grid) stretched this pane
       to the table's width and pushed the scrollbar off-screen at the page
       bottom. With min-width:0 the pane stays viewport-wide and the table's
       own container scrolls horizontally. */
    min-width: 0;
    max-width: 100%;
}

/* Page header — same pattern as admin/reports */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* Gradient title — exact match to reports/crew-signon */
.page-title {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.page-subtitle {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* Last-updated stamp */
.last-updated {
    font-size: 11px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================================================
   BUTTONS — exact match to style.css / crew-signon
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.btn-warning:hover { background: rgba(234, 179, 8, 0.25); }

.btn-ghost {
    background: rgba(30, 41, 59, 0.5);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.btn-ghost:hover { background: rgba(30, 41, 59, 0.8); color: #e2e8f0; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================================
   PANELS / CARDS — matches style.css .section-card and crew-signon .panel
   ============================================================================ */

.panel {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i { color: #0ea5e9; }

/* Card grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* Stat bar (4-up counters) */
.stat-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.stat-card:hover { border-color: rgba(14, 165, 233, 0.3); }
.stat-card.active { border-color: rgba(14, 165, 233, 0.5); background: rgba(14, 165, 233, 0.1); }

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #e2e8f0;
}

.stat-card-value.green  { color: #22c55e; }
.stat-card-value.yellow { color: #eab308; }
.stat-card-value.orange { color: #f97316; }
.stat-card-value.red    { color: #ef4444; }
.stat-card-value.blue   { color: #0ea5e9; }
.stat-card-value.purple { color: #a78bfa; }

.stat-card-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-top: 4px;
}

/* Summary box (gradient border, like index.html .summary-box) */
.summary-box {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

/* ============================================================================
   ANALYTICS / CONTENT TABS — exact match to style.css analytics tabs
   ============================================================================ */

.tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(30, 41, 59, 0.5);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
}

.tab-btn:hover { background: rgba(30, 41, 59, 0.8); color: #e2e8f0; }

.tab-btn.active {
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.3);
    color: #0ea5e9;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================================
   FORMS — matches style.css form-* and crew-signon patterns
   ============================================================================ */

.form-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-title i { color: #0ea5e9; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.form-label .req { color: #ef4444; }

.form-input, .form-select, .form-textarea {
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-input::placeholder { color: #475569; }
.form-select option { background: #1e293b; color: #e2e8f0; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-input:disabled, .form-select:disabled, .form-textarea:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================================
   TABLES — matches analytics-table and crew-signon table patterns
   ============================================================================ */

.table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.4);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead { position: sticky; top: 0; z-index: 10; }

.data-table th {
    background: rgba(30, 41, 59, 0.95);
    color: #94a3b8;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.15);
    white-space: nowrap;
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.07);
    color: #e2e8f0;
    vertical-align: middle;
}

.data-table tr:hover td { background: rgba(14, 165, 233, 0.04); }

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

/* ============================================================================
   BADGES — exact match to style.css + reports.html badge-* classes
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: rgba(34, 197, 94, 0.2);    color: #22c55e; }
.badge-warning { background: rgba(234, 179, 8, 0.2);    color: #eab308; }
.badge-danger  { background: rgba(239, 68, 68, 0.2);    color: #ef4444; }
.badge-info    { background: rgba(56, 189, 248, 0.2);   color: #38bdf8; }
.badge-purple  { background: rgba(168, 85, 247, 0.2);   color: #a855f7; }
.badge-orange  { background: rgba(249, 115, 22, 0.2);   color: #f97316; }
.badge-grey    { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* freight/coaching from style.css */
.badge-freight  { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-coaching { background: rgba(236, 72, 153, 0.2); color: #f472b6; }

/* Decision badges (same as style.css .decision-badge) */
.decision-good    { background: rgba(34, 197, 94, 0.2);  color: #22c55e; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.decision-caution { background: rgba(234, 179, 8, 0.2);  color: #eab308; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.decision-alert   { background: rgba(239, 68, 68, 0.2);  color: #ef4444; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; }

/* ============================================================================
   TOAST NOTIFICATIONS — exact match to admin.html toast pattern
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 13px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    animation: toastSlideIn 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
}

.toast i { font-size: 15px; flex-shrink: 0; }
.toast .toast-close { margin-left: auto; cursor: pointer; color: #64748b; font-size: 14px; background: none; border: none; }
.toast .toast-close:hover { color: #e2e8f0; }

.toast.success { border-left: 4px solid #22c55e; }
.toast.success i { color: #22c55e; }
.toast.error   { border-left: 4px solid #ef4444; }
.toast.error i { color: #ef4444; }
.toast.warning { border-left: 4px solid #eab308; }
.toast.warning i { color: #eab308; }
.toast.info    { border-left: 4px solid #0ea5e9; }
.toast.info i  { color: #0ea5e9; }

@keyframes toastSlideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

/* ============================================================================
   MODAL — matches style.css modal-backdrop / modal-card
   ============================================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal-card {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    width: 90%;
    max-width: 680px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-backdrop.active .modal-card { transform: scale(1); }

.modal-card.modal-lg { max-width: 860px; }
.modal-card.modal-sm { max-width: 480px; }

.modal-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(34, 197, 94, 0.08));
    padding: 20px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.modal-title    { font-size: 18px; font-weight: 700; color: #e2e8f0; }
.modal-subtitle { font-size: 12px; color: #94a3b8; margin-top: 3px; }

.modal-close {
    width: 32px; height: 32px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.modal-close:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================================================
   LOADING & EMPTY STATE — matches style.css patterns
   ============================================================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    flex-direction: column;
    gap: 16px;
    color: #64748b;
}

/* Full-size spinner (matches style.css exactly) */
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(14, 165, 233, 0.2);
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spinnerSpin 1s linear infinite;
}

/* Inline mini spinner */
.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(14, 165, 233, 0.2);
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spinnerSpin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spinnerSpin { to { transform: rotate(360deg); } }

/* Empty state — matches style.css */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state i {
    font-size: 42px;
    margin-bottom: 14px;
    opacity: 0.4;
    display: block;
}

.empty-state p { font-size: 14px; }
.empty-state small { font-size: 12px; color: #475569; }

/* ============================================================================
   PROGRESS / HEALTH BARS
   ============================================================================ */

.progress-wrap { margin: 6px 0; }

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #64748b;
    margin-bottom: 4px;
}

.progress-bg {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-fill.green  { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-fill.yellow { background: linear-gradient(90deg, #ca8a04, #eab308); }
.progress-fill.orange { background: linear-gradient(90deg, #c2410c, #f97316); }
.progress-fill.red    { background: linear-gradient(90deg, #dc2626, #ef4444); }
.progress-fill.blue   { background: linear-gradient(90deg, #0284c7, #0ea5e9); }

/* ============================================================================
   INFO GRID (key-value pairs) — matches style.css popup-grid
   ============================================================================ */

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
    padding: 10px 12px;
}

.info-label {
    font-size: 9px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
}

/* ============================================================================
   SECTION CONTENT (show/hide — matches admin.html pattern)
   ============================================================================ */

.section-content        { display: none; }
.section-content.active { display: block; }

/* ============================================================================
   DETAIL PANEL / DRAWER (right slide-in)
   ============================================================================ */

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 460px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(148, 163, 184, 0.15);
    z-index: 500;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel.open { transform: none; }

.detail-panel-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(34, 197, 94, 0.05));
    padding: 18px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.detail-panel-title    { font-size: 16px; font-weight: 700; color: #e2e8f0; }
.detail-panel-subtitle { font-size: 11px; color: #64748b; margin-top: 3px; }

.detail-panel-close {
    width: 30px; height: 30px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 7px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.detail-panel-close:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.detail-panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.detail-tab {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.detail-tab.active { color: #0ea5e9; border-bottom-color: #0ea5e9; }
.detail-tab:hover:not(.active) { color: #e2e8f0; }

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
}

/* ============================================================================
   ALERT / CALLOUT BLOCKS
   ============================================================================ */

.callout {
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    margin-bottom: 12px;
}

.callout i { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.callout-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.callout-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fde047;
}

.callout-info {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.25);
    color: #7dd3fc;
}

.callout-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* ============================================================================
   TIMELINE (crew lifecycle, audit)
   ============================================================================ */

.timeline { margin-left: 10px; }

.timeline-item {
    display: flex;
    gap: 14px;
    padding: 10px 0 10px 20px;
    border-left: 2px solid rgba(56, 189, 248, 0.3);
    position: relative;
    font-size: 12px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0ea5e9;
}

.timeline-item.done::before  { background: #22c55e; }
.timeline-item.pending::before { background: #eab308; }
.timeline-item.error::before   { background: #ef4444; }

.timeline-title { font-weight: 600; color: #e2e8f0; margin-bottom: 3px; }
.timeline-meta  { color: #64748b; }

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-muted   { color: #64748b; }
.text-blue    { color: #0ea5e9; }
.text-green   { color: #22c55e; }
.text-yellow  { color: #eab308; }
.text-orange  { color: #f97316; }
.text-red     { color: #ef4444; }
.text-purple  { color: #a78bfa; }
.text-bold    { font-weight: 700; }
.text-sm      { font-size: 11px; }
.text-xs      { font-size: 10px; }
.text-upper   { text-transform: uppercase; letter-spacing: 0.8px; }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.mb-20        { margin-bottom: 20px; }

/* Divider */
.divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.1);
    margin: 14px 0;
}

/* Pulse animation for critical alerts */
@keyframes criticalPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.pulse-critical { animation: criticalPulse 1.5s ease-in-out infinite; }

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

@media (max-width: 1024px) {
    .feature-sidebar { width: 240px; }
    .feature-main    { margin-left: 240px; }
    .stat-bar        { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .feature-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
    }
    .feature-sidebar.mobile-open { transform: none; }
    .feature-main    { margin-left: 0; padding: 16px; }
    .form-grid       { grid-template-columns: 1fr; }
    .stat-bar        { grid-template-columns: repeat(2, 1fr); }
    .detail-panel    { width: 100%; }
}
