* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

/* ── LOGIN ──────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 8px;
    color: #1a1a2e;
    font-size: 24px;
}

.login-box p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

/* ── FORMS ──────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #444;
}

.required {
    color: #e74c3c;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #fafafa;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a90d9;
    background: white;
}

/* ── BUTTONS ────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

.btn-primary   { background: #4a90d9; color: white; }
.btn-primary:hover { background: #357abd; }

.btn-success   { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }

.btn-danger    { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* ── NAVBAR ─────────────────────────────── */
.navbar {
    background: #1a1a2e;
    color: white;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.navbar h2 {
    font-size: 17px;
}

.navbar a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.navbar a:hover { color: white; }

/* ── CARDS ──────────────────────────────── */
.card {
    background: white;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    margin-bottom: 18px;
}

.card h3 {
    margin-bottom: 18px;
    color: #1a1a2e;
    font-size: 16px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 10px;
}

/* ── STATS ROW ──────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-top: 3px solid #4a90d9;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

/* ── TABS ───────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tab-btn {
    padding: 9px 16px;
    border: none;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    color: #666;
    white-space: nowrap;
}

.tab-btn:hover { background: #f0f2f5; color: #333; }

.tab-btn.active {
    background: #1a1a2e;
    color: white;
}

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

/* ── DYNAMIC ROWS ───────────────────────── */
.dynamic-row {
    background: #f8f9fa;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.dynamic-row .remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

.add-row-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed #4a90d9;
    border-radius: 8px;
    background: transparent;
    color: #4a90d9;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

.add-row-btn:hover { background: #f0f7ff; }

.add-pickup-btn {
    background: none;
    border: 1px dashed #aaa;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    margin-top: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.add-pickup-btn:hover { border-color: #4a90d9; color: #4a90d9; }

.pickup-entry {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    position: relative;
}

.btn-remove-pickup {
    margin-bottom: 8px;
}

.stop-title {
    font-weight: 700;
    color: #4a90d9;
    font-size: 15px;
    margin-bottom: 14px;
}

.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    margin-top: 4px;
}

.divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 14px 0;
}

.empty-hint {
    color: #aaa;
    font-size: 13px;
    text-align: center;
    padding: 16px;
    font-style: italic;
}

/* ── GRIDS ──────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── ALERTS ─────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error   { background: #fde8e8; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-success { background: #e8f5e9; color: #27ae60; border: 1px solid #c3e6cb; }

/* ── TABLES ─────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.report-table th,
.report-table td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
    white-space: nowrap;
}

.report-table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.report-table tbody tr:hover { background: #fafafa; }

/* ── TOTAL BOX ──────────────────────────── */
.total-box {
    background: #1a1a2e;
    color: white;
    padding: 14px 18px;
    border-radius: 8px;
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
}

/* ── ANALYTICS ──────────────────────────── */
.analytics-table td { white-space: normal; }

.miles-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.miles-bar {
    height: 8px;
    background: #4a90d9;
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.4s;
}

.miles-bar-wrap span {
    font-size: 12px;
    color: #333;
    white-space: nowrap;
}

/* ── MOBILE ─────────────────────────────── */
@media (max-width: 700px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .tabs {
        gap: 3px;
        padding: 8px;
    }

    .tab-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    .navbar h2 { font-size: 15px; }
    .navbar { gap: 10px; }

    .container { padding: 12px; }
    .card { padding: 16px; }

    .dynamic-row { padding: 12px; }

    .rv-header { padding: 18px; }
    .rv-totals { flex-wrap: wrap; gap: 12px; }
    .rv-total-item strong { font-size: 18px; }
}

@media (max-width: 420px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 20px; }
}
