:root {
  --green: #8cc63f;
  --green-dark: #79b02e;
  --ink: #23282d;
  --muted: #7c848c;
  --line: #e4e7e9;
  --bg: #f6f7f5;
  --card: #ffffff;
  --danger: #d64545;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(35, 40, 45, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

a { color: #2f7de1; text-decoration: none; }
a:hover { text-decoration: underline; }

.logo { display: inline-block; color: var(--ink); }
.logo img { display: block; height: 46px; width: auto; }

/* ---------- client login ---------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(28px, 8vw, 120px);
  max-width: 640px;
  width: 100%;
  margin-left: auto;
}

.login-left .logo { margin-bottom: 44px; }
.login-left h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
.login-left .lead { color: var(--muted); margin: 0 0 34px; }

.field { margin-bottom: 22px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 2px 10px;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--green); }

.pass { position: relative; }
.pass input { padding-right: 40px; }
.eye {
  position: absolute;
  right: 0;
  bottom: 8px;
  border: 0;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  line-height: 0;
}
.eye:hover { color: var(--ink); }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 26px;
  font-size: 13px;
}
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.check input { accent-color: var(--green); width: 16px; height: 16px; }

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 18px;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .6; cursor: default; }

.error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 13px;
}

.legal {
  margin-top: 22px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.login-right {
  background: #fafbf8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
  border-left: 1px solid #f0f1ee;
}

.promo {
  width: min(420px, 100%);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #dfe4dc;
}
.promo svg { display: block; width: 100%; height: auto; }

.login-right h2 {
  font-size: 26px;
  line-height: 1.25;
  margin: 34px 0 12px;
  max-width: 460px;
}
.login-right p {
  color: var(--muted);
  max-width: 420px;
  margin: 0 0 24px;
  font-size: 14px;
}
.ghost {
  display: inline-block;
  border: 1px solid #c9cec6;
  border-radius: 6px;
  padding: 10px 18px;
  color: var(--ink);
  font-size: 14px;
  background: #fff;
}
.ghost:hover { text-decoration: none; border-color: var(--green); color: var(--green-dark); }

/* ---------- admin login ---------- */

.admin-body {
  background: #f1f2f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.admin-body .logo img { height: 44px; }
.admin-body .logo { margin-bottom: 18px; }

.admin-card {
  width: 100%;
  max-width: 350px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(35, 40, 45, .10);
  border-top: 5px solid var(--green);
}

.admin-card form { padding: 26px 24px 24px; }
.admin-card h1 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .16em;
  text-align: center;
  margin: 0 0 22px;
  color: #4b5157;
}
.admin-card .field { margin-bottom: 16px; }
.admin-card .field input {
  border: 1px solid #d9dcde;
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 14px;
}
.admin-card .field input:focus { border-color: var(--green); }
.admin-card .row { margin: 4px 0 18px; font-size: 12px; }
.admin-card .btn { border-radius: 2px; font-size: 14px; padding: 11px; letter-spacing: .04em; }
.admin-card .error { margin: 0 24px 14px; }

.admin-foot {
  background: #c3c7c9;
  text-align: center;
  padding: 11px;
  font-size: 12.5px;
}
.admin-foot a { color: #fff; }
.admin-foot a:hover { color: #fff; }

.to-client {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- portal ---------- */

.portal-body { background: var(--bg); }

.topbar {
  height: 58px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 5;
}
.topbar .logo { color: #fff; }
.topbar .logo img { height: 30px; }
.topbar .who { font-size: 13px; color: #c9ced3; margin-right: 16px; }
.topbar .right { display: flex; align-items: center; }
.logout {
  border: 1px solid rgba(255, 255, 255, .28);
  background: transparent;
  color: #fff;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}
.logout:hover { border-color: var(--green); color: var(--green); }

.layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  height: calc(100vh - 58px);
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0;
  padding: 18px 18px 10px;
  font-weight: 600;
}
.sidebar h2 span { color: var(--ink); }

.vehicle-list { list-style: none; margin: 0; padding: 0 10px 16px; overflow-y: auto; }
.vehicle {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.vehicle:hover { background: #f6f8f3; }
.vehicle.active { background: #f0f6e6; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c3c8cc; }
.dot.online { background: var(--green); }
.dot.offline { background: #c3c8cc; }
.vehicle .name { font-weight: 600; font-size: 14px; }
.vehicle .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.vehicle .speed { font-size: 12px; color: var(--muted); white-space: nowrap; }

.empty-note { padding: 10px 18px; color: var(--muted); font-size: 13px; }

.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #e8ece4; }

.hud {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 500;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  min-width: 260px;
  max-width: 340px;
}
.hud h3 { margin: 0 0 4px; font-size: 16px; }
.hud .sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.hud dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.hud dt { color: var(--muted); }
.hud dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.marker-pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  background: #5f676e;
}
.marker-pin.online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(140, 198, 63, .25), 0 2px 8px rgba(0, 0, 0, .35);
}

.leaflet-container { font: inherit; }

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .login-left { margin: 0; max-width: none; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}
