:root {
  --violet: #6d5efc;
  --violet-dark: #5646e6;
  --ink: #1c1b29;
  --muted: #6b7280;
  --line: #ececf3;
  --paper: #ffffff;
  --wash: #eef0f6;
  --green: #16a34a;
  --amber: #ea8c1e;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--wash);
}
a { color: var(--violet-dark); }
button, input, select { font: inherit; }
code, .code {
  font-family: Consolas, "Courier New", monospace;
  background: #eef0ff;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.desk-body { height: 100%; overflow: hidden; background: var(--wash); }
.desk { height: 100%; display: flex; min-height: 0; }
.rail {
  width: 248px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: #f7f7fb;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 22px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  font-size: 1.15rem;
}
.rail-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--violet);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
}
.rail nav { display: flex; flex-direction: column; gap: 4px; }
.rail nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #6b7280;
  text-decoration: none;
  font-weight: 600;
}
.rail nav a svg { width: 20px; height: 20px; flex: none; }
.rail nav a.active, .rail nav a:hover { background: #fff; color: var(--ink); }
.rail nav a.active { background: var(--violet); color: #fff; }
.rail-out {
  margin-top: auto;
  padding: 12px 14px;
  color: #6b7280;
  text-decoration: none;
  font-weight: 600;
}
.desk-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin: 14px 14px 14px 0;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(28, 27, 41, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.desk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 24px 8px;
}
.desk-head h1 { margin: 0; font-size: 1.55rem; }
.desk-head p { margin: 4px 0 0; color: var(--muted); }
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  font-weight: 700;
  white-space: nowrap;
}
.who::before {
  content: "";
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(160deg, #c4b5fd, var(--violet));
}
.desk-body-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.desk-body-inner:not(:has(#map)) { overflow: auto; }
.desk-body-inner > .flash {
  position: absolute;
  z-index: 800;
  top: 8px;
  left: 16px;
  right: 16px;
  margin: 0;
}
.flash, .error {
  background: #fff7e8;
  border: 1px solid #f0d7a4;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
}
.error { margin: 0 0 0.8rem; }

.board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
}
.vcol {
  min-height: 0;
  overflow: auto;
  padding: 8px 16px 20px;
  border-right: 1px solid var(--line);
}
.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f7f7fb;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.vcard {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  background: #fff;
}
.vcard.selected { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.vcard-top, .vcard-foot, .vcard-body { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vcard-top { color: var(--muted); font-size: 0.86rem; margin-bottom: 10px; }
.vcard-top strong { color: var(--ink); }
.vcard-body { justify-content: flex-start; }
.vcard-body img, .ph {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: #efeefe;
}
.ph { display: inline-block; position: relative; }
.ph::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 16px;
  width: 24px;
  height: 12px;
  border-radius: 4px 4px 3px 3px;
  background: var(--violet);
}
.ph-trotineta::before { width: 22px; height: 8px; top: 19px; border-radius: 8px; background: var(--amber); }
.ph-telefon::before { width: 12px; height: 20px; left: 17px; top: 13px; border-radius: 3px; background: #14556b; }
.vcard-body b, .vcard-body small { display: block; }
.vcard-body small { color: var(--muted); font-weight: 500; margin-top: 2px; }
.vcard-foot { margin-top: 12px; color: var(--muted); font-size: 0.86rem; }
.vcard-foot a { font-weight: 700; text-decoration: none; }
.pill {
  margin-left: auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.pill-on { background: #e9f9ef; color: var(--green); }
.pill-soon { background: #fff3e6; color: var(--amber); }
.pill-off { background: #f3f4f6; color: #6b7280; }

.map-wrap { position: relative; min-height: 480px; height: 100%; }
#map { position: absolute; inset: 0; background: #e7eef5; }
.leaflet-container { font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.gps-pin { background: transparent; border: 0; }
.map-note {
  position: absolute;
  z-index: 600;
  top: 14px;
  left: 14px;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(20, 20, 40, 0.12);
  color: #9f1239;
  font-weight: 700;
}
.legend {
  position: absolute;
  z-index: 500;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(20, 20, 40, 0.12);
  font-size: 0.78rem;
  color: var(--muted);
}
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 6px; border-radius: 99px; display: inline-block; }
.c0 { background: #94a3b8; }
.c1 { background: #22c55e; }
.c2 { background: #f59e0b; }
.c3 { background: #ef4444; }
.detail {
  position: absolute;
  z-index: 500;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(20, 20, 40, 0.16);
}
.detail[hidden] { display: none; }
.detail-head, .detail-grid { display: flex; justify-content: space-between; gap: 12px; }
.detail-head h2 { margin: 0; font-size: 1.2rem; }
.detail-head p, .detail-head small { margin: 2px 0 0; color: var(--muted); }
.detail-head a { font-weight: 700; text-decoration: none; align-self: center; }
.detail-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0; }
.detail-grid dt { color: var(--muted); font-size: 0.78rem; }
.detail-grid dd { margin: 2px 0 0; font-weight: 700; }
.daypick { font-size: 0.86rem; color: var(--muted); }
.daypick select { margin-left: 8px; }
.route-sum { margin: 8px 0 0; color: var(--muted); }
.detail-photo {
  border-radius: 16px;
  background: #f4f5fb center / cover no-repeat;
  min-height: 120px;
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; display: block; }
.veh-icon { background: transparent; border: 0; }
.veh {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(20, 20, 40, 0.28);
  display: grid;
  place-items: center;
}
.veh.selected { border-color: var(--violet); }
.veh svg { width: 28px; height: 28px; display: block; }

.map-layout { position: absolute; inset: 0; }
.side {
  position: absolute;
  z-index: 500;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 380px;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(20, 20, 40, 0.12);
  padding: 0.2rem 0.2rem 1rem;
}
.content { padding: 8px 24px 32px; }
.content.tight { padding-bottom: 0.4rem; }
.side .content { padding: 0.8rem 1rem 1.2rem; }
.empty-fleet { max-width: 560px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem; }
.stats article { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem; }
.stats span { display: block; color: var(--muted); font-size: 0.85rem; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 0.65rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td small { display: block; color: var(--muted); }
.filters, .form, .split { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; }
.form { flex-direction: column; align-items: stretch; max-width: 560px; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.92rem; }
input, select {
  border: 1px solid #d9dbe7;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: #fff;
}
button, .button {
  background: var(--violet);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}
.form-photo { width: 160px; height: 100px; object-fit: cover; border-radius: 14px; }
.danger { margin-top: 1.5rem; }
.danger button { background: #9f1239; }
fieldset { border: 1px solid var(--line); border-radius: 12px; }
.days { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 0.7rem; }
.check { flex-direction: row; align-items: center; }
.muted, .hint { color: var(--muted); }

.login-body { background: #fff; }
.login { display: flex; min-height: 100%; }
.login-side {
  width: 360px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(165deg, #c4b5fd 0%, #6d5efc 46%, #4338ca 100%);
}
.login-side .logo { width: 220px; }
.login-paper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-form { width: min(420px, calc(100% - 3rem)); }
.login-form h1 { margin: 0 0 0.4rem; font-size: 1.6rem; }
.login-form p { color: var(--muted); }
.login-form .form { max-width: none; }
.login-form button { width: 100%; margin-top: 0.4rem; padding: 0.75rem 1rem; }
.logo { width: 132px; height: auto; display: block; }

@media (max-width: 980px) {
  .desk { display: block; height: auto; min-height: 100%; }
  .desk-body { overflow: auto; }
  .rail { width: auto; flex-direction: row; align-items: center; gap: 8px; overflow: auto; }
  .rail nav { flex-direction: row; }
  .rail-brand { margin: 0 8px 0 0; }
  .rail-out { margin: 0 0 0 auto; }
  .desk-main { margin: 0; border-radius: 0; min-height: calc(100vh - 72px); }
  .board { display: flex; flex-direction: column; }
  .vcol { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .map-wrap { min-height: 70vh; }
  .detail, .detail-grid { display: block; }
  .detail-photo { margin-top: 12px; height: 140px; }
  .legend { flex-wrap: wrap; left: 10px; right: auto; }
  .side { top: auto; left: 8px; right: 8px; width: auto; height: 46%; }
  .login { display: block; }
  .login-side { width: auto; min-height: 140px; }
}
