/* ===== Taxireza theme — light & airy · navy #1e40af + amber #f59e0b ===== */
:root {
  color-scheme: light;
  --pri: #1e40af;
  --pri-2: #2563eb;
  --pri-hover: #1d4ed8;
  --accent: #f59e0b;        /* amber — main CTA */
  --accent-hover: #d97706;
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #94a3b8;
  --muted-2: #cbd5e1;
  --bg: #f1f5f9;
  --bg-2: #e9eef5;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #f59e0b;
  --blue: #2563eb;
  --radius: 18px;
  --shadow: 0 6px 28px -6px rgba(37,99,235,.14);
  --shadow-lg: 0 22px 50px -18px rgba(15,23,42,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.display { font-family: "Outfit", "Plus Jakarta Sans", system-ui, sans-serif; }

/* ---- header ---- */
.nav {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 26px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30; box-shadow: 0 4px 20px -12px rgba(15,23,42,.25);
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo-box {
  position: relative; width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(140deg, var(--pri-2), var(--pri)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px -6px rgba(30,64,175,.5); flex-shrink: 0;
}
.logo-box svg { width: 24px; height: 24px; }
.status-dot { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; }
.status-dot .ping { position: absolute; inset: 0; border-radius: 50%; background: #4ade80; opacity: .7; animation: ping 1.4s cubic-bezier(0,0,.2,1) infinite; }
.status-dot .core { position: absolute; inset: 0; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
.brand-word { font-family: "Outfit", sans-serif; font-weight: 800; font-size: 23px; letter-spacing: -.5px; color: var(--ink); }
.brand-word .hl { color: var(--pri); }
.brand-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-bottom: 2px; }
.nav-tabs { margin-left: auto; display: flex; gap: 6px; }
.tab { color: var(--ink-2); font-weight: 600; padding: 8px 15px; border-radius: 11px; transition: .15s; }
.tab:hover { color: var(--pri); background: rgba(37,99,235,.07); }
.tab.active { color: #fff; background: var(--pri); }

.wrap { max-width: 1000px; margin: 0 auto; padding: 30px 22px 40px; }
.page-head { margin-bottom: 22px; }
h1 { font-family: "Outfit", sans-serif; font-size: clamp(25px, 4vw, 33px); margin: 0 0 6px; letter-spacing: -.7px; color: var(--ink); }
h2 { font-family: "Outfit", sans-serif; font-size: 19px; margin: 32px 0 14px; color: var(--ink); }
.sub { color: var(--ink-2); margin: 0; font-size: 15px; }
code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }

/* ---- form ---- */
.form-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
.field.half { grid-column: span 1; }
.field { position: relative; min-width: 0; }
label.lab { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 0 0 7px; text-transform: uppercase; letter-spacing: .5px; }
.inp-wrap { position: relative; }
.inp-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--pri); pointer-events: none; }
.inp-wrap input { padding-left: 40px; }
input, select {
  width: 100%; background: #fff; border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none; transition: .15s; font-family: inherit;
}
input::placeholder { color: var(--muted); }
input:focus, select:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }

.veh-select { margin-top: 16px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { background: transparent; color: var(--ink-2); border: 0; padding: 9px 18px; cursor: pointer; font-weight: 700; font-size: 14px; border-radius: 9px; transition: .15s; font-family: inherit; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--pri); color: #fff; box-shadow: 0 4px 10px -3px rgba(30,64,175,.45); }
.seg-veh { width: 100%; }
.seg-veh button { flex: 1; }

.btn {
  margin-top: 20px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: #fff; font-weight: 800; border: 0; cursor: pointer; font-family: "Outfit", sans-serif;
  border-radius: 13px; padding: 15px 22px; font-size: 16.5px; transition: .15s; box-shadow: 0 12px 26px -10px rgba(245,158,11,.6);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .6; cursor: default; transform: none; }
.btn-ic { width: 19px; height: 19px; }
.note { color: var(--muted); font-size: 12.5px; margin: 12px 2px 0; }

/* ---- autocomplete ---- */
.ac { position: absolute; z-index: 40; top: 100%; left: 0; right: 0; margin-top: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); }
.ac-tabs { display: flex; border-bottom: 1px solid var(--line-2); }
.ac-tabs button { flex: 1; background: transparent; border: 0; padding: 10px 6px; font-family: inherit; font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; transition: .15s; }
.ac-tabs button:hover { color: var(--ink); }
.ac-tabs button.active { color: var(--pri); border-bottom-color: var(--pri); }
.ac-list { max-height: 264px; overflow-y: auto; padding: 5px; }
.ac-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 10px; cursor: pointer; border-radius: 10px; font-family: inherit; }
.ac-row:hover, .ac-row.hl { background: rgba(37,99,235,.07); }
.ac-row .ic { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.ac-txt { display: flex; flex-direction: column; min-width: 0; }
.ac-row .name { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-row .sub { font-size: 11.5px; color: var(--muted); }
.ac-credit { padding: 8px 13px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line-2); }
.ac-credit b { color: var(--ink-2); font-weight: 700; }
.ac-empty { padding: 13px; color: var(--muted); font-size: 13.5px; }

/* ---- result ---- */
#out { margin-top: 22px; }
.result-summary { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; color: var(--ink-2); }
.chip b { color: var(--ink); font-weight: 700; }
.route-line { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.route-line .pt { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.route-line .pt .ic { width: 16px; text-align: center; }
.route-line .pt b { font-weight: 600; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.badge.forfait { background: rgba(37,99,235,.12); color: var(--pri); }
.badge.ld, .badge.devis { background: rgba(245,158,11,.16); color: var(--accent-hover); }
.badge.metered { background: rgba(22,163,74,.13); color: var(--green); }
.badge.nuit { background: rgba(71,85,105,.14); color: var(--ink-2); }

.veh-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.veh-cards.single { grid-template-columns: minmax(0, 460px); justify-content: center; }
.vcard { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.vcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--pri), var(--pri-2)); }
.vcard .vhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.vcard .vname { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.vcard .vname .em { font-size: 22px; }
.vcard .vtotal-lab { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px; }
.vcard .vtotal { font-family: "Outfit", sans-serif; font-size: 44px; font-weight: 800; line-height: 1; color: var(--pri); letter-spacing: -1.5px; margin: 2px 0; }
.vcard .vrange { color: var(--ink-2); font-size: 13px; }
.split { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 14px; }
.split .s { flex: 1; }
.split .s .k { color: var(--ink-2); font-size: 12px; }
.split .s .v { font-weight: 800; font-size: 18px; }
.split .s .v.drv { color: var(--ink); }
.split .s .v.com { color: var(--green); }
.splitbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: 14px; background: var(--bg-2); }
.splitbar .sb-drv { background: linear-gradient(90deg,#64748b,#94a3b8); }
.splitbar .sb-com { background: linear-gradient(90deg,#16a34a,#4ade80); }
.splitbar-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.note-card { margin-top: 16px; color: var(--ink-2); font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 12px; padding: 14px 16px; }
.loading { display: flex; align-items: center; gap: 12px; color: var(--ink-2); }
.spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(37,99,235,.2); border-top-color: var(--pri); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px; border-top: 1px solid var(--line); margin-top: 30px; }

/* ---- back-test page ---- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.stat .n { font-family: "Outfit", sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
.stat .l { color: var(--ink-2); font-size: 11.5px; margin-top: 3px; line-height: 1.3; }
.stat .n.good { color: var(--green); } .stat .n.warn { color: var(--accent-hover); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line-2); }
th { color: var(--ink-2); font-weight: 700; position: sticky; top: 56px; background: #fff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--bg-2); }
.delta-pos { color: var(--accent-hover); font-weight: 700; }
.delta-neg { color: var(--blue); font-weight: 700; }
.delta-big { color: var(--red); font-weight: 700; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.toolbar { display: flex; gap: 12px; align-items: center; margin: 8px 0 14px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 300px; }
.hbtn { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; padding: 9px 14px; font-weight: 600; font-size: 13px; cursor: pointer; transition: .15s; font-family: inherit; }
.hbtn:hover { background: var(--bg-2); }
.hbtn.danger { color: var(--red); border-color: #fecaca; }
.hbtn.danger:hover { background: #fef2f2; }

/* ---- history table ---- */
#history td { vertical-align: top; }
#history .h-time { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13px; }
#history .h-route { color: var(--ink); }
#history .h-route .arr { color: var(--muted); }
#history .h-veh { white-space: nowrap; }
#history .h-price { font-family: "Outfit", sans-serif; font-weight: 800; font-size: 15px; color: var(--pri); }
#history .h-sub { font-size: 11px; color: var(--ink-2); margin-top: 2px; }
#history .h-empty { padding: 26px 14px; text-align: center; color: var(--muted); }
#history .badge { text-transform: none; letter-spacing: 0; }

@media (max-width: 760px) {
  .form-grid, .veh-cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .nav { padding: 11px 16px; gap: 12px; }
  .brand-pill { display: none; }
  .wrap { padding: 22px 16px 30px; }
}
