:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  /* Green accent so it reads differently from the (blue) IT Asset Hub */
  --accent: #14805e;
  --accent-soft: #e4f2ec;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

/* ---------- shell ---------- */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--grid);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar .brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav button {
  border: none; background: none; padding: 7px 12px; border-radius: 8px;
  color: var(--ink-2); font-weight: 500;
}
.topbar nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar nav button:hover:not(.active) { background: var(--page); }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar .who b { color: var(--ink-2); }
main { max-width: 1280px; margin: 0 auto; padding: 20px; }

/* ---------- auth ---------- */
.authwrap { min-height: 100vh; display: grid; place-items: center; }
.authcard {
  background: var(--surface); border: 1px solid var(--grid); border-radius: 14px;
  padding: 32px; width: 360px; box-shadow: 0 8px 30px rgba(11,11,11,0.06);
}
.authcard h1 { font-size: 20px; margin: 0 0 4px; }
.authcard p.sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--baseline); border-radius: 8px; background: #fff;
}
.field textarea { min-height: 72px; resize: vertical; }
.btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--baseline);
  background: var(--surface); color: var(--ink); font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--critical); border-color: var(--critical); background: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; font-weight: 500; }
.btn.wide { width: 100%; }
.btn.big { padding: 10px 22px; font-size: 15px; }
.error { color: var(--critical); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tile.click { cursor: pointer; }
.tile.click:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(11,11,11,0.07); }
.tile.warn .v { color: #9a6a00; }
.tile.crit .v { color: var(--critical); }
.tile.good .v { color: var(--good-text); }

/* ---------- cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h2 .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 8px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] {
  padding: 7px 10px; border: 1px solid var(--baseline); border-radius: 8px; min-width: 220px; background: #fff;
}
.toolbar select { padding: 7px 8px; border: 1px solid var(--baseline); border-radius: 8px; background: #fff; }
.toolbar .spacer { flex: 1; }
.count { color: var(--muted); font-size: 12px; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th {
  text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 6px 10px; border-bottom: 1px solid var(--baseline); white-space: nowrap; cursor: pointer; user-select: none;
}
table.data th .arrow { font-size: 9px; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data tbody tr:hover { background: #f2f7f4; cursor: pointer; }
table.data tbody tr.static:hover { background: none; cursor: default; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.available { background: #e6f3ea; color: #1a6b2f; }
.badge.signedout { background: #e8f0fb; color: #1c5cab; }
.badge.inrepair { background: #fdf0e3; color: #9a5416; }
.badge.retired { background: #efeeea; color: var(--ink-2); }
.badge.lost { background: #fbe9e9; color: #a12626; }
.badge.cond-new { background: #e6f3ea; color: #1a6b2f; }
.badge.cond-fine { background: #f3f2ee; color: var(--ink-2); }
.badge.cond-notgreat { background: #fdf0e3; color: #9a5416; }
.badge.due { background: #fbe9e9; color: #a12626; }
.badge.dsoon { background: #fdf3dd; color: #8a5f00; }
.badge.dok { background: #f3f2ee; color: var(--ink-2); }

/* ---------- drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11,11,11,0.35); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 96vw); background: var(--page);
  z-index: 31; overflow-y: auto; box-shadow: -12px 0 40px rgba(11,11,11,0.18); padding: 20px;
}
.drawer h2 { margin: 0; font-size: 18px; }
.drawer .drawhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.drawer .drawhead .spacer { flex: 1; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.formgrid .full { grid-column: 1 / -1; }
.kv { display: flex; gap: 8px; font-size: 13px; margin: 2px 0; }
.kv .k { color: var(--muted); min-width: 130px; }
.subtable td, .subtable th { font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 12px; }
.movebox { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.movebox b { color: var(--accent); }

/* ---------- misc ---------- */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: 13px;
}
.hidden { display: none !important; }

/* ---------- QR ---------- */
.qrbox svg { width: 88px; height: 88px; display: block; }
#printSheet { display: none; }

/* Sticker sheet: 63.5 x 38.1 mm labels, 3 across (Avery L7160-style A4 sheets) */
@media print {
  body.printing header.topbar, body.printing main, body.printing .drawer, body.printing .overlay, body.printing .toast { display: none !important; }
  body.printing #printSheet {
    display: grid;
    grid-template-columns: repeat(3, 63.5mm);
    grid-auto-rows: 38.1mm;
    column-gap: 2.5mm;
    row-gap: 0;
  }
  body.printing { background: #fff; }
  #printSheet .sticker {
    display: flex; align-items: center; gap: 3mm;
    padding: 3mm; box-sizing: border-box; overflow: hidden;
    break-inside: avoid;
  }
  #printSheet .qr svg { width: 26mm; height: 26mm; display: block; }
  #printSheet .sid { font-size: 14pt; font-weight: 700; }
  #printSheet .styp { font-size: 9pt; }
  #printSheet .sorg { font-size: 6.5pt; color: #555; margin-top: 1mm; }
}
