/* ============================================================
   WYATT — Fastest Landman in the West
   Color System + Typography + Layout
   ============================================================ */

:root {
    --navy: #1B2A4A;
    --navy-light: #2a3d66;
    --gold: #C8942D;
    --gold-light: #d4a94e;
    --gold-dim: rgba(200, 148, 45, 0.15);
    --bg: #F5F3EF;
    --surface: #FFFFFF;
    --text: #2C2C2C;
    --muted: #8B8B8B;
    --success: #2D8B57;
    --danger: #C0392B;
    --border: #E5E1DB;
    --shadow-sm: 0 1px 3px rgba(27, 42, 74, 0.06);
    --shadow-md: 0 4px 12px rgba(27, 42, 74, 0.08);
    --shadow-lg: 0 8px 30px rgba(27, 42, 74, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    line-height: 1.3;
    color: var(--navy);
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(200, 148, 45, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(27, 42, 74, 0.04) 0%, transparent 60%),
        var(--bg);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px 36px;
    border-top: 3px solid var(--gold);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-img {
    width: 280px;
    height: auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-footer {
    margin-top: 28px;
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.login-footer-text {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--navy);
    letter-spacing: 0.3px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group textarea {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-dim);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--muted);
}

.form-hint {
    font-size: 12px;
    color: var(--muted);
}

.form-check {
    flex-direction: row;
    align-items: center;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
    cursor: pointer;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 8px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--navy);
    color: #fff;
}

.btn-primary:hover {
    background: var(--navy-light);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-full { width: 100%; }

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--navy);
    color: var(--navy);
}

.btn-outline:hover {
    background: var(--navy);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    padding: 12px 16px;
}

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

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-danger {
    background: rgba(192, 57, 43, 0.08);
    color: var(--danger);
    border: 1px solid rgba(192, 57, 43, 0.2);
}

.alert-success {
    background: rgba(45, 139, 87, 0.08);
    color: var(--success);
    border: 1px solid rgba(45, 139, 87, 0.2);
}

/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
    background: var(--navy);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-logo {
    width: 32px;
    height: 32px;
}

.nav-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
}

.nav-brand:hover .nav-title { color: var(--gold); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-user {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.nav-link-muted {
    color: rgba(255,255,255,0.5);
}

.nav-link-muted:hover {
    color: rgba(255,255,255,0.9);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.section {
    margin-bottom: 36px;
}

.section-narrow {
    max-width: 520px;
}

.section-title {
    font-size: 22px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gold-dim);
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    border: 1px solid var(--border);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

/* ============================================================
   STATS GRID
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stats-grid-sm .stat-card {
    text-align: center;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
}

.stat-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
}

.stat-count {
    font-size: 13px;
    color: var(--muted);
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.progress-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

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

.progress-ocr {
    background: var(--gold);
}

.progress-extract {
    background: var(--success);
}

.progress-pct {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
}

.stat-card-compact {
    padding: 24px 20px;
}

.stat-number {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.1;
}

.stat-desc {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   CHAIN INPUT / LOCK
   ============================================================ */

.chain-form .form-group {
    margin-bottom: 16px;
}

.lock-notice {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: rgba(200, 148, 45, 0.06);
    border: 1px solid rgba(200, 148, 45, 0.2);
    border-radius: var(--radius);
    color: var(--text);
}

.lock-notice strong {
    display: block;
    margin-bottom: 2px;
}

.lock-icon {
    color: var(--gold);
    flex-shrink: 0;
}

.lock-elapsed {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

.lock-mine {
    background: rgba(45, 139, 87, 0.06);
    border-color: rgba(45, 139, 87, 0.2);
}

/* ============================================================
   DATA TABLE
   ============================================================ */

.table-wrap {
    padding: 0;
    overflow-x: auto;
}

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

.data-table thead {
    background: var(--bg);
}

.data-table th {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: rgba(200, 148, 45, 0.03);
}

.td-nowrap { white-space: nowrap; }

.td-desc {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pending {
    background: var(--gold-dim);
    color: var(--gold);
}

.badge-running {
    background: rgba(27, 42, 74, 0.1);
    color: var(--navy);
}

.badge-completed {
    background: rgba(45, 139, 87, 0.1);
    color: var(--success);
}

.badge-failed, .badge-killed {
    background: rgba(192, 57, 43, 0.1);
    color: var(--danger);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

.empty-state p {
    font-size: 14px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
}

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

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .login-card {
        padding: 36px 24px 28px;
    }

    .login-logo .logo-img {
        width: 240px;
    }

    .navbar { padding: 0 16px; }

    .nav-inner { height: 50px; }

    .nav-user { display: none; }

    .nav-right { gap: 8px; }

    .nav-link { font-size: 13px; padding: 5px 8px; }

    .main-content {
        padding: 20px 16px 48px;
    }

    .section-title {
        font-size: 18px;
    }

    .stats-grid-sm {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-number {
        font-size: 24px;
    }

    .stat-desc {
        font-size: 11px;
    }

    .stat-card-compact {
        padding: 16px 12px;
    }



    .data-table {
        font-size: 13px;
    }

    .data-table th, .data-table td {
        padding: 10px 10px;
    }

    .td-desc {
        max-width: 160px;
    }
}

@media (max-width: 380px) {
    .stats-grid-sm {
        grid-template-columns: 1fr;
    }
}
