:root {
  --primary: #e63946;
  --primary-dark: #c22c39;
  --dark: #1d2939;
  --gray: #667085;
  --light-bg: #f5f6f8;
  --border: #e4e7ec;
  --available: #ffffff;
  --booked: #d0d5dd;
  --selected: #e63946;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--light-bg);
  color: var(--dark);
}
.container { max-width: 720px; margin: 0 auto; padding: 16px; }
header.topbar {
  background: var(--dark);
  color: #fff;
  padding: 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 20;
}
header.topbar h1 { margin: 0; font-size: 1.25rem; }
header.topbar a { color: #fff; text-decoration: none; font-size: 0.85rem; }

.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(16,24,40,0.05);
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--gray); }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; min-width: 0; }

input, select, button, textarea {
  font-family: inherit;
  font-size: 1rem;
}
input[type=text], input[type=date], input[type=time], input[type=tel], input[type=email], input[type=number], input[type=password], select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.input-icon-group { position: relative; }
.input-icon-group .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.7;
}
.input-icon-group select,
.input-icon-group input {
  padding-left: 38px;
}

.quick-date-row { display: flex; gap: 8px; margin-top: 8px; }
.quick-date-btn {
  flex: 1;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
}
.quick-date-btn:hover { border-color: var(--primary); }
.quick-date-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
button.btn, a.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 13px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  text-decoration: none;
}
button.btn:hover, a.btn:hover { background: var(--primary-dark); }
button.btn.secondary { background: #fff; color: var(--dark); border: 1px solid var(--border); }
button.btn:disabled { background: var(--booked); cursor: not-allowed; }
.btn-swap {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items:center; justify-content:center;
  cursor: pointer;
  margin: 0 auto 14px;
}

.trip-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.trip-item .route-name { font-weight: 700; }
.trip-item .meta { color: var(--gray); font-size: 0.85rem; }
.trip-item .fare { font-weight: 700; color: var(--primary); font-size: 1.1rem; }

/* Seat map */
.bus-frame {
  border: 2px solid var(--dark);
  border-radius: 24px 24px 10px 10px;
  padding: 20px 14px;
  max-width: 320px;
  margin: 0 auto;
  background: #fff;
}
.seat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.seat, .driver-slot, .empty-slot {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.seat {
  border: 2px solid var(--gray);
  background: var(--available);
  cursor: pointer;
  color: var(--dark);
}
.seat.booked { background: var(--booked); border-color: var(--booked); color: #98a2b3; cursor: not-allowed; }
.seat.selected { background: var(--selected); border-color: var(--selected); color: #fff; }
.driver-slot { border: 2px dashed var(--gray); color: var(--gray); font-size: 0.7rem; }
.empty-slot { visibility: hidden; }

.legend { display: flex; gap: 16px; justify-content: center; margin-top: 16px; font-size: 0.8rem; color: var(--gray); flex-wrap: wrap; }
.legend span { display:flex; align-items:center; gap:6px; }
.legend .box { width: 16px; height:16px; border-radius: 4px; display:inline-block; }

.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.95rem; }
.summary-row.total { font-weight: 700; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; }

.alert { padding: 12px; border-radius: 8px; margin-bottom: 14px; font-size: 0.9rem; }
.alert.error { background: #fef3f2; color: var(--primary-dark); border: 1px solid #fda29b; }
.alert.success { background: #ecfdf3; color: #027a48; border: 1px solid #6ce9a6; }

.spinner { text-align:center; padding: 20px; color: var(--gray); }

.small-box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.small-box {
  border-radius: var(--radius);
  overflow: hidden;
  color: #fff;
  box-shadow: 0 2px 6px rgba(16,24,40,0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.small-box .inner { padding: 18px 20px 6px; position: relative; }
.small-box .inner h3 { font-size: 2.1rem; font-weight: 800; margin: 0 0 4px; line-height: 1; }
.small-box .inner p { margin: 0; font-size: 0.95rem; opacity: 0.95; }
.small-box .icon {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 2.6rem;
  opacity: 0.35;
}
.small-box .footer {
  background: rgba(0,0,0,0.15);
  padding: 10px 20px;
}
.small-box .footer a {
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.small-box.bg-cyan   { background: #17a2b8; }
.small-box.bg-cyan   .footer { background: #128a9c; }
.small-box.bg-green  { background: #28a745; }
.small-box.bg-green  .footer { background: #21883a; }
.small-box.bg-yellow { background: #f0ad00; color: #3a2c00; }
.small-box.bg-yellow .footer { background: #d69700; }
.small-box.bg-yellow .footer a { color: #3a2c00; }
.small-box.bg-red    { background: #dc3545; }
.small-box.bg-red    .footer { background: #bd2130; }
.small-box.bg-purple { background: #6f42c1; }
.small-box.bg-purple .footer { background: #5c36a3; }
.small-box.bg-navy   { background: #1d2939; }
.small-box.bg-navy   .footer { background: #10151d; }
.small-box.bg-teal   { background: #20c997; }
.small-box.bg-teal   .footer { background: #1aa87f; }

.container.wide { max-width: 1140px; }

.section-heading { margin: 26px 0 12px; font-size: 1.05rem; color: var(--dark); }

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

table.admin-table th, table.admin-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }
table.admin-table th { color: var(--gray); font-size: 0.8rem; text-transform: uppercase; }

.tag { display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.tag.seq { background: #eef2ff; color: #3538cd; }

.ticket-box { border: 2px dashed var(--dark); border-radius: var(--radius); padding: 20px; text-align: center; }
.ticket-box .pnr { font-size: 1.6rem; font-weight: 800; letter-spacing: 2px; color: var(--primary); margin: 10px 0; }

nav.admin-nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border); }
nav.admin-nav a { white-space: nowrap; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--dark); font-size: 0.85rem; font-weight: 600; }
nav.admin-nav a.active, nav.admin-nav a:hover { background: var(--dark); color: #fff; }

.flex-between { display:flex; justify-content: space-between; align-items:center; gap: 10px; flex-wrap: wrap;}
.small { font-size: 0.8rem; color: var(--gray); }

@media (max-width: 420px) {
  .form-row { flex-direction: column; gap: 0; }
}
