:root {
  --ink:#0f172a; --muted:#475569; --line:#cbd5e1; --bg:#f1f5f9; --card:#fff;
  --accent:#1e3a8a; --accent-ink:#fff;
  --review:#b45309; --review-bg:#fef3c7;
  --wait:#1d4ed8; --wait-bg:#dbeafe;
  --ok:#166534; --ok-bg:#dcfce7;
  --gray:#475569; --gray-bg:#e2e8f0;
  --err:#b91c1c;
}
* { box-sizing: border-box; }
body { margin:0; font:16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color:var(--ink); background:var(--bg); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.muted { color: var(--muted); }
.bar { display:flex; align-items:center; gap:16px; margin-bottom:16px; }
.bar h1 { flex:1; }
.bar form { margin:0; }
.card { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:16px; margin:0 0 16px; }
.narrow { max-width: 420px; margin: 8vh auto; display:grid; gap:16px; }
.login { max-width: 420px; margin: 12vh auto 0; display:grid; gap:16px; padding:24px; }
.login p { margin: 0; }
.row { display:flex; gap:8px; align-items:flex-end; flex-wrap:wrap; }
label { display:grid; gap:4px; font-size:.9rem; font-weight:600; color:var(--ink); }
input { font:inherit; padding:8px 12px; min-height:40px; border:1px solid #94a3b8; border-radius:8px; color:var(--ink); background:#fff; }
input[type=file] { border:0; padding:0; }
.pw { display:flex; gap:8px; font-weight:400; }
.pw input { flex:1; min-width:0; }
button, .button { font:inherit; font-size:.95rem; font-weight:600; padding:8px 14px; min-height:40px; border:1px solid #94a3b8; border-radius:8px; background:#fff; color:var(--ink); cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; white-space:nowrap; }
button:hover, .button:hover { background:#f8fafc; }
button.primary, .button.primary { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
button.primary:hover, .button.primary:hover { background:#172b66; }
button.big { min-height:48px; font-size:1.05rem; }
.error { color:var(--err); font-weight:600; margin:0; }
.warn { color:var(--review); font-size:.85rem; }

.flash { display:flex; align-items:center; gap:16px; justify-content:space-between; flex-wrap:wrap; background:var(--ok-bg); color:var(--ok); border:1px solid #86efac; border-radius:8px; padding:8px 16px; margin-bottom:16px; font-weight:600; }
.flash.bad { background:#fee2e2; color:var(--err); border-color:#fca5a5; }
#add-driver label { flex:1 1 200px; }
#add-driver input { width:100%; }

.tabs { display:flex; gap:4px; flex-wrap:wrap; border-bottom:2px solid var(--line); margin-bottom:16px; }
.tabs a { padding:8px 16px; text-decoration:none; color:var(--muted); font-weight:600; border-bottom:3px solid transparent; margin-bottom:-2px; border-radius:8px 8px 0 0; }
.tabs a.current { color:var(--accent); border-bottom-color:var(--accent); background:var(--card); }
.tabs .n { display:inline-block; min-width:1.6em; text-align:center; font-size:.8rem; padding:0 6px; border-radius:99px; background:var(--gray-bg); color:var(--ink); }
.tabs a.current .n { background:var(--accent); color:#fff; }
.tools { display:flex; gap:16px; align-items:center; justify-content:space-between; flex-wrap:wrap; margin-bottom:8px; }
.search { margin:0; flex:1 1 260px; max-width:360px; }
.search input { width:100%; }
.hint { margin:0; font-size:.9rem; }

table.drivers { width:100%; border-collapse:separate; border-spacing:0; background:var(--card); border:1px solid var(--line); border-radius:8px; }
table.drivers th { text-align:left; font-size:.8rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); padding:8px; border-bottom:1px solid var(--line); }
table.drivers td { padding:6px 8px; height:56px; border-bottom:1px solid var(--line); vertical-align:middle; }
table.drivers tr:last-child td { border-bottom:0; }
td.thumb { width:60px; }
.thumbbtn { padding:0; min-height:0; width:44px; height:44px; border-radius:8px; overflow:hidden; background:var(--gray-bg); }
.thumbbtn img, .noimg { width:44px; height:44px; object-fit:cover; display:block; }
.noimg { border:1px dashed var(--line); border-radius:8px; }
td.who { font-size:1rem; }
td.when { color:var(--muted); font-size:.9rem; white-space:nowrap; }
td.actions { white-space:nowrap; text-align:right; }
td.actions > * { display:inline-block; vertical-align:middle; margin:0 0 0 4px; }
td.actions form { margin:0 0 0 4px; }
.tag { display:inline-block; font-size:.75rem; font-weight:600; padding:0 8px; border-radius:6px; background:var(--gray-bg); color:var(--gray); vertical-align:middle; }
.tag.expired { background:var(--gray-bg); color:var(--ink); border:1px solid var(--gray); }
.pill { display:inline-block; font-size:.8rem; font-weight:700; padding:2px 10px; border-radius:99px; }
.pill.review { background:var(--review-bg); color:var(--review); }
.pill.waiting { background:var(--wait-bg); color:var(--wait); }
.pill.approved { background:var(--ok-bg); color:var(--ok); }
.pill.terminated { background:var(--gray-bg); color:var(--gray); }
tr.terminated td:not(.actions) { opacity:.6; }
.menu .danger { color:var(--err); }
button.danger-solid { background:var(--err); border-color:var(--err); color:#fff; }
button.danger-solid:hover { background:#991b1b; }
.warnicon { color:var(--review); cursor:help; margin-left:4px; }

details.more { position:relative; }
details.more > summary { list-style:none; cursor:pointer; padding:8px 14px; min-height:40px; display:inline-flex; align-items:center; border:1px solid #94a3b8; border-radius:8px; background:#fff; font-weight:600; font-size:.95rem; }
details.more > summary::-webkit-details-marker { display:none; }
details.more[open] > summary { background:var(--gray-bg); }
.menu { position:absolute; right:0; top:44px; z-index:10; min-width:170px; display:grid; gap:4px; padding:8px; background:#fff; border:1px solid var(--line); border-radius:8px; box-shadow:0 8px 24px rgba(15,23,42,.18); text-align:left; }
.menu form { margin:0; }
.menu button, .menu .button { width:100%; justify-content:flex-start; border-color:transparent; }
.menu button:hover, .menu .button:hover { background:var(--bg); }

dialog.preview { border:1px solid var(--line); border-radius:8px; padding:16px; max-width:min(92vw, 400px); }
dialog.preview::backdrop { background:rgba(15,23,42,.6); }
dialog.preview img { display:block; width:100%; height:auto; border-radius:8px; margin-bottom:8px; background:var(--gray-bg); }
dialog.preview .row form { margin:0; }
.carrier { margin:0; }
dialog.manage { border:1px solid var(--line); border-radius:8px; padding:16px; width:min(92vw, 420px); }
dialog.manage::backdrop { background:rgba(15,23,42,.6); }
dialog.manage form { display:grid; gap:12px; margin:0; }
dialog.manage p { margin:0; }
dialog.manage input { width:100%; }
dialog.manage .row { justify-content:flex-end; }
dialog.manage:target:not([open]) { display:block; position:fixed; inset:0; margin:auto; height:fit-content; z-index:20; box-shadow:0 8px 40px rgba(15,23,42,.5); }

@media (max-width: 720px) {
  main { padding: 8px; }
  .bar { gap:8px; }
  .bar h1 { font-size:1.25rem; }
  table.drivers thead, table.drivers td.when { display:none; }
  table.drivers, table.drivers tbody { display:block; border:0; background:transparent; }
  table.drivers tr { display:grid; grid-template-columns:44px 1fr; gap:4px 8px; background:var(--card); border:1px solid var(--line); border-radius:8px; margin-bottom:8px; padding:8px; }
  table.drivers td { display:block; height:auto; border:0; padding:0; }
  td.thumb { grid-row:1 / span 2; width:auto; }
  td.actions { grid-column:1 / -1; text-align:left; }
  td.actions > *, td.actions form { margin:0 8px 0 0; }
  tr.empty { display:block; padding:16px; }
  .menu { right:auto; left:0; }
  .login, .narrow { margin-left:8px; margin-right:8px; max-width:none; }
}
[hidden] { display:none !important; }
.allnote { margin:0 0 8px; font-size:.9rem; }
