:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #3c8dbc;
    --danger: #dd4b39;
    --secondary: #6c757d;
    --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }

.container { width: min(1140px, 95%); margin: 0 auto; }
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }
.brand { color: var(--primary); font-size: 20px; }
nav { display: flex; gap: 12px; }
nav a { padding: 8px 10px; border-radius: 4px; }
nav a:hover { background: #eef2f7; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.grid-form .full { grid-column: 1 / -1; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
input, select, button {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.btn {
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 4px;
    display: inline-block;
    width: auto;
}
.btn:hover { filter: brightness(0.95); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

.alert {
    padding: 10px;
    border-radius: 4px;
    margin: 12px 0;
    border: 1px solid transparent;
}
.alert.success { background: #ecfdf3; border-color: #86efac; color: #166534; }
.alert.error { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--border); padding: 10px; text-align: left; }
thead th { background: #f9fafb; }

.badge {
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    display: inline-block;
}
.badge-secondary { background: #f3f4f6; color: #111827; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

.bus-layout {
    max-width: 500px;
    margin: 12px auto;
    border: 1px dashed #cbd5e1;
    padding: 12px;
    border-radius: 8px;
    background: #f8fafc;
}
.driver {
    text-align: center;
    background: #e2e8f0;
    padding: 6px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 13px;
}
.bus-row { display: grid; grid-template-columns: 1fr 40px 1fr; gap: 8px; margin-bottom: 8px; align-items: center; }
.left-seats, .right-seats { display: flex; gap: 6px; justify-content: center; }
.aisle { height: 1px; }
.seat {
    width: 42px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid #93c5fd;
    background: #eff6ff;
    cursor: pointer;
}
.seat.selected { background: #3c8dbc; color: #fff; border-color: #3c8dbc; }
.seat.booked, .seat:disabled { background: #d1d5db; color: #6b7280; border-color: #9ca3af; cursor: not-allowed; opacity: 0.7; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 13px; }
.seat-demo { width: 20px; height: 14px; display: inline-block; border-radius: 3px; vertical-align: middle; background: #eff6ff; border: 1px solid #93c5fd; margin-right: 4px; }
.seat-demo.selected { background: #3c8dbc; border-color: #3c8dbc; }
.seat-demo.booked { background: #d1d5db; border-color: #9ca3af; }

.footer { color: var(--muted); padding: 20px 0; }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #222d32; color: #b8c7ce; padding: 16px; }
.sidebar-title { color: #fff; font-size: 18px; margin-top: 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 16px; }
.sidebar-nav a { padding: 9px 10px; border-radius: 4px; }
.sidebar-nav a:hover { background: #1e282c; color: #fff; }
.admin-main { padding: 16px; }
.admin-topbar { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 14px; }
.stat-card span { color: var(--muted); font-size: 13px; display: block; }
.stat-card strong { font-size: 24px; }

.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.actions { display: flex; gap: 6px; align-items: center; }
.actions form { margin: 0; }

.auth-body { display: grid; place-items: center; min-height: 100vh; }
.auth-card { width: min(420px, 92%); background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 18px; }

@media (max-width: 920px) {
    .admin-shell { grid-template-columns: 1fr; }
}
