:root {
  --ink: #17232b;
  --muted: #68767c;
  --line: #e5e8e7;
  --canvas: #f7f8f7;
  --surface: #ffffff;
  --orange: #e51d32;
  --orange-dark: #bd1327;
  --orange-pale: #fff0f2;
  --teal: #17499b;
  --teal-pale: #eaf0ff;
  --danger: #bb3b32;
  --shadow: 0 12px 30px rgba(24, 41, 46, .07);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font-family: "DM Sans", sans-serif; }
button, input, select { font: inherit; }
textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(232, 96, 42, .3); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { background: linear-gradient(180deg, #16479d 0%, #0e2c70 100%); color: #e8efff; padding: 18px 14px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; height: 100vh; border-right: 4px solid #e51d32; }
.brand { min-height: 78px; padding: 10px; display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 9px; border-bottom: 3px solid #e51d32; box-shadow: 0 8px 18px rgba(2,22,73,.22); }
.brand img { width: min(100%, 178px); height: 52px; object-fit: contain; object-position: center; background: white; border-radius: 4px; }
.brand span { margin-left: auto; padding: 4px 7px; font-size: 10px; font-weight: 800; letter-spacing: .1em; color: #fff; background: #16479d; border-radius: 5px; }
.nav-list { display: grid; gap: 4px; padding: 20px 0; }
.nav-item { width: 100%; border: 0; background: transparent; color: #d8e5ff; border-radius: 8px; padding: 10px 11px; text-align: left; display: flex; align-items: center; gap: 11px; transition: background .18s, color .18s, transform .18s; }
.nav-item:hover { background: rgba(255,255,255,.13); color: white; }
.nav-item.active { background: #e51d32; color: white; box-shadow: 0 7px 16px rgba(56, 4, 12, .28); }
.nav-icon { width: 21px; font-size: 17px; text-align: center; }
.sidebar-footer { margin-top: auto; padding: 14px 11px 4px; font-size: 12px; color: #c7d7fa; display: flex; gap: 7px; align-items: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }

.main-area { min-width: 0; }
.topbar { min-height: 106px; padding: 26px clamp(20px, 4vw, 58px); background: rgba(255,255,255,.85); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3 { font-family: "Manrope", sans-serif; letter-spacing: -.03em; }
h1 { margin: 0; font-size: clamp(24px, 2.3vw, 32px); }
h2 { margin: 0; font-size: 21px; }
h3 { margin: 0; font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.current-user { padding: 7px 10px; border-radius: 7px; background: var(--teal-pale); color: var(--teal); font-size: 12px; font-weight: 800; white-space: nowrap; }
.primary-button, .secondary-button, .danger-button, .icon-button { border-radius: 8px; font-weight: 700; border: 1px solid transparent; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button { padding: 11px 16px; color: white; background: var(--orange); box-shadow: 0 7px 15px rgba(232,96,42,.2); }
.primary-button:hover { background: var(--orange-dark); transform: translateY(-1px); }
.secondary-button { padding: 10px 14px; color: var(--ink); background: white; border-color: #d7dddc; }
.secondary-button:hover { border-color: var(--orange); color: var(--orange-dark); }
.danger-button { padding: 9px 12px; color: var(--danger); background: #fff4f3; border-color: #f4d2ce; }
.icon-button { width: 38px; height: 38px; color: var(--ink); background: white; border-color: var(--line); }
.content { padding: clamp(22px, 4vw, 52px); max-width: 1560px; outline: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.metric-card { padding: 20px; min-height: 146px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.metric-value { margin-top: 13px; font: 800 clamp(25px, 2.4vw, 34px)/1 "Manrope", sans-serif; }
.metric-note { margin-top: 9px; color: var(--teal); font-size: 13px; font-weight: 700; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 18px; margin-top: 20px; }
.panel { padding: 21px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.subtle { color: var(--muted); font-size: 13px; }
.empty-state { padding: 36px 18px; border: 1px dashed #ccd4d3; border-radius: 10px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 5px; }
.route-preview-list { display: grid; gap: 8px; }
.route-preview { display: grid; grid-template-columns: 94px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); text-align: left; }
.route-preview:hover { border-color: var(--orange); box-shadow: 0 4px 12px rgba(232,96,42,.1); }
.route-preview strong, .route-preview small { display: block; }
.route-preview small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.route-date { color: var(--orange-dark); font-size: 12px; font-weight: 800; }
.message-batch-panel { margin: 20px 0; }
.message-batch-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(220px, .75fr); gap: 18px; align-items: stretch; }
.form-field textarea { width: 100%; min-height: 102px; resize: vertical; border: 1px solid #d5dddd; border-radius: 7px; background: #fff; padding: 10px; color: var(--ink); line-height: 1.45; }
.message-preview { padding: 15px; border-radius: 9px; background: #f5faf8; border: 1px solid #d9e8e1; }
.message-preview p { margin: 8px 0 0; color: #395256; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.batch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.batch-count { padding: 6px 9px; border-radius: 999px; background: var(--orange-pale); color: var(--orange-dark); font-size: 12px; font-weight: 800; white-space: nowrap; }
.lead-checkbox { width: 16px; height: 16px; accent-color: var(--orange); cursor: pointer; }

.section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-intro p { max-width: 640px; margin: 7px 0 0; color: var(--muted); }
.split-layout { display: grid; grid-template-columns: minmax(260px,.8fr) minmax(0,1.7fr); gap: 18px; align-items: start; }
.vehicle-list { display: grid; gap: 10px; }
.vehicle-card { width: 100%; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 14px; text-align: left; display: flex; justify-content: space-between; align-items: center; color: var(--ink); }
.vehicle-card:hover, .vehicle-card.selected { border-color: var(--orange); box-shadow: 0 5px 15px rgba(232,96,42,.1); }
.vehicle-card.selected { background: var(--orange-pale); }
.vehicle-card small { color: var(--muted); display: block; margin-top: 3px; }
.vehicle-count { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #f1f4f3; color: var(--teal); font-size: 12px; font-weight: 800; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 17px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-builder { margin: 16px 0; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #dce4e3; border-radius: 10px; background: #f8fbfa; }
.row-builder h3 { margin-top: 3px; }
.row-builder p { margin: 4px 0 0; }
.map-builder { padding: 34px 18px 18px; border: 2px solid #294c52; border-radius: 34px 34px 14px 14px; background: #ecf1f0; display: grid; gap: 10px; position: relative; min-height: 250px; }
.map-builder:before { content: "FRENTE"; position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-size: 9px; font-weight: 800; letter-spacing: .12em; color: #688085; }
.seat-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px; border-radius: 10px; }
.seat-row.selected-row { background: rgba(255,255,255,.58); box-shadow: inset 0 0 0 1px #f3b493; }
.row-label { min-height: 38px; border: 1px solid #b9c9c8; border-radius: 7px; background: #f8fbfa; color: #33565b; font-weight: 800; font-size: 12px; }
.selected-row .row-label { background: var(--orange); color: white; border-color: var(--orange); }
.row-slots { display: flex; align-items: center; gap: 9px; min-height: 44px; flex-wrap: wrap; }
.seat { border: 0; width: 74px; min-height: 43px; border-radius: 9px; font-weight: 800; color: #244047; background: white; border: 1px solid #cbd6d5; }
.seat:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.09); }
.seat.selected { outline: 3px solid rgba(232,96,42,.45); border-color: var(--orange); }
.seat.reserved { background: #ffdfc2; border-color: #ffb377; color: #9f3d13; }
.seat.blocked { background: #dae0df; border-color: #a4afae; color: #52605f; text-decoration: line-through; }
.seat-gap { width: 48px; min-height: 43px; display: grid; place-items: center; color: #6d8688; font-size: 12px; font-weight: 800; border: 1px dashed #a9bbbb; border-radius: 8px; background: rgba(255,255,255,.34); }
.row-empty { color: #708386; font-size: 13px; font-weight: 600; }
.seat-editor { margin-top: 20px; padding: 16px; background: #f7f9f8; border-radius: 10px; display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 12px; align-items: end; }
.seat-editor-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.form-field { display: grid; gap: 6px; }
.form-field label { font-size: 12px; font-weight: 800; color: #4e5e62; }
.form-field input, .form-field select { width: 100%; min-height: 40px; border: 1px solid #d5dddd; border-radius: 7px; background: white; padding: 9px 10px; color: var(--ink); }
.form-field input[type="file"] { min-height: auto; padding: 8px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.form-grid .wide { grid-column: span 2; }
.form-card { margin-top: 18px; }
.form-card form { display: grid; gap: 16px; }
.route-layout { grid-template-columns: minmax(320px, .9fr) minmax(0, 1.55fr); }
.route-form-panel { margin-top: 0; }
.lead-form-panel { margin-top: 0; }
.route-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-sale-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.route-date-value { font-size: clamp(18px, 2vw, 27px); letter-spacing: -.04em; }
.form-actions, .route-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.route-passengers-panel { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.route-passenger-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.client-picker-options { display: grid; gap: 4px; max-height: 178px; overflow-y: auto; padding: 5px; border: 1px solid #d5dddd; border-radius: 7px; background: #fff; }
.client-picker-option { width: 100%; padding: 8px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; }
.client-picker-option:hover { background: var(--orange-pale); }
.client-picker-option strong, .client-picker-option small { display: block; }
.client-picker-option small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.client-picker-empty, .client-picker-selected { display: block; padding: 8px 9px; color: var(--muted); font-size: 12px; }
.client-picker-selected { color: var(--teal); }
.passenger-list { display: grid; gap: 7px; margin-top: 14px; }
.passenger-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; border: 1px solid #e0e7e5; border-radius: 8px; background: #fafcfb; }
.passenger-item strong, .passenger-item small { display: block; }
.passenger-item small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.vacancy-chip { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; border-radius: 999px; background: #e7f6ed; color: #11643d; font-size: 12px; font-weight: 800; white-space: nowrap; }
.vacancy-chip.full { background: #fff0ef; color: #a83c34; }
.empty-state.compact { margin-top: 14px; padding: 20px 12px; font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 12px; border: 0; background: transparent; color: var(--muted); font-weight: 800; border-bottom: 2px solid transparent; }
.tab.active { color: var(--orange-dark); border-bottom-color: var(--orange); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 0 10px 11px; text-align: left; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.data-table td { padding: 14px 10px; border-top: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--teal-pale); color: var(--teal); }
.badge.pending { background: #fff3d8; color: #8f6400; }
.badge.route-progress { background: #e5f0ff; color: #1659a6; }
.badge.route-cancelled { background: #fff0ef; color: #a83c34; }
.whatsapp-link { display: inline-flex; align-items: center; padding: 7px 9px; border-radius: 7px; color: #126b41; background: #e8f7ee; border: 1px solid #bfe6cd; font-size: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.whatsapp-link:hover { background: #d8f1e2; }
.inline-link { color: var(--teal); font-size: 12px; font-weight: 700; text-decoration: none; }
.inline-link:hover { text-decoration: underline; }
.attachment-list { display: grid; gap: 5px; min-width: 150px; }
.attachment-link { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #165d7c; font-size: 12px; font-weight: 800; text-decoration: none; }
.attachment-link:hover { text-decoration: underline; }
.money-negative { color: var(--danger); font-weight: 800; }
.records-filter { margin-bottom: 15px; max-width: 300px; }
.records-filter input { width: 100%; padding: 10px; border: 1px solid #d5dddd; border-radius: 7px; }
.note { padding: 12px 14px; background: var(--orange-pale); color: #8f3a18; border-left: 3px solid var(--orange); border-radius: 5px; font-size: 13px; }

.placeholder { display: grid; min-height: 360px; place-items: center; text-align: center; }
.placeholder > div { max-width: 430px; }
.placeholder .big-icon { font-size: 42px; display: block; margin-bottom: 14px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(350px, calc(100vw - 44px)); padding: 12px 15px; background: #172f35; color: white; border-radius: 8px; box-shadow: 0 12px 28px rgba(0,0,0,.18); transform: translateY(18px); opacity: 0; pointer-events: none; transition: .22s ease; font-size: 14px; }
.toast.visible { transform: translateY(0); opacity: 1; }
.login-screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, rgba(19,44,50,.96), rgba(23,78,78,.94)); }
.login-screen[hidden] { display: none; }
.login-card { width: min(100%, 410px); display: grid; gap: 16px; padding: 32px; border: 1px solid rgba(255,255,255,.16); border-radius: 15px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.27); }
.login-card img { width: 170px; height: 48px; object-fit: cover; object-position: center top; border-radius: 4px; }
.login-card h1 { font-size: 27px; }
.login-card .subtle { margin: -9px 0 3px; }
.login-card .primary-button { width: 100%; }
.login-error { min-height: 18px; margin: -6px 0 0; color: var(--danger); font-size: 13px; font-weight: 700; }

@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .dashboard-grid, .split-layout, .route-layout, .message-batch-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .app-shell { grid-template-columns: 1fr; } .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: 250px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 12px 0 35px rgba(0,0,0,.2); } .sidebar.open { transform: translateX(0); } .topbar { min-height: 88px; padding: 18px 20px; } .content { padding: 22px 16px; } .current-user { display: none; } .topbar-actions .primary-button { padding: 10px; font-size: 0; } .topbar-actions .primary-button:first-letter { font-size: 16px; } .form-grid, .route-sale-grid, .route-passenger-form { grid-template-columns: 1fr; } .form-grid .wide { grid-column: auto; } .row-builder, .seat-editor { grid-template-columns: 1fr; display: grid; } .map-builder { padding: 31px 9px 10px; } .seat-row { grid-template-columns: 54px minmax(0, 1fr); gap: 6px; padding: 4px; } .row-label { min-height: 36px; padding: 4px; font-size: 10px; } .row-slots { gap: 5px; } .seat { width: 52px; min-height: 39px; font-size: 12px; } .seat-gap { width: 28px; min-height: 39px; } .data-table { min-width: 760px; } .table-scroll { overflow-x: auto; } }
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
