:root {
    --bg: #080c11;
    --panel: #111821;
    --panel-soft: #151f2b;
    --line: #253244;
    --text: #f7fafc;
    --muted: #b9c5d2;
    --yellow: #f8c400;
    --green: #2ecc71;
    --blue: #3b82f6;
    --red: #ef4444;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
.shell { min-height: 100vh; display: flex; min-width: 0; }
.sidebar {
    width: 250px;
    background: #0d131b;
    border-right: 1px solid var(--line);
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--yellow);
    color: #111;
    display: grid;
    place-items: center;
    font-weight: 900;
}
.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: #101722;
    padding: 5px;
    border: 1px solid var(--line);
}
.brand strong { display: block; font-size: 18px; }
.brand span { color: var(--muted); font-size: 13px; }
nav { display: grid; gap: 8px; }
nav a {
    padding: 12px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}
nav a:hover { background: var(--panel); color: var(--text); }
.main { flex: 1; padding: 26px; max-width: 1440px; margin: 0 auto; width: 100%; min-width: 0; }
.main-public { max-width: 1120px; }
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}
h1, h2 { margin: 0; }
h1 { font-size: 32px; }
h2 { font-size: 20px; margin-bottom: 16px; }
.eyebrow {
    margin: 0 0 6px;
    color: var(--yellow);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 800;
    cursor: pointer;
    min-height: 42px;
    text-align: center;
}
.btn-primary { background: var(--yellow); color: #111; }
.btn-secondary { background: var(--panel-soft); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--red); color: #fff; }
.btn-small { padding: 8px 10px; font-size: 13px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.stat-card { border-left: 5px solid var(--blue); }
.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 12px;
}
.stat-card strong { display: block; font-size: 28px; }
.grid { display: grid; gap: 18px; }
.grid-two { grid-template-columns: 1fr 1fr; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title a { color: var(--yellow); font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 13px; }
.rides-panel { padding: 0; overflow: hidden; }
.rides-head,
.ride-row {
    display: grid;
    grid-template-columns: 110px minmax(190px, 1.1fr) minmax(280px, 1.6fr) 150px 120px 190px;
    gap: 14px;
    align-items: center;
}
.rides-no-actions .rides-head,
.rides-no-actions .ride-row {
    grid-template-columns: 110px minmax(190px, 1.1fr) minmax(280px, 1.6fr) 150px 120px;
}
.rides-head {
    padding: 14px 18px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
}
.rides-list { display: grid; }
.ride-row {
    min-height: 86px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.ride-row:last-child { border-bottom: 0; }
.ride-row:hover { background: rgba(255,255,255,.025); }
.ride-date strong,
.ride-person strong,
.ride-value strong { display: block; font-size: 15px; }
.ride-date span,
.ride-person span,
.ride-person small,
.ride-status small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 5px;
}
.ride-route {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.ride-route div {
    min-width: 0;
    color: var(--text);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.ride-route span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.ride-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.ride-actions form { margin: 0; }
.empty-state {
    display: grid;
    gap: 6px;
    padding: 28px 18px;
    color: var(--muted);
}
.empty-state strong { color: var(--text); }
.pill {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #1e293b;
    color: #dbeafe;
    font-size: 12px;
    font-weight: 700;
}
.form { display: grid; gap: 10px; }
.grid-form { grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
label { color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b1118;
    color: var(--text);
    padding: 12px;
    font-size: 15px;
}
textarea { resize: vertical; }
.form-actions { display: flex; gap: 10px; }
.list { display: grid; gap: 10px; }
.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #0b1118;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.list-row span { color: var(--muted); }
.row-actions, .actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.row-actions form, .actions-cell form { margin: 0; }
.alert { border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.alert-error { background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.4); }
.alert-success { background: rgba(46,204,113,.14); border: 1px solid rgba(46,204,113,.4); }
.muted { color: var(--muted); }
.login-panel { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.brand-login { margin-bottom: 18px; }
.public-hero {
    min-height: 360px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    padding: 42px;
    margin-bottom: 18px;
    background: linear-gradient(120deg, rgba(248,196,0,.18), rgba(59,130,246,.16)), #101722;
    border: 1px solid var(--line);
}
.hero-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    border-radius: 12px;
    background: #101722;
    padding: 8px;
    border: 1px solid var(--line);
    margin-bottom: 18px;
}
.public-hero h1 { font-size: 54px; }
.hero-copy { max-width: 560px; color: var(--muted); font-size: 20px; line-height: 1.45; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.panel-dark { background: #0d131b; }
.feature-list { display: grid; gap: 12px; }
.feature-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
}
.feature-list span { color: var(--muted); }
.bot-status {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}
.bot-status span { color: var(--muted); }
td small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    max-width: 260px;
    white-space: normal;
}
.check-row {
    background: #0b1118;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.check-row label {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text);
}
.check-row input { width: auto; }
.check-row small { color: var(--muted); display: block; margin-top: 8px; }
.danger-box {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid rgba(239,68,68,.45);
    background: rgba(239,68,68,.08);
    border-radius: 8px;
    display: grid;
    gap: 10px;
}
.debug-box {
    background: #0b1118;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    max-height: 360px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}
.danger-panel {
    border-color: rgba(239,68,68,.45);
}
.cleanup-form {
    margin-top: 18px;
}
.cleanup-options {
    display: grid;
    gap: 10px;
    margin-bottom: 8px;
}
.cleanup-options label {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #0b1118;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 12px;
}
.cleanup-options input { width: auto; }
.danger-choice {
    border-color: rgba(239,68,68,.55) !important;
    background: rgba(239,68,68,.08) !important;
}
.compact-stats {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

@media (max-width: 1180px) {
    .sidebar {
        width: 220px;
        padding: 16px;
    }
    .main { padding: 22px; }
    .rides-head { display: none; }
    .ride-row,
    .rides-no-actions .ride-row {
        grid-template-columns: minmax(110px, .55fr) minmax(210px, 1fr) minmax(280px, 1.35fr);
        grid-template-areas:
            "date person route"
            "status value actions";
        align-items: start;
    }
    .rides-no-actions .ride-row {
        grid-template-areas:
            "date person route"
            "status value value";
    }
    .ride-date { grid-area: date; }
    .ride-person { grid-area: person; }
    .ride-route { grid-area: route; }
    .ride-status { grid-area: status; }
    .ride-value { grid-area: value; }
    .ride-actions { grid-area: actions; justify-content: flex-start; }
}

@media (max-width: 900px) {
    .shell { display: block; }
    .sidebar {
        width: auto;
        height: auto;
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 14px;
    }
    .brand {
        margin-bottom: 14px;
    }
    nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    nav a {
        background: #101722;
        border: 1px solid var(--line);
        text-align: center;
        padding: 10px 8px;
    }
    .main { padding: 16px; }
    .stats-grid, .grid-two, .grid-form { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .page-header .btn { width: 100%; }
    .panel, .stat-card { padding: 14px; }
    .section-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
    .public-hero { padding: 26px; min-height: auto; }
    .public-hero h1 { font-size: 40px; }
    .hero-copy { font-size: 17px; }
    .hero-actions .btn { flex: 1 1 180px; }
    .rides-head { display: none; }
    .ride-row,
    .rides-no-actions .ride-row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "date"
            "person"
            "route"
            "status"
            "value"
            "actions";
        gap: 12px;
        align-items: stretch;
        min-height: 0;
        padding: 14px;
    }
    .rides-no-actions .ride-row {
        grid-template-areas:
            "date"
            "person"
            "route"
            "status"
            "value";
    }
    .ride-route { grid-template-columns: 1fr; }
    .ride-actions { justify-content: flex-start; }
    .ride-actions .btn,
    .ride-actions form,
    .ride-actions button { width: 100%; }
    .list-row {
        align-items: stretch;
        flex-direction: column;
    }
    .row-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .row-actions .btn,
    .row-actions form,
    .row-actions button { width: 100%; }
    .form-actions {
        flex-direction: column;
    }
    .form-actions .btn { width: 100%; }
    .bot-status {
        align-items: flex-start;
        flex-direction: column;
    }
    .table-wrap {
        margin-left: -14px;
        margin-right: -14px;
        padding: 0 14px;
    }
}

@media (max-width: 560px) {
    .sidebar { padding: 12px; }
    .brand-logo {
        width: 42px;
        height: 42px;
    }
    .brand strong { font-size: 17px; }
    nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    nav a {
        font-size: 14px;
        min-height: 42px;
        display: grid;
        place-items: center;
    }
    .main { padding: 12px; }
    h1 { font-size: 28px; }
    h2 { font-size: 18px; }
    .stats-grid { gap: 10px; }
    .stat-card strong { font-size: 24px; }
    .panel, .stat-card {
        border-radius: 8px;
        padding: 12px;
    }
    .rides-panel { padding: 0; }
    .ride-row { padding: 12px; }
    .ride-route div {
        background: #0b1118;
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 10px;
    }
    .public-hero {
        padding: 20px;
    }
    .public-hero h1 { font-size: 34px; }
    .hero-logo {
        width: 76px;
        height: 76px;
    }
    .feature-list div {
        align-items: flex-start;
        flex-direction: column;
    }
    input, select, textarea {
        font-size: 16px;
    }
}
