/* ═══════════════════════════════════════════════════════
   Eagle RTA Proof — Design System (index.css)
   Shared tokens, resets, and components for all views.
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* ── Brand ── */
    --brand-red: #DC2626;
    --brand-blue: #4F46E5;

    /* ── Colors ── */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-dim: rgba(79, 70, 229, 0.08);
    --accent: #D97706;
    --accent-hover: #B45309;
    --accent-dim: rgba(217, 119, 6, 0.08);
    --success: #16A34A;
    --success-dim: rgba(22, 163, 74, 0.08);
    --danger: #DC2626;
    --danger-hover: #B91C1C;
    --danger-dim: rgba(220, 38, 38, 0.08);
    --warning: #D97706;
    --warning-dim: rgba(217, 119, 6, 0.08);

    /* ── Surfaces ── */
    --bg: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-hover: #F4F4F5;
    --bg-active: #E4E4E7;
    --bg-overlay: rgba(0, 0, 0, 0.70);
    --border: #E8E8E8;
    --border-focus: rgba(79, 70, 229, 0.4);

    /* ── Text ── */
    --text-1: #1A1A1A;
    --text-2: #6B6B6B;
    --text-3: #A0A0A0;
    --text-4: #D4D4D4;
    --text-inv: #FFFFFF;

    /* ── Spacing ── */
    --sp-px: 1px;
    --sp-0: 0px;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* ── Radii ── */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-pill: 999px;
    --r-full: 50%;

    /* ── Shadows ── */
    --sh-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --sh-md: 0 2px 8px rgba(0, 0, 0, 0.07);
    --sh-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --sh-xl: 0 8px 32px rgba(0, 0, 0, 0.10);

    /* ── Transitions ── */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur: 150ms;

    /* ── Font ── */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* ── Legacy alias ── */
    --text-light: var(--text-3);
}

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

html {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-1);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    min-height: 100dvh;
    overscroll-behavior: contain;
}

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

a:hover {
    color: var(--primary-hover);
}

img {
    display: block;
    max-width: 100%;
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

/* ── Typography ── */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
}

.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-mono {
    font-family: var(--mono);
    font-size: 0.8125rem;
    letter-spacing: -0.02em;
}
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    min-height: 40px;
    white-space: nowrap;
    user-select: none;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--border-focus);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inv);
    border-color: var(--primary);
}

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

.btn-danger {
    background: var(--danger);
    color: var(--text-inv);
    border-color: var(--danger);
}

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

.btn-accent {
    background: var(--accent);
    color: var(--text-inv);
    border-color: var(--accent);
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-1);
    border-color: #D0D0D0;
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid transparent;
    padding: var(--sp-2) var(--sp-3);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.btn-lg {
    padding: var(--sp-4) var(--sp-6);
    font-size: 1rem;
    min-height: 48px;
    border-radius: var(--r-lg);
}

.btn-full { width: 100%; }

.btn-icon {
    padding: var(--sp-2);
    min-height: 36px;
    min-width: 36px;
    border-radius: var(--r-md);
}

/* ── Inputs ── */
.input {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-1);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    min-height: 42px;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.input::placeholder { color: var(--text-3); }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.input {
    resize: vertical;
    min-height: 80px;
}

.label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--sp-1);
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    box-shadow: var(--sh-sm);
}

.card-hover {
    cursor: pointer;
    transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card-hover:hover {
    box-shadow: var(--sh-md);
    border-color: var(--primary);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--r-pill);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-blue {
    background: var(--primary-dim);
    color: var(--primary);
}

.badge-green {
    background: var(--success-dim);
    color: var(--success);
}

.badge-red {
    background: var(--danger-dim);
    color: var(--danger);
}

.badge-orange {
    background: var(--accent-dim);
    color: var(--accent);
}

.badge-gray {
    background: var(--bg-hover);
    color: var(--text-2);
}

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--bg-card);
    box-shadow: var(--sh-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
}

.table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
}

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

.table tbody tr {
    transition: background var(--dur) var(--ease);
}

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

.table tbody tr[onclick] { cursor: pointer; }

/* ── Toast ── */
.toast-container {
    position: fixed;
    bottom: var(--sp-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--sp-2);
    pointer-events: none;
}

.toast {
    background: var(--text-1);
    color: var(--text-inv);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--r-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--sh-lg);
    opacity: 0;
    transform: translateY(10px);
    animation: toast-in 200ms var(--ease) forwards;
    pointer-events: auto;
    white-space: nowrap;
}

@keyframes toast-in {
    to { opacity: 1; transform: translateY(0); }
}

.toast.toast-out {
    animation: toast-out 150ms var(--ease) forwards;
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(10px); }
}

/* ── Toast Variants ── */
.toast-success { background: var(--success); }
.toast-danger  { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--text-1); }

/* ── Skeleton Loading ── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-active) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    border-radius: var(--r-sm);
    color: transparent !important;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Dialog / Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    opacity: 0;
    transition: opacity 200ms var(--ease);
}

.modal-overlay.active { opacity: 1; }

.modal-box {
    background: var(--bg-card);
    border-radius: var(--r-xl);
    padding: var(--sp-6);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--sh-xl);
    transform: scale(0.95);
    transition: transform 200ms var(--ease);
}

.modal-overlay.active .modal-box { transform: scale(1); }

/* ── View transitions ── */
@keyframes view-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-20px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.view-enter  { animation: slideInRight 250ms var(--ease) forwards; }
.view-exit   { animation: slideOutLeft 250ms var(--ease) forwards; }
.fade-in     { animation: fadeIn 300ms var(--ease) forwards; }

/* ── Empty state ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-12) var(--sp-6);
    text-align: center;
    min-height: 280px;
    color: var(--text-3);
}

.empty-state svg { margin: 0 auto var(--sp-4); opacity: 0.35; }

.empty-state h3 {
    color: var(--text-2);
    margin-bottom: var(--sp-2);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    margin-bottom: var(--sp-4);
    color: var(--text-4);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: var(--sp-2);
}

.empty-state-message {
    font-size: 0.875rem;
    color: var(--text-3);
    max-width: 280px;
    margin-bottom: var(--sp-6);
    line-height: 1.5;
}

.empty-state-action {
    padding: var(--sp-3) var(--sp-6);
    background: var(--primary);
    color: var(--text-inv);
    border: none;
    border-radius: var(--r-md);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur) var(--ease), transform 100ms var(--ease);
}

.empty-state-action:hover  { background: var(--primary-hover); }
.empty-state-action:active { transform: scale(0.98); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Utility ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Upload Progress Bar ── */
.upload-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    z-index: 10000;
    display: none;
}

.upload-progress.active { display: block; }

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Button Loading State ── */
.btn-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
    color: var(--text-inv);
}

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

/* ── Field Validation ── */
.field-error {
    display: block;
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: var(--sp-1);
}

.input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px var(--danger-dim) !important;
}

/* ── Pull to Refresh ── */
.ptr-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.2s var(--ease), opacity 0.2s var(--ease);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

.ptr-indicator.visible { top: 10px; opacity: 1; }

.ptr-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

/* ── Icon Sizes ── */
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.icon-md { width: 20px; height: 20px; flex-shrink: 0; }
.icon-lg { width: 24px; height: 24px; flex-shrink: 0; }

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--sp-4) 0;
}

/* ── Interactive ── */
button:active,
.action-card:active { transform: scale(0.98); }

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Print ── */
@media print {
    .no-print, .toast-container, .modal-overlay { display: none !important; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    a { color: #000; text-decoration: underline; }
}

/* ═══════════════════════════════════════════════════════
   2026 Operations UI Refresh
   Dense, scan-first interface for baggage evidence work.
   ═══════════════════════════════════════════════════════ */

:root {
    --brand-red: #c1121f;
    --brand-blue: #14532d;
    --primary: #14532d;
    --primary-hover: #0f3f23;
    --primary-dim: rgba(20, 83, 45, 0.09);
    --accent: #b45309;
    --accent-hover: #92400e;
    --accent-dim: rgba(180, 83, 9, 0.10);
    --success: #15803d;
    --success-dim: rgba(21, 128, 61, 0.10);
    --danger: #c1121f;
    --danger-hover: #991b1b;
    --danger-dim: rgba(193, 18, 31, 0.10);
    --warning: #b45309;
    --warning-dim: rgba(180, 83, 9, 0.10);
    --bg: #f4f5f2;
    --bg-card: #ffffff;
    --bg-hover: #eef1ea;
    --bg-active: #e1e7dc;
    --bg-ink: #111611;
    --bg-ink-2: #1e241e;
    --border: #dfe4db;
    --border-strong: #c8d1c1;
    --border-focus: rgba(20, 83, 45, 0.32);
    --text-1: #162016;
    --text-2: #526052;
    --text-3: #839083;
    --text-4: #c9d0c5;
    --text-inv: #ffffff;
    --r-lg: 8px;
    --r-xl: 8px;
    --sh-sm: 0 1px 2px rgba(17, 24, 17, 0.05);
    --sh-md: 0 8px 20px rgba(17, 24, 17, 0.08);
    --sh-lg: 0 14px 34px rgba(17, 24, 17, 0.11);
    --sh-xl: 0 24px 54px rgba(17, 24, 17, 0.16);
}

html {
    background: var(--bg);
    letter-spacing: 0;
}

body {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0) 240px),
        var(--bg);
}

h1,
h2,
h3 {
    letter-spacing: 0;
}

.btn {
    border-radius: var(--r-md);
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: none;
}

.btn-primary,
.btn-danger,
.btn-accent {
    box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 8px 18px rgba(17, 24, 17, 0.08);
}

.btn-outline,
.btn-ghost {
    background: rgba(255,255,255,0.70);
}

.btn-outline:hover,
.btn-ghost:hover {
    border-color: var(--border-strong);
}

.label {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-2);
}

.input,
input.input,
select.input,
textarea.input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text-1);
    background: #fbfcfa;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

textarea.input {
    min-height: 96px;
    resize: vertical;
}

.input:hover {
    border-color: var(--border-strong);
    background: #ffffff;
}

.input:focus,
input.input:focus,
select.input:focus,
textarea.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-focus);
    background: #ffffff;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge-blue,
.badge-OPEN,
.badge-open {
    color: #0f3f23;
    background: rgba(20, 83, 45, 0.10);
    border-color: rgba(20, 83, 45, 0.18);
}

.badge-green,
.badge-COMPLETED,
.badge-completed {
    color: #166534;
    background: rgba(21, 128, 61, 0.11);
    border-color: rgba(21, 128, 61, 0.20);
}

.badge-red,
.badge-CANCELLED,
.badge-cancelled {
    color: #991b1b;
    background: rgba(193, 18, 31, 0.10);
    border-color: rgba(193, 18, 31, 0.20);
}

.badge-orange,
.badge-DRAFT,
.badge-draft {
    color: #92400e;
    background: rgba(180, 83, 9, 0.11);
    border-color: rgba(180, 83, 9, 0.20);
}

.badge-gray,
.badge-grey {
    color: #4b5563;
    background: rgba(75, 85, 99, 0.10);
    border-color: rgba(75, 85, 99, 0.18);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px 14px;
    color: var(--text-2);
    background: #f8faf6;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background var(--dur) var(--ease);
}

tbody tr:hover {
    background: #fbfcfa;
}
