:root {
  --yellow: #ffd700; --brand: #ff8c1a; --dark: #222d32; --dark2: #1a2226; --bg: #ecf0f5; --line: #d8dee6; --text: #2b3238; --muted: #7a8590;
  --blue: #3c8dbc; --teal: #2f8f8f; --green: #00a65a; --orange: #f39c12; --red: #c0392b; --purple: #8e3a7c;
  --row-green: #c9ee9d; --row-orange: #ffd28a;
  --side-w: 225px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 "Source Sans Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 400; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
svg.i { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }

/* shell */
.top { position: fixed; inset: 0 0 auto 0; height: 52px; background: var(--brand); display: flex; align-items: center; z-index: 20; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.brand { width: var(--side-w); padding: 0 16px; font-weight: 800; font-size: 20px; letter-spacing: 1px; color: var(--dark); display: flex; flex-direction: column; line-height: 1; }
.brand small { font-size: 9px; letter-spacing: 3px; font-weight: 600; margin-top: 3px; }
.burger { background: none; border: 0; font-size: 20px; padding: 8px 12px; cursor: pointer; color: var(--dark); }
.top .sp { flex: 1; }
.userbtn { background: none; border: 0; padding: 0 16px; height: 52px; cursor: pointer; font: inherit; font-weight: 600; color: var(--dark); }
.userbtn:hover { background: rgba(0,0,0,.08); }
.side { position: fixed; top: 52px; bottom: 0; left: 0; width: var(--side-w); background: var(--dark); color: #b8c7ce; overflow-y: auto; z-index: 10; transition: transform .2s; }
.side .who { padding: 14px 16px; border-bottom: 1px solid #1a2226; color: #fff; }
.side .who b { display: block; } .side .who span { font-size: 11px; color: #9fb0b9; }
.side .sec { background: var(--dark2); padding: 8px 16px; font-size: 11px; color: #6c7a82; text-transform: uppercase; letter-spacing: .5px; }
.side a { display: flex; gap: 10px; align-items: center; padding: 11px 16px; color: #b8c7ce; font-size: 14px; border-left: 3px solid transparent; }
.side a:hover { color: #fff; text-decoration: none; background: #1e282c; }
.side a.on { color: #fff; background: #1e282c; border-left-color: var(--brand); }
.main { margin-left: var(--side-w); padding: 66px 14px 40px; transition: margin .2s; }
body.nav-hidden .side { transform: translateX(-100%); } body.nav-hidden .main { margin-left: 0; }
@media (max-width: 800px) { .side { transform: translateX(-100%); } .main { margin-left: 0; } body.nav-open .side { transform: none; box-shadow: 4px 0 16px rgba(0,0,0,.35); } .brand { width: auto; } }

/* cards / grid */
.page-h { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.page-h .sp { flex: 1; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 3px; margin-bottom: 14px; }
.card .pad { padding: 12px 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; background: #fff; padding: 24px; border-radius: 3px; }
.tile { border: 1px solid var(--c); border-radius: 2px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tile h3 { margin: 0; padding: 12px; text-align: center; color: #fff; background: var(--c); font-size: 19px; font-weight: 500; }
.tile a { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 11px; font-size: 16px; color: var(--c); }
.tile.t-blue { --c: var(--blue); } .tile.t-green { --c: var(--green); } .tile.t-mint { --c: #46b79a; } .tile.t-red { --c: var(--red); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; }
.filters label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.filters > div { min-width: 0; max-width: 100%; }
.filters .grp { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tgrp { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
input[type=date], input[type=time] { min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #f4f6f8; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar .sp { flex: 1; }
.tbl-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 10px 14px; }

input[type=text], input[type=search], input[type=date], input[type=time], input[type=number], input[type=email], input[type=password], select, textarea {
  font: inherit; padding: 6px 9px; border: 1px solid #c4ccd4; border-radius: 3px; background: #fff; color: var(--text); max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(60,141,188,.35); border-color: var(--blue); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
input:disabled, select:disabled { background: #eef1f4; color: #8a949d; }

.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; padding: 6px 12px; border: 1px solid transparent; border-radius: 3px; cursor: pointer; color: #fff; background: #777; line-height: 1.2; }
.btn:hover { filter: brightness(.93); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.blue { background: var(--blue); } .btn.teal { background: var(--teal); } .btn.green { background: var(--green); } .btn.orange { background: var(--orange); }
.btn.red { background: var(--red); } .btn.cyan { background: #00c0ef; } .btn.yellow { background: var(--yellow); color: var(--dark); } .btn.light { background: #fff; color: var(--text); border-color: #c4ccd4; }
.btn.on { box-shadow: 0 0 0 3px rgba(0,0,0,.28); }
.btn.sm { padding: 3px 8px; font-size: 12px; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; background: #fff; }
table.t th { text-align: left; padding: 10px 8px; border-bottom: 2px solid #222; font-size: 14px; white-space: nowrap; vertical-align: bottom; }
table.t th[data-sort] { cursor: pointer; user-select: none; } table.t th[data-sort]:hover { background: #f4f6f8; }
table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tbody tr:hover td { filter: brightness(.97); }
tr.row-assigned td { background: var(--row-green); } tr.row-transit td { background: var(--row-orange); }
.tag { color: var(--red); font-weight: 700; } .plate { background: #fff200; padding: 0 3px; font-weight: 600; white-space: nowrap; }
.sub { font-size: 12px; color: #8a949d; display: block; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px; }
.pager .pg { display: flex; gap: 4px; }
.acts { display: flex; gap: 4px; flex-wrap: wrap; min-width: 108px; }
.iconbtn { border: 0; background: none; cursor: pointer; font-size: 17px; padding: 3px; color: var(--blue); border-radius: 3px; }
.iconbtn:hover { background: rgba(0,0,0,.08); } .iconbtn.del { color: var(--red); } .iconbtn.flag { color: #1b9cd8; } .iconbtn.ok { color: var(--green); }
.kmtotal { font-weight: 700; padding: 8px 14px 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; color: #fff; background: #777; }
.badge.sediu { background: var(--teal); } .badge.tranzit { background: var(--orange); } .badge.desc { background: var(--green); } .badge.in { background: var(--blue); } .badge.out { background: #00a65a; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* modal */
.ov { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 30px 12px; }
.modal { background: #fff; border-radius: 4px; width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.modal.wide { max-width: 1040px; }
.modal > header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f7f8fa; border-radius: 4px 4px 0 0; }
.modal > header h2 { margin: 0; font-size: 18px; font-weight: 600; flex: 1; }
.modal > .body { padding: 14px 16px; }
.modal > footer { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #f7f8fa; border-radius: 0 0 4px 4px; }

/* forms */
.frow { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; align-items: start; margin-bottom: 11px; }
.frow > label { font-weight: 700; padding-top: 7px; text-align: right; font-size: 13px; }
.frow .ctl { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; min-width: 0; }
.frow .ctl.full > input, .frow .ctl.full > select { flex: 1; min-width: 160px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; cursor: pointer; } .chk input { margin: 0; }
.fgrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.sect { font-weight: 700; margin: 18px 0 10px; padding-bottom: 4px; border-bottom: 2px solid var(--brand); text-transform: uppercase; font-size: 12px; letter-spacing: .5px; color: #555; }
.rel { position: relative; flex: 1; min-width: 220px; display: flex; gap: 6px; }
.rel > input { flex: 1; min-width: 0; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: #fff; border: 1px solid #b6c0ca; border-top: 0; max-height: 240px; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,.18); display: none; }
.suggest div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #eef1f4; } .suggest div:hover, .suggest div.act { background: #e9f3fa; } .suggest div.muted { cursor: default; }
.addr3 { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; } .addr3 input { min-width: 0; }
.warn { background: #fdecea; border: 1px solid #e8a39b; color: #8e2a1f; padding: 8px 12px; border-radius: 3px; margin-bottom: 12px; font-weight: 600; }
.res-t { width: 100%; border-collapse: collapse; } .res-t th { font-size: 12px; text-align: left; padding: 6px; border-bottom: 2px solid #222; } .res-t td { padding: 5px 4px; border-bottom: 1px solid var(--line); } .res-t select, .res-t input { width: 100%; }
dl.info { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; } dl.info dt { font-weight: 700; text-align: right; color: #555; } dl.info dd { margin: 0; }
@media (max-width: 700px) { .frow { grid-template-columns: 1fr; } .frow > label { text-align: left; padding-top: 0; } dl.info { grid-template-columns: 1fr; } dl.info dt { text-align: left; } }

#toasts { position: fixed; right: 14px; bottom: 14px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--dark); color: #fff; padding: 10px 14px; border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.3); max-width: 360px; border-left: 4px solid var(--green); }
.toast.err { border-left-color: var(--red); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login .box { background: #fff; width: 100%; max-width: 360px; border-radius: 4px; box-shadow: 0 4px 24px rgba(0,0,0,.12); overflow: hidden; }
.login .hd { background: var(--brand); padding: 20px; text-align: center; font-weight: 800; font-size: 24px; letter-spacing: 1px; color: var(--dark); }
.login .hd small { display: block; font-size: 10px; letter-spacing: 3px; font-weight: 600; }
.login form { padding: 20px; display: grid; gap: 12px; } .login input { width: 100%; padding: 9px 10px; }
.login .err { color: var(--red); font-weight: 600; min-height: 1.2em; }

.autoline { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.autoline .iconbtn { font-size: 14px; padding: 2px 3px; }
.plate.deliver { background: #8fd3ff; }
.tsel { display: inline-flex; align-items: center; gap: 3px; } .tsel select { width: 68px; }
.tend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.loss { color: #c0392b; font-weight: 700; white-space: nowrap; }
tr.row-sold td { background: #b5efd6; }
.extra-stop { margin-top: 6px; padding-top: 4px; border-top: 1px dashed #b9c2ca; } .stop-block { background: #f6f8fa; border-left: 3px solid var(--brand); margin: 6px 0; padding: 4px 0; }
