/* Ajossa – depot signage: warm paper, ink, one amber signal colour. */
:root {
  --bg: #f4f1ea; --surface: #fffdf8; --ink: #14181d; --muted: #5d646d; --line: #dcd6c8;
  --accent: #ffb020; --accent-ink: #14181d; --nav: #14181d; --nav-ink: #f4f1ea;
  --rental: #2f6fde; --transfer: #d98200; --service: #7a56c9;
  --ok: #23804f; --danger: #c63d2f;
  --radius: 10px; --dayw: 46px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #181c22; --ink: #ece8df; --muted: #9aa1aa; --line: #2b313a;
    --nav: #0a0c0f; --rental: #6c9bf0; --transfer: #f0a63a; --service: #a48be3; --ok: #55b885; --danger: #ef7566;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.55rem; font-weight: 750; }
h2 { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
     display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 8px; }
h2 a { font-size: .78rem; }
a { color: inherit; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* shell */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.nav { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; gap: 2px; padding: 16px 10px;
       position: sticky; top: 0; height: 100dvh; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; text-decoration: none;
         color: #b9bec6; font-weight: 550; border-left: 3px solid transparent; }
.nav a:hover { color: #fff; background: #ffffff0f; }
.nav a.active { color: #fff; background: #ffffff14; border-left-color: var(--accent); }
.nav a.narrow { display: none; }
.brand { font-size: 1.15rem; margin-bottom: 14px; color: #fff !important; border: 0 !important; background: none !important; }
.brand b { letter-spacing: -0.02em; }
.brand.big { display: flex; align-items: center; gap: 12px; font-size: 1.7rem; margin-bottom: 6px; }
.who { margin-top: auto; padding: 12px; display: grid; font-size: .82rem; color: #9aa1aa; border-top: 1px solid #ffffff1a; }
.who b { color: #fff; }
.ico { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ico svg { width: 100%; height: 100%; }
main { padding: 26px clamp(16px, 3vw, 36px) 60px; max-width: 1280px; width: 100%; outline: 0; }
main > section { margin-top: 26px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.loading, .empty { color: var(--muted); padding: 14px 2px; margin: 0; }
.offline-bar { display: none; background: var(--accent); color: var(--accent-ink); text-align: center; padding: 6px 12px; font-weight: 600; font-size: .88rem; }
body.offline .offline-bar { display: block; }

/* controls */
.btn { font: inherit; font-weight: 650; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
       color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: .86rem; text-transform: none; letter-spacing: 0; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); max-width: 100%; }
.seg button { font: inherit; font-weight: 600; border: 0; border-radius: 0; background: none; color: var(--muted); padding: 8px 13px; cursor: pointer; min-height: 38px; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.search, .field input:not([type=checkbox]), .field select, .field textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 42px; }
.search { margin-bottom: 12px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > span { font-weight: 650; font-size: .86rem; }
.field small { color: var(--muted); }
.field.check { grid-template-columns: 1fr auto; align-items: center; }
.field.check input, .checklist input { width: 22px; height: 22px; accent-color: var(--ink); }
.form-error { color: var(--danger); font-weight: 600; }

/* lists */
.multi { display: grid; gap: 4px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px; }
.multi label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.multi label:hover { background: color-mix(in srgb, var(--muted) 10%, transparent); }
.multi input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.badge.ct-leasing, .badge.ct-financing { background: color-mix(in srgb, var(--rental) 20%, transparent); }
.badge.ct-location_lease { background: color-mix(in srgb, var(--service) 24%, transparent); }
.badge.ct-insurance, .badge.ct-service { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.seg { overflow-x: auto; }
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
        border-radius: var(--radius); padding: 11px 14px; text-decoration: none; cursor: pointer; min-width: 0; }
.item:hover { border-color: var(--muted); }
.item-main { min-width: 0; flex: 1; }
.item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-sub { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 6px; flex: none; }
.item.bar-rental { border-left-color: var(--rental); }
.item.bar-transfer { border-left-color: var(--transfer); }
.item.bar-service { border-left-color: var(--service); }
.item.late { border-left-color: var(--danger); }
.item.late .item-sub:last-child { color: var(--danger); font-weight: 600; }
.plate { font: 600 .78rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; padding: 4px 6px; border-radius: 4px;
         background: #fff; color: #111; border: 1.5px solid #111; white-space: nowrap; }
.badge { font-size: .74rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--ink); white-space: nowrap; }
.badge.st-available, .badge.ev-done { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.badge.st-rented, .badge.ev-planned { background: color-mix(in srgb, var(--rental) 20%, transparent); }
.badge.st-in_transfer, .badge.ev-active { background: color-mix(in srgb, var(--accent) 42%, transparent); }
.badge.st-in_service, .badge.ev-service { background: color-mix(in srgb, var(--service) 24%, transparent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; text-decoration: none; border-top: 3px solid var(--line); }
.stat b { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat.st-available { border-top-color: var(--ok); } .stat.st-rented { border-top-color: var(--rental); }
.stat.st-in_transfer { border-top-color: var(--accent); } .stat.st-in_service { border-top-color: var(--service); }
.asset-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.table .num { text-align: right; white-space: nowrap; }
.table th { white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }

/* map */
main.full { padding: 0; max-width: none; }
.map-page { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); height: 100dvh; }
.map-wrap { position: relative; grid-column: 2; grid-row: 1; min-height: 0; }
.map { height: 100%; width: 100%; background: var(--line); z-index: 0; }
.map.small { height: 220px; border-radius: 8px; border: 1px solid var(--line); }
.place { display: grid; gap: 6px; }
.map-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--accent); color: var(--accent-ink); font-weight: 650;
            padding: 8px 14px; border-radius: 99px; max-width: calc(100% - 24px); text-align: center; box-shadow: 0 2px 10px #0004; }
.map-panel { grid-column: 1; grid-row: 1; overflow-y: auto; padding: 14px; border-right: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.map-tools { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.map-panel .search { margin: 0; }
.rows { display: grid; gap: 6px; }
.row { font: inherit; color: var(--ink); text-align: left; display: grid; gap: 2px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
       border-radius: var(--radius); padding: 9px 12px; cursor: pointer; }
.row:hover { border-color: var(--muted); }
.row.on { border-color: var(--accent); border-left-color: var(--accent); }
.map-card { position: relative; background: var(--surface); border: 1px solid var(--accent); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.map-card .item-title { padding-right: 34px; }
.map-card .x { position: absolute; top: 4px; right: 4px; border: 0; background: none; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; width: 36px; height: 36px; border-radius: 8px; }
.map-card h2 { margin: 6px 0 0; }
.map-card .kvs { margin: 0; }
.pin { width: 36px; height: 36px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #14181d; border: 3px solid #fff; box-shadow: 0 2px 6px #0006;
       display: grid; place-items: center; }
.pin b { transform: rotate(45deg); color: #fff; font: 700 14px/1 system-ui, sans-serif; }
.pin.cur { background: #ffb020; } .pin.cur b { color: #14181d; }
.pin.home { background: #23804f; }
.pin.dim { opacity: .45; }
.leaflet-container { font: inherit; }
.leaflet-tooltip { font-weight: 650; }

/* working time */
.clock { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line);
         border-left: 4px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.clock.on { border-left-color: var(--ok); }
.clock > div { display: grid; min-width: 0; }
.clock span { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.scroll { overflow-x: auto; }
.table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 650; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: color-mix(in srgb, var(--muted) 8%, transparent); }
.entry { font: inherit; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; width: 100%; text-align: left; background: none; border: 0; color: var(--ink);
         padding: 4px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer; }
.entry:hover { background: color-mix(in srgb, var(--muted) 12%, transparent); }
.entry span { color: var(--muted); font-size: .86rem; }
.pick { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 38px; max-width: 100%; }

/* calendar */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .seg .btn { border: 0; border-radius: 0; min-height: 38px; }
.toolbar .seg .btn + .btn { border-left: 1px solid var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 3px; background: var(--c); }
.legend i.dot { width: 10px; border-radius: 50%; background: var(--ink); }
.bar-rental { --c: var(--rental); } .bar-transfer { --c: var(--transfer); } .bar-service { --c: var(--service); }
.cal { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cal-row, .cal-group { display: grid; grid-template-columns: 148px minmax(calc(var(--days) * var(--dayw)), 1fr); border-bottom: 1px solid var(--line); }
.cal > :last-child { border-bottom: 0; }
.cal-name { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); padding: 6px 10px; display: grid;
            align-content: center; text-decoration: none; min-width: 0; }
.cal-name b, .cal-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-name span { color: var(--muted); font-size: .78rem; }
.cal-group { background: var(--bg); }
.cal-group span { position: sticky; left: 0; padding: 5px 10px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; grid-column: 1 / -1; width: max-content; }
.cal-days { display: grid; grid-template-columns: repeat(var(--days), 1fr); }
.cal-day { text-align: center; padding: 6px 0; border-left: 1px solid var(--line); display: grid; font-size: .8rem; }
.cal-day:first-child { border-left: 0; }
.cal-day span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.cal-day.weekend { background: color-mix(in srgb, var(--muted) 9%, transparent); }
.cal-day.today b { background: var(--accent); color: var(--accent-ink); border-radius: 99px; justify-self: center; padding: 0 7px; }
.cal-track { position: relative; height: 48px; cursor: copy;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / var(--days)) 100%; background-position: -1px 0; }
.bar { position: absolute; top: 7px; height: 34px; border: 0; border-radius: 6px; background: var(--c); color: #fff; font: inherit; font-size: .8rem; font-weight: 650;
       padding: 0 8px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; z-index: 1; min-width: 6px; }
.bar.is-planned { background: color-mix(in srgb, var(--c) 78%, var(--surface)); }
.bar.is-done { background: color-mix(in srgb, var(--c) 34%, var(--surface)); color: var(--ink); }
.bar.is-active { box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 2px var(--c); }
.cal-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal-task { position: absolute; bottom: 2px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--surface); background: var(--ink); z-index: 2; padding: 0; cursor: pointer; }
.cal-task.late { background: var(--danger); }

/* dialogs */
dialog.sheet { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--bg); color: var(--ink); width: min(520px, calc(100vw - 24px));
               max-height: calc(100dvh - 24px); overflow: auto; }
dialog.sheet::backdrop { background: #0009; }
.sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.sheet > header h2 { font-size: 1.15rem; text-transform: none; letter-spacing: -0.01em; color: var(--ink); margin: 0; }
.sheet .x { border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--muted); cursor: pointer; width: 40px; height: 40px; border-radius: 8px; }
.sheet > form, .sheet > .task, .sheet > .kvs, .sheet > .choices { padding: 8px 18px 4px; margin: 0; }
.sheet footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px 16px; position: sticky; bottom: 0; background: var(--bg); }
.sheet > form footer { padding: 12px 0 14px; }
.kvs { display: grid; gap: 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.kv dt { color: var(--muted); font-size: .86rem; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.choices { display: grid; gap: 8px; padding-bottom: 18px !important; }
.choice { font: inherit; text-align: left; display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line);
          border-left: 5px solid var(--c); background: var(--surface); color: var(--ink); cursor: pointer; }
.choice span { color: var(--muted); font-size: .9rem; }
.checklist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.checklist label { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; cursor: pointer; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 12px 0; }
.photos img, .add-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.add-photo { font: inherit; font-weight: 650; border: 2px dashed var(--line); background: none; color: var(--muted); cursor: pointer; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--nav); }
.login .card { width: min(380px, 100%); background: var(--bg); border-radius: 16px; padding: 26px 24px; border-top: 5px solid var(--accent); }
.login .brand.big { color: var(--ink) !important; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
         font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* phone: bottom tab bar, sheets from the bottom */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); z-index: 20; gap: 0; }
  .nav .brand, .nav .wide { display: none; }
  .nav a.narrow { display: flex; }
  .map-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46dvh auto; height: auto; min-height: 100dvh; }
  .map-wrap { grid-column: 1; grid-row: 1; position: sticky; top: 0; z-index: 5; }
  .map-panel { grid-column: 1; grid-row: 2; border-right: 0; border-top: 1px solid var(--line); overflow: visible; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .nav a { flex: 1; flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 2px; border-left: 0; border-top: 3px solid transparent; border-radius: 6px; min-width: 0; }
  .nav a.active { border-top-color: var(--accent); background: none; }
  main { padding: 16px 16px calc(92px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.35rem; }
  .cal-row, .cal-group { grid-template-columns: 104px minmax(calc(var(--days) * var(--dayw)), 1fr); }
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; border-width: 1px 0 0; max-height: 92dvh; }
  .sheet footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .kv { grid-template-columns: 92px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
