/* ==========================================================================
   IT Asset Manager — mobile-first, wallet-style UI
   Palette: Cobalt (actions), Label yellow (register / highlight), cool paper.
   ========================================================================== */
:root {
  color-scheme: light;
  --paper: #EEF1F6;
  --card: #FFFFFF;
  --card-2: #F5F7FB;
  --ink: #13203A;
  --muted: #637089;
  --line: #DEE3EC;
  --cobalt: #2747E8;
  --cobalt-deep: #172C99;
  --cobalt-soft: #E5EAFF;
  --on-cobalt: #FFFFFF;
  --label: #FFC531;
  --on-label: #241A00;
  --green: #0E9A63;  --green-soft: #DDF5EA;
  --amber: #C77700;  --amber-soft: #FFF0D6;
  --red: #D63A31;    --red-soft: #FDE4E2;
  --grey: #7A8396;   --grey-soft: #ECEEF2;

  --r-xl: 28px;   /* hero, sheets */
  --r-l: 22px;    /* cards */
  --r-m: 16px;    /* inputs, buttons */
  --r-s: 12px;    /* thumbnails, small tiles */
  --pill: 999px;

  --lift: 0 14px 30px -12px rgba(23, 44, 153, .45);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0B1120; --card: #141C30; --card-2: #1B2540; --ink: #E8ECF7; --muted: #94A0BC; --line: #26304A;
    --cobalt: #5B78FF; --cobalt-deep: #2238B8; --cobalt-soft: #1D2A5C;
    --green: #3CCB8E; --green-soft: #12352A; --amber: #F2AA3A; --amber-soft: #3A2A10;
    --red: #FF6B61; --red-soft: #41191A; --grey: #8C95A9; --grey-soft: #222B40;
    --lift: 0 14px 30px -12px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0B1120; --card: #141C30; --card-2: #1B2540; --ink: #E8ECF7; --muted: #94A0BC; --line: #26304A;
  --cobalt: #5B78FF; --cobalt-deep: #2238B8; --cobalt-soft: #1D2A5C;
  --green: #3CCB8E; --green-soft: #12352A; --amber: #F2AA3A; --amber-soft: #3A2A10;
  --red: #FF6B61; --red-soft: #41191A; --grey: #8C95A9; --grey-soft: #222B40;
  --lift: 0 14px 30px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink);
  background: var(--paper); overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--cobalt) 55%, transparent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: .02em; }
[hidden] { display: none !important; }

/* ---------- Activity stage ---------------------------------------------- */
#stage { position: fixed; inset: 0; max-width: 560px; margin: 0 auto; overflow: hidden; background: var(--paper); }
@media (min-width: 561px) { #stage { box-shadow: 0 0 0 1px var(--line); } body { background: var(--card-2); } }

.activity {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--paper); will-change: transform;
  transition: transform .32s var(--ease), filter .32s var(--ease);
}
.activity.is-entering { transform: translateX(100%); }
.activity.is-behind { transform: translateX(-22%); filter: brightness(.94); pointer-events: none; }
.activity.is-leaving { transform: translateX(100%); }
.activity.is-fading { transition: opacity .25s ease; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .activity { transition: none; } }

.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pad { padding: 0 20px; }

/* ---------- Top bar ------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 8px; min-height: 60px;
  padding: calc(var(--safe-t) + 8px) 12px 8px; background: var(--paper);
}
.topbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: var(--card); color: var(--ink); flex: none;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.ghost { background: transparent; }

/* ---------- Type --------------------------------------------------------- */
.title-xl { font-size: 28px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.link { color: var(--cobalt); font-weight: 600; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Buttons ----------------------------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 22px; border-radius: var(--r-m);
  font-weight: 700; font-size: 16px; background: var(--cobalt); color: var(--on-cobalt);
  transition: transform .12s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.soft { background: var(--cobalt-soft); color: var(--cobalt); }
.btn.plain { background: var(--card); color: var(--ink); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { min-height: 42px; padding: 0 16px; font-size: 14px; border-radius: 14px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.is-busy { color: transparent; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--on-cobalt); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.soft.is-busy::after, .btn.plain.is-busy::after { border-color: var(--cobalt); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field > .lbl { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 6px; }
.field > .lbl .req { color: var(--red); }
.control {
  display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px;
  background: var(--card); border: 1.5px solid transparent; border-radius: var(--r-m);
  transition: border-color .15s, box-shadow .15s;
}
.control:focus-within { border-color: var(--cobalt); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cobalt) 14%, transparent); }
.control input, .control select, .control textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 15px 0; font-size: 16px;
}
.control textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.control select { appearance: none; padding-right: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23637089' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") right center no-repeat; }
.control .unit { color: var(--muted); font-size: 14px; font-weight: 600; }
.control .i { color: var(--muted); }
.control .inline-btn { color: var(--cobalt); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; margin-right: -8px; }
.field.has-error .control { border-color: var(--red); }
.field .err { display: block; color: var(--red); font-size: 13px; font-weight: 500; margin: 6px 4px 0; }
.field .hint { display: block; color: var(--muted); font-size: 13px; margin: 6px 4px 0; }
.form-group { background: var(--card); border-radius: var(--r-l); padding: 18px 16px 4px; margin-bottom: 14px; }
.form-group .control { background: var(--card-2); }
.form-group > h3 { margin: 0 4px 14px; font-size: 15px; font-weight: 700; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Choice chips (status, condition, roles) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: var(--pill); background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px;
  border: 1.5px solid var(--line); white-space: nowrap;
}
.form-group .chip { background: var(--card-2); border-color: transparent; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .count { font-weight: 500; opacity: .65; }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--pill); background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--cobalt) 55%, transparent); outline-offset: 2px; }

/* ---------- Status pill ------------------------------------------------ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--pill); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-in_use    { background: var(--cobalt-soft); color: var(--cobalt); }
.pill.s-available { background: var(--green-soft); color: var(--green); }
.pill.s-in_repair { background: var(--amber-soft); color: var(--amber); }
.pill.s-retired   { background: var(--grey-soft); color: var(--grey); }
.pill.s-lost      { background: var(--red-soft); color: var(--red); }
.pill.plain::before { display: none; }
.pill.role { background: var(--cobalt-soft); color: var(--cobalt); }

/* ---------- Main shell & bottom nav --------------------------------------- */
.tab-panel { position: absolute; inset: 0 0 calc(var(--nav-h) + var(--safe-b)); display: flex; flex-direction: column; }
.bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: 1fr 1fr 88px 1fr 1fr; align-items: center;
  background: var(--card); border-radius: 26px 26px 0 0;
  box-shadow: 0 -1px 0 var(--line), 0 -10px 30px -18px rgba(19, 32, 58, .35);
}
.nav-item {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.nav-item[aria-current="page"] { color: var(--cobalt); }
.nav-item[aria-current="page"] svg { stroke-width: 2.3; }
.fab-wrap { position: relative; height: 100%; }
.fab {
  position: absolute; left: 50%; top: -30px; transform: translateX(-50%);
  width: 72px; height: 72px; border-radius: 26px; display: grid; place-items: center;
  background: var(--label); color: var(--on-label);
  box-shadow: 0 0 0 6px var(--paper), 0 16px 26px -10px rgba(199, 140, 0, .75);
  transition: transform .15s var(--ease), border-radius .25s var(--ease);
}
.fab svg.i { width: 30px; height: 30px; stroke-width: 2.4; }
.fab:active { transform: translateX(-50%) scale(.93); border-radius: 32px; }
.fab-label { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink); }

/* ---------- Home --------------------------------------------------------- */
.home-head { display: flex; align-items: center; gap: 12px; padding: calc(var(--safe-t) + 18px) 20px 18px; }
.home-head .who { flex: 1; min-width: 0; }
.home-head .who b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: var(--label); color: var(--on-label); font-weight: 800; font-size: 16px;
}
.avatar.cobalt { background: var(--cobalt-soft); color: var(--cobalt); }

/* The one bold element: the fleet card, styled as a printed asset label */
.fleet-card {
  position: relative; overflow: hidden; margin: 0 20px; padding: 22px 22px 18px;
  border-radius: var(--r-xl); color: #fff; background: var(--cobalt-deep); box-shadow: var(--lift);
  isolation: isolate;
}
.fleet-card::before { /* barcode band */
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; right: -6px; width: 46%;
  background: repeating-linear-gradient(90deg,
    rgba(255,255,255,.10) 0 2px, transparent 2px 5px, rgba(255,255,255,.10) 5px 9px, transparent 9px 11px,
    rgba(255,255,255,.10) 11px 12px, transparent 12px 17px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 40%);
          mask: linear-gradient(90deg, transparent, #000 40%);
}
.fleet-card::after { content: ""; position: absolute; z-index: -2; inset: 0; background: radial-gradient(120% 90% at 0% 0%, var(--cobalt) 0%, transparent 60%); }
.fleet-card .label { font-size: 13px; font-weight: 600; opacity: .8; }
.fleet-card .total { font-size: 46px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.fleet-card .total small { font-size: 16px; font-weight: 600; letter-spacing: 0; opacity: .8; margin-left: 6px; }
.fleet-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed rgba(255,255,255,.28); }
.fleet-split button { text-align: left; color: #fff; }
.fleet-split b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fleet-split span { font-size: 12px; font-weight: 600; opacity: .78; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; background: var(--card); border-radius: var(--r-l); padding: 18px 10px; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; text-align: center; color: var(--ink); min-width: 0; }
.quick .tile { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: var(--cobalt-soft); color: var(--cobalt); position: relative; }
.quick .tile .n { position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--pill); background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.quick .name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-l); background: var(--amber-soft); color: var(--amber); font-weight: 600; font-size: 14px; margin-top: 14px; width: 100%; text-align: left; }
.notice .grow { flex: 1; color: var(--ink); }

/* ---------- Lists ------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.device-row {
  display: flex; align-items: center; gap: 14px; padding: 12px; width: 100%; text-align: left;
  background: var(--card); border-radius: var(--r-l); color: var(--ink);
}
.device-row:active { background: var(--card-2); }
.thumb { width: 58px; height: 58px; border-radius: var(--r-s); flex: none; overflow: hidden; display: grid; place-items: center; background: var(--cobalt-soft); color: var(--cobalt); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.device-row .meta { flex: 1; min-width: 0; }
.device-row .meta b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-row .meta .sn { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-row .meta .sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.device-row .meta .sub span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu { background: var(--card); border-radius: var(--r-l); overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; color: var(--ink); min-height: 60px; }
.menu-item + .menu-item { border-top: 1px solid var(--line); }
.menu-item:active { background: var(--card-2); }
.menu-item .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--cobalt-soft); color: var(--cobalt); flex: none; }
.menu-item .ico.red { background: var(--red-soft); color: var(--red); }
.menu-item .txt { flex: 1; min-width: 0; }
.menu-item .txt b { display: block; font-weight: 600; }
.menu-item .txt small { display: block; color: var(--muted); font-size: 13px; }
.menu-item .chev { color: var(--muted); }

.empty { text-align: center; padding: 46px 24px; color: var(--muted); }
.empty .badge { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 24px; display: grid; place-items: center; background: var(--card); color: var(--cobalt); }
.empty .badge svg.i { width: 32px; height: 32px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.empty .btn { margin-top: 18px; }

.skeleton { background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--r-l); height: 82px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.load-more { height: 1px; }

/* Search bar in Devices */
.searchbar { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 52px; background: var(--card); border-radius: var(--r-m); }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 14px 0; }
.searchbar .i { color: var(--muted); }
.sticky-head { padding: calc(var(--safe-t) + 14px) 20px 12px; background: var(--paper); }
.sticky-head .title-xl { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.sticky-head .title-xl .count { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

/* ---------- Activity timeline ------------------------------------------- */
.day-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 4px 10px; }
.log { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--card); border-radius: var(--r-l); width: 100%; text-align: left; color: var(--ink); }
.log + .log { margin-top: 8px; }
.log .dot { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.log .dot.a-created { background: var(--green-soft); color: var(--green); }
.log .dot.a-updated { background: var(--cobalt-soft); color: var(--cobalt); }
.log .dot.a-status  { background: var(--amber-soft); color: var(--amber); }
.log .dot.a-deleted { background: var(--red-soft); color: var(--red); }
.log .body { flex: 1; min-width: 0; }
.log .body b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .body span { display: block; font-size: 13.5px; color: var(--muted); }
.log time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Device detail ---------------------------------------------- */
.hero-photo { position: relative; height: 300px; background: var(--card-2); flex: none; overflow: hidden; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-photo .ph { height: 100%; display: grid; place-items: center; color: var(--cobalt); }
.hero-photo .ph svg.i { width: 84px; height: 84px; stroke-width: 1.3; }
.hero-photo .floating { position: absolute; top: calc(var(--safe-t) + 10px); left: 12px; right: 12px; display: flex; justify-content: space-between; }
.hero-photo .floating .icon-btn { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.detail-card { position: relative; margin: -46px 16px 0; padding: 18px; background: var(--card); border-radius: var(--r-l); box-shadow: 0 10px 30px -18px rgba(19, 32, 58, .4); }
.detail-card h2 { margin: 8px 0 2px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.sn-strip { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px 10px 14px; border-radius: var(--r-s); background: var(--card-2); }
.sn-strip .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.sn-strip .v { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 0; }
.action { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink); }
.action .tile { width: 50px; height: 50px; border-radius: 17px; display: grid; place-items: center; background: var(--cobalt-soft); color: var(--cobalt); }
.action.red .tile { background: var(--red-soft); color: var(--red); }
.kv { background: var(--card); border-radius: var(--r-l); padding: 4px 16px; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; }
.kv div + div { border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 14px; flex: none; }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.notes { background: var(--card); border-radius: var(--r-l); padding: 16px; white-space: pre-wrap; }

/* ---------- Register: camera step ------------------------------------- */
.camera { position: absolute; inset: 0; background: #000; color: #fff; display: flex; flex-direction: column; }
.camera video, .camera .shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera .bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 10px) 14px 10px; }
.camera .bar .icon-btn { background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.camera .bar .ttl { flex: 1; text-align: center; }
.camera .bar .ttl b { display: block; font-size: 16px; }
.camera .bar .ttl small { opacity: .75; font-size: 12.5px; }
.camera .frame { position: relative; z-index: 1; flex: 1; margin: 20px 28px; border-radius: 30px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.38); pointer-events: none; }
.camera .frame::before, .camera .frame::after { content: ""; position: absolute; width: 44px; height: 44px; border: 4px solid var(--label); }
.camera .frame::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 30px 0 0 0; }
.camera .frame::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 30px 0; }
.camera .hint-text { position: relative; z-index: 2; text-align: center; font-size: 14px; opacity: .85; padding: 0 30px 8px; }
.camera .controls { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-around; padding: 18px 20px calc(var(--safe-b) + 26px); }
.camera .round { width: 54px; height: 54px; border-radius: 20px; display: grid; place-items: center; background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; padding: 5px; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--label); transition: transform .12s; }
.shutter:active span { transform: scale(.86); }
.camera .review { display: flex; gap: 12px; padding: 18px 20px calc(var(--safe-b) + 24px); position: relative; z-index: 2; }
.camera .review .btn { flex: 1; }
.camera .review .btn.plain { background: rgba(255,255,255,.18); color: #fff; }
.camera .fallback { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 30px; gap: 10px; }
.camera .fallback svg.i { width: 48px; height: 48px; margin: 0 auto; opacity: .8; }
.camera .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3; }
.camera .flash.go { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

.stepper { display: flex; gap: 6px; padding: 0 20px 6px; }
.stepper span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.stepper span.on { background: var(--cobalt); }

.photo-card { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--card); border-radius: var(--r-l); margin-bottom: 14px; width: 100%; text-align: left; color: var(--ink); }
.photo-card img, .photo-card .ph { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; flex: none; background: var(--card-2); display: grid; place-items: center; color: var(--muted); }
.photo-card .txt { flex: 1; }
.photo-card .txt b { display: block; }
.photo-card.has-error { box-shadow: inset 0 0 0 1.5px var(--red); }

.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 18px; background: var(--card-2); color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; border: 1.5px solid transparent; min-width: 0; }
.type-opt span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-opt[aria-pressed="true"] { border-color: var(--cobalt); background: var(--cobalt-soft); color: var(--cobalt); }

.footer-bar { padding: 12px 20px calc(var(--safe-b) + 14px); background: linear-gradient(to top, var(--paper) 70%, transparent); }

/* ---------- Login ------------------------------------------------------- */
.login { padding: calc(var(--safe-t) + 40px) 24px 30px; display: flex; flex-direction: column; min-height: 100%; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.brand .mark { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: var(--label); color: var(--on-label); }
.brand .mark svg.i { width: 28px; height: 28px; stroke-width: 2.2; }
.brand b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.login .lead { margin: 10px 0 30px; color: var(--muted); max-width: 32ch; }
.login .spacer { flex: 1; min-height: 20px; }
.form-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-m); background: var(--red-soft); color: var(--red); font-weight: 600; font-size: 14px; margin-bottom: 14px; }

/* ---------- Bottom sheet, toast, scanner -------------------------------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(9, 14, 30, .5); opacity: 0; transition: opacity .25s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--paper);
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 10px 20px calc(var(--safe-b) + 20px);
  transform: translateY(100%); transition: transform .3s var(--ease);
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 16px; }
.sheet h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -.015em; }
.sheet p { margin: 0 0 18px; color: var(--muted); }
.sheet .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.sheet .opt { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-m); background: var(--card); font-weight: 600; text-align: left; width: 100%; color: var(--ink); }
.sheet .opt[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--cobalt); }
.sheet .opt .grow { flex: 1; }
.temp-pass { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .06em; text-align: center; padding: 18px; background: var(--card); border-radius: var(--r-m); margin-bottom: 14px; user-select: all; }

.toast-host { position: fixed; z-index: 80; left: 0; right: 0; top: calc(var(--safe-t) + 12px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 520px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-m); background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); transform: translateY(-20px); opacity: 0; transition: all .3s var(--ease); }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: var(--red); color: #fff; }
.toast.success svg { color: var(--green); }

.offline-bar { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); padding: 8px 14px; border-radius: var(--pill); background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 600; }

/* Field editor (device types) */
.field-card { background: var(--card); border-radius: var(--r-l); padding: 14px 14px 4px; margin-bottom: 10px; }
.field-card .head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.field-card .head b { flex: 1; font-size: 14px; color: var(--muted); }
.field-card .control { background: var(--card-2); }
.field-card .icon-btn { width: 36px; height: 36px; background: var(--card-2); }
.field-card .icon-btn svg.i { width: 18px; height: 18px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 4px 14px; font-weight: 600; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.icon-grid button { aspect-ratio: 1; border-radius: 16px; display: grid; place-items: center; background: var(--card-2); color: var(--ink); border: 1.5px solid transparent; }
.icon-grid button[aria-pressed="true"] { background: var(--cobalt-soft); color: var(--cobalt); border-color: var(--cobalt); }

.profile { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--card); border-radius: var(--r-l); }
.profile .avatar { width: 56px; height: 56px; border-radius: 20px; font-size: 20px; }
.profile b { display: block; font-size: 17px; font-weight: 800; }
.version { text-align: center; color: var(--muted); font-size: 12.5px; margin: 26px 0 30px; }
.bottom-space { height: 28px; }

/* ---------- Additions --------------------------------------------------- */
.splash { position: absolute; inset: 0; display: grid; place-items: center; color: var(--cobalt); }
.splash svg.i { width: 44px; height: 44px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.form-step { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--paper); }
.camera .frame.code { flex: none; height: 34%; margin: auto 28px; }
.mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mb-14 { margin-bottom: 14px; }
.grow { flex: 1; min-width: 0; }
.warn { color: var(--amber); font-weight: 700; }
.hero-photo .media { height: 100%; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: none; }
.status-dot.s-in_use { color: var(--cobalt); } .status-dot.s-available { color: var(--green); }
.status-dot.s-in_repair { color: var(--amber); } .status-dot.s-retired { color: var(--grey); } .status-dot.s-lost { color: var(--red); }
.stack-opts { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }
.role-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; color: var(--ink); background: var(--card-2); border: 1.5px solid transparent; border-radius: var(--r-m); }
.role-opt b { display: block; }
.role-opt small { display: block; color: var(--muted); font-size: 13px; }
.role-opt svg.i { color: var(--cobalt); }
.role-opt[aria-pressed="true"] { border-color: var(--cobalt); background: var(--cobalt-soft); }
.role-opt[disabled] { opacity: .7; }
button.log[disabled] { cursor: default; }
.sheet .kv { background: var(--card); }
.icon-btn[disabled] { opacity: .35; }
.row-2 > * { min-width: 0; }
.tab-panel .scroll::after { content: ""; display: block; height: 44px; }
.type-opt span, .quick .name {
  white-space: normal; overflow-wrap: break-word; hyphens: auto; line-height: 1.2; font-size: 11.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em;
}
.topbar h1:first-child { padding-left: 8px; }

/* ---------- v2: language, services, assignment ------------------------- */
.brand .lang-switch { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--pill); background: var(--card); color: var(--ink); font-weight: 700; font-size: 13px; }
.brand .lang-switch svg.i { width: 18px; height: 18px; color: var(--muted); }
.quick-grid.services { grid-template-columns: repeat(4, 1fr); }
.quick .tile.service { background: var(--label); color: var(--on-label); }
svg.i.xs { width: 14px; height: 14px; color: var(--muted); }
.chip svg.i { width: 16px; height: 16px; }
.chip.add { border-style: dashed; color: var(--cobalt); }
.spec-group.reveal { animation: reveal .35s var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .spec-group.reveal { animation: none; } }

.holder-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; text-align: left; color: var(--ink); background: var(--card); border-radius: var(--r-l); }
.holder-card .k { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.holder-card b { display: block; font-size: 16px; }
.holder-card .small { display: block; }
.holder-card.empty .avatar svg.i { width: 22px; height: 22px; }

.pick-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 4px 8px; }
.pick-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; text-align: left; color: var(--ink); background: var(--card); border-radius: var(--r-l); border: 1.5px solid transparent; min-height: 82px; }
.pick-card .meta { flex: 1; min-width: 0; }
.pick-card .meta b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-card .meta > span { display: block; }
.pick-card .sub { display: flex !important; gap: 8px; align-items: center; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.pick-card[disabled] { opacity: 1; cursor: default; }
.has-error .pick-card { border-color: var(--red); }
.thumb.dashed { background: transparent; border: 2px dashed var(--line); color: var(--muted); }
.pick-connector { display: grid; place-items: center; height: 18px; margin-top: 8px; color: var(--muted); }

.held { display: flex; flex-direction: column; gap: 6px; }
.held > .btn { align-self: flex-end; margin-top: -2px; }
.log .body span.mono { font-size: 12.5px; }
.kv a { color: var(--cobalt); text-decoration: none; }
.log .dot.a-assigned { background: var(--cobalt-soft); color: var(--cobalt); }
.log .dot.a-returned { background: var(--grey-soft); color: var(--ink); }
.type-grid { grid-template-columns: repeat(3, 1fr); }
.type-opt span, .quick .name { overflow-wrap: normal; word-break: normal; hyphens: manual; }
.quick .name { font-size: 11px; }

/* ---------- v3: handover proof, repair costs, photo viewer --------------- */
.photo-card.proof .ph { background: var(--label); color: var(--on-label); }
.has-error .photo-card { box-shadow: inset 0 0 0 1.5px var(--red); }
.pick-card.static { cursor: default; }
.log .dot.a-repair { background: var(--amber-soft); color: var(--amber); }
.proof-thumb { width: 52px; height: 52px; border-radius: 14px; overflow: hidden; flex: none; padding: 0; background: var(--card-2); }
.proof-thumb img { width: 100%; height: 100%; object-fit: cover; }
.holder-card .proof-thumb { width: 58px; height: 58px; }
.cost-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-l); background: var(--card); width: 100%; text-align: left; color: var(--ink); margin-top: 14px; }
.cost-card .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); flex: none; }
.cost-card .k { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cost-card b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.repair-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--card); border-radius: var(--r-l); }
.repair-row + .repair-row { margin-top: 8px; }
.repair-row .body { flex: 1; min-width: 0; }
.repair-row .body b { display: block; font-weight: 700; }
.repair-row .body span { display: block; font-size: 13.5px; color: var(--muted); }
.repair-row .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.repair-row .icon-btn { width: 36px; height: 36px; background: var(--card-2); margin-top: 6px; }
.repair-row .icon-btn svg.i { width: 16px; height: 16px; }
.money { font-variant-numeric: tabular-nums; }
.row-cost { color: var(--amber); font-weight: 700; white-space: nowrap; }
.section-title .total { font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(5, 8, 18, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 64px) 12px calc(var(--safe-b) + 24px); opacity: 0; transition: opacity .2s; }
.lightbox.open { opacity: 1; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 16px; object-fit: contain; }
.lightbox p { color: #fff; margin: 12px 0 0; font-weight: 600; text-align: center; }
.lightbox .icon-btn { position: absolute; top: calc(var(--safe-t) + 12px); right: 12px; background: rgba(255,255,255,.16); color: #fff; }
.repair-row .dot { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--amber-soft); color: var(--amber); }
button.repair-row { width: 100%; text-align: left; color: var(--ink); }
.held-actions { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.held > .held-actions .btn { margin-left: auto; }
.proof-thumb.small { width: 40px; height: 40px; border-radius: 12px; }
.log .proof-thumb { width: 40px; height: 40px; border-radius: 12px; }
.log .body b.wrap { white-space: normal; overflow: visible; }
.repair-row .amt { font-size: 14px; }
.repair-row .body b { overflow-wrap: anywhere; }

/* ---------- v4: budgeting and materials ---------------------------------- */
.xbadge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .04em; flex: none; }
.xbadge.capex { background: var(--ink); color: var(--paper); }
.xbadge.opex { background: var(--grey-soft); color: var(--muted); }
.price-col { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.price-col b { font-size: 14px; }

.chip.year { font-variant-numeric: tabular-nums; }
.chip .count { font-size: 12px; opacity: .6; }
.budget-card { margin: 14px 20px 0; }
.budget-card .total { font-size: 34px; }
.budget-card .sub-label { opacity: .75; margin-top: 2px; }
.budget-card .fleet-split b { font-size: 16px; }
.budget-card .status-strip { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; font-weight: 600; opacity: .9; }
.budget-card .status-strip span { display: inline-flex; align-items: center; gap: 6px; }
.budget-card .threshold { margin-top: 10px; opacity: .65; }
.status-dot.b-requested { color: #9AA3B8; } .status-dot.b-approved { color: var(--green); } .status-dot.b-rejected { color: var(--red); }
.budget-card .status-dot { width: 9px; height: 9px; }
.budget-card .status-dot.b-requested { color: #C9D0E2; } .budget-card .status-dot.b-approved { color: #4BE3A1; } .budget-card .status-dot.b-rejected { color: #FF8A80; }
.chip .status-dot { width: 9px; height: 9px; }

/* Lines: neutral while requested; color-marked once approved or rejected */
.budget-row { position: relative; display: flex; gap: 12px; padding: 14px 14px 14px 18px; background: var(--card); border-radius: var(--r-l); cursor: pointer; overflow: hidden; }
.budget-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: transparent; }
.budget-row.b-approved { background: color-mix(in srgb, var(--green-soft) 55%, var(--card)); }
.budget-row.b-approved::before { background: var(--green); }
.budget-row.b-rejected { background: color-mix(in srgb, var(--red-soft) 55%, var(--card)); }
.budget-row.b-rejected::before { background: var(--red); }
.budget-row.b-rejected .money { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 60%, transparent); }
.budget-row:active { filter: brightness(.97); }
.budget-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.budget-row .top { display: flex; align-items: flex-start; gap: 8px; }
.budget-row .top b { flex: 1; min-width: 0; font-weight: 700; }
.budget-row .calc { color: var(--muted); font-variant-numeric: tabular-nums; }
.budget-row .extra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.budget-row .desc { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-row .side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; flex: none; }
.budget-row .side b { font-size: 15px; }
.mark-chip { display: inline-flex; padding: 3px 9px; border-radius: var(--pill); background: var(--cobalt-soft); color: var(--cobalt); font-size: 12px; font-weight: 700; }
.bpill { padding: 5px 10px; border-radius: var(--pill); font-size: 12px; font-weight: 700; }
.bpill.b-requested { background: var(--grey-soft); color: var(--muted); }
.bpill.b-approved { background: var(--green); color: #fff; }
.bpill.b-rejected { background: var(--red); color: #fff; }
.list .budget-row + .budget-row { margin-top: 0; }

.status-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-l); margin-bottom: 4px; }
.status-banner .small { display: block; }
.status-banner.b-approved { background: var(--green-soft); color: var(--green); }
.status-banner.b-rejected { background: var(--red-soft); color: var(--red); }
.status-banner b { color: var(--ink); }
.status-banner .small { color: var(--ink); opacity: .8; }
.chip.status-approved[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.chip.status-rejected[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.chip[aria-pressed="true"] .status-dot { color: currentColor; }
.price-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 10px; border-radius: var(--r-m); background: var(--amber-soft); color: var(--amber); font-size: 13.5px; font-weight: 600; }
.price-note .grow { color: var(--ink); }
.line-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 4px 16px; color: var(--muted); font-size: 13.5px; }
.line-total b { color: var(--ink); font-size: 20px; font-weight: 800; }
.expense-hint { display: flex; align-items: center; gap: 8px; margin: 0 4px 14px; font-size: 13px; color: var(--muted); }

.col-list { padding: 12px 14px; border-radius: var(--r-m); background: var(--card-2); overflow-wrap: anywhere; }
.file-drop { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 84px; border: 2px dashed var(--line); border-radius: var(--r-l); color: var(--cobalt); font-weight: 700; background: var(--card-2); padding: 12px; text-align: center; }
.file-drop.has-file { border-style: solid; border-color: var(--cobalt); background: var(--cobalt-soft); }
.import-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.import-stats div { background: var(--card-2); border-radius: var(--r-m); padding: 10px; text-align: center; }
.import-stats b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.import-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.import-stats .bad { background: var(--red-soft); } .import-stats .bad b { color: var(--red); }
.import-errors { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--red-soft); color: var(--ink); font-size: 13px; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.import-errors .mono { color: var(--red); font-weight: 700; margin-right: 6px; }
.import-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.import-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-m); background: var(--card-2); }
.import-row .grow > * { display: block; }
.import-row .grow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.import-row .act { font-size: 11px; font-weight: 800; padding: 3px 7px; border-radius: 6px; background: var(--grey-soft); color: var(--muted); flex: none; text-transform: uppercase; }
.import-row.create .act { background: var(--green-soft); color: var(--green); }
.import-row.update .act { background: var(--cobalt-soft); color: var(--cobalt); }
.quick-grid.services { row-gap: 18px; }
.device-row[data-material] .meta b, .import-row .grow b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.device-row[data-material] .sub span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- v5: ownership ----------------------------------------------- */
.avatar.xs { width: 22px; height: 22px; border-radius: 8px; font-size: 10px; }
.chip .avatar.xs { margin-left: -6px; }
.owned-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.owned-stats div { background: var(--card-2); border-radius: var(--r-m); padding: 10px; text-align: center; }
.owned-stats b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.owned-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.owner-line { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.kv dd .link { margin-left: 6px; }

/* ---------- v6: leaner lists, filter sheet, companies ------------------- */
.sticky-head.compact { padding-bottom: 8px; }
.sticky-head.compact .title-xl { font-size: 24px; margin-bottom: 10px; }
.search-row { display: flex; gap: 8px; align-items: center; }
.search-row .searchbar { flex: 1; min-width: 0; min-height: 48px; }
.filter-btn { position: relative; width: 48px; height: 48px; flex: none; border-radius: var(--r-m); background: var(--card); color: var(--ink); display: grid; place-items: center; }
.filter-btn:active { transform: scale(.95); }
.fcount { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill); background: var(--cobalt); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.active-filters { margin-top: 8px !important; }
.active-filters .chip { min-height: 32px; padding: 0 10px 0 12px; font-size: 13px; gap: 4px; }
.active-filters .chip.on { background: var(--cobalt-soft); color: var(--cobalt); border-color: transparent; }
.active-filters .chip.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.active-filters .chip svg.i.xs { width: 14px; height: 14px; color: currentColor; }
.filter-sheet { display: flex; flex-direction: column; gap: 18px; margin-bottom: 6px; }
.filter-sheet .ftitle { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 2px 8px; }
.filter-sheet .chip { min-height: 38px; }
.filter-sheet .chip .status-dot { width: 9px; height: 9px; }

.mini-card { background: var(--cobalt-deep); color: #fff; border-radius: var(--r-l); padding: 14px 16px; box-shadow: var(--lift); position: relative; overflow: hidden; isolation: isolate; }
.mini-card::after { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(120% 120% at 0% 0%, var(--cobalt) 0%, transparent 60%); }
.mini-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.year-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 12px; border-radius: var(--pill); background: rgba(255,255,255,.16); color: #fff; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.year-btn svg.i.xs { width: 14px; height: 14px; }
.mini-count, .mini-note { font-size: 12.5px; font-weight: 600; opacity: .75; }
.mini-total { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.mini-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,.25); }
.mini-split span { display: flex; flex-direction: column; min-width: 0; }
.mini-split i { font-style: normal; font-size: 11.5px; font-weight: 700; opacity: .7; }
.mini-split b { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.site-tag { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--card-2); color: var(--muted); flex: none; }
.credit { font-size: 12.5px; }
.credit a { color: var(--cobalt); font-weight: 700; text-decoration: none; }
.import-skipped { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--card-2); font-size: 13px; }
.import-skipped summary { font-weight: 700; cursor: pointer; }
.import-skipped div { margin-top: 4px; }
.import-skipped .mono { color: var(--muted); font-weight: 700; margin-right: 6px; }
