:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f0f3f1;
  --border: #e2e8e4;
  --text: #16201b;
  --muted: #647067;
  --primary: #0c7a4d;
  --primary-hover: #0a6541;
  --primary-soft: #e3f3ec;
  --accent: #f4a52a;
  --danger: #d23f3f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 24, .04), 0 8px 24px rgba(16, 32, 24, .06);
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav a, .nav .navlink {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--primary); background: var(--primary-soft); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  padding: 11px 18px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  width: auto;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b83434; }
.btn-accent { background: var(--accent); color: #3a2a06; }
.btn-accent:hover { background: #e0961f; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.card-sub { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }

/* ===== Forms ===== */
.field { margin-bottom: 14px; }
.label {
  display: block;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 6px;
  color: var(--text);
}
.input, .select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }
.input-affix {
  position: relative;
}
.input-affix .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 700; font-size: .9rem;
}
.input-affix .input { padding-left: 38px; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 14px;
  border-radius: 11px;
  font-size: .9rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: #fdeaea; color: #8c2b2b; border-color: #f6cfcf; }
.alert-success { background: var(--primary-soft); color: #0a5e3c; border-color: #bfe3d3; }
.alert-info { background: #eaf2fb; color: #2a5685; border-color: #cfe0f6; }

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-logo {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 22px; text-align: center;
}
.auth-logo .logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--primary);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.4rem;
}
.auth-foot { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--muted); }

.page { padding: 22px 0 80px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 2px; font-size: 1.5rem; font-weight: 800; }
.page-head p { margin: 0; color: var(--muted); }

/* ===== Dashboard / Argo ===== */
.argo-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

#map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.search-row { position: relative; margin-bottom: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.dot-origin { background: var(--primary); }
.dot-dest { background: var(--accent); }
.search-line { display: flex; align-items: center; gap: 10px; }

.suggestions {
  position: absolute;
  z-index: 30;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.suggestions.show { display: block; }
.sug-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.sug-item:last-child { border-bottom: 0; }
.sug-item:hover, .sug-item.active { background: var(--primary-soft); }
.sug-item .t { font-weight: 600; font-size: .92rem; }
.sug-item .s { font-size: .78rem; color: var(--muted); }

.fare-display {
  text-align: center;
  padding: 8px 0 4px;
}
.fare-display .amount {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}
.fare-display .label { color: var(--muted); font-size: .85rem; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: .78rem; font-weight: 700;
}
.badge-night { background: #ece6fb; color: #5b3fa0; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.stat {
  flex: 1 1 0;
  min-width: 90px;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 12px;
  text-align: center;
}
.stat .v { font-weight: 800; font-size: 1.1rem; }
.stat .k { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.breakdown { border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 12px; }
.brk-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .92rem; }
.brk-row .k { color: var(--muted); }
.brk-row.total { font-weight: 800; font-size: 1.05rem; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }

/* ===== Table / History ===== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
table.tbl tr:last-child td { border-bottom: 0; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty .ic { font-size: 2rem; margin-bottom: 8px; opacity: .5; }

/* ===== Landing ===== */
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 { font-size: 2.1rem; font-weight: 800; margin: 0 0 14px; line-height: 1.15; }
.hero p { font-size: 1.05rem; color: var(--muted); max-width: 560px; margin: 0 auto 26px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: 1fr; gap: 16px; padding-bottom: 56px; }
.feature .ic {
  width: 42px; height: 42px; border-radius: 11px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; margin-bottom: 12px; font-weight: 800;
}
.feature h3 { margin: 0 0 6px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 2.6rem; }
}
@media (min-width: 900px) {
  .argo-grid { grid-template-columns: 1.3fr 1fr; align-items: start; }
  #map { height: 460px; }
}

/* mobile nav toggle */
.nav-toggle { display: none; }
@media (max-width: 560px) {
  .nav { gap: 2px; }
  .nav a, .nav .navlink { padding: 7px 9px; font-size: .82rem; }
  .nav .hide-sm { display: none; }
}
