:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #1c2330;
  --muted: #5d6878;
  --accent: #2f6fde;
  --accent-soft: #e6eefc;
  --warn: #b25e00;
  --warn-soft: #fff1e0;
  --danger: #c0352b;
  --danger-soft: #fde8e6;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --surface: #1a2029; --surface-2: #222a35; --border: #2e3744;
    --text: #e4e8ee; --muted: #9aa5b4; --accent: #6a9bff; --accent-soft: #1f2d48;
    --warn: #f0a24a; --warn-soft: #3a2a14; --danger: #ff7b70; --danger-soft: #3d1d1b;
    --ok: #5fd08e; --ok-soft: #173326; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --surface: #1a2029; --surface-2: #222a35; --border: #2e3744;
  --text: #e4e8ee; --muted: #9aa5b4; --accent: #6a9bff; --accent-soft: #1f2d48;
  --warn: #f0a24a; --warn-soft: #3a2a14; --danger: #ff7b70; --danger-soft: #3d1d1b;
  --ok: #5fd08e; --ok-soft: #173326; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
/* Components set their own display (flex/grid), which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: .9em; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .88em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.search { flex: 1; max-width: 520px; margin-left: auto; }
.search input, .filter {
  width: 100%; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit;
}
.search input:focus, .filter:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1.1rem; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }

/* User menu */
.user-menu { position: relative; flex: none; }
.user-btn {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer;
}
.user-btn:hover { background: var(--surface-2); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 40; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.menu[hidden] { display: none; }
.menu-head { padding: 6px 10px 8px; font-size: .8rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; font-size: .9rem; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 600px) { .user-name { display: none; } }

/* Layout */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); flex: none; padding: 16px 12px; overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--surface);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
}
.sidebar-resizer {
  flex: none; width: 7px; margin-left: -4px; position: sticky; top: var(--topbar-h); z-index: 5;
  height: calc(100vh - var(--topbar-h)); cursor: col-resize; touch-action: none;
}
.sidebar-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s;
}
.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, body.resizing .sidebar-resizer::after { background: var(--accent); }
.sidebar-resizer:focus { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; }
.content { flex: 1; min-width: 0; padding: 28px 32px 64px; }
.content:focus { outline: none; }

/* Sidebar is a column so the storage footer can sit at the bottom. */
.sidebar { display: flex; flex-direction: column; padding-bottom: 0; }
.storage {
  margin-top: auto; position: sticky; bottom: 0; padding: 10px 8px 12px; margin-left: -12px; margin-right: -12px;
  padding-left: 20px; padding-right: 20px; background: var(--surface); border-top: 1px solid var(--border); font-size: .82rem;
}
.storage summary { display: block; cursor: pointer; list-style: none; color: var(--muted); }
.storage summary::-webkit-details-marker { display: none; }
.storage-row { display: flex; align-items: center; gap: 8px; }
.storage-row::after { content: "▸"; font-size: .75rem; }
.storage[open] .storage-row::after { content: "▾"; }
.storage-row strong { margin-left: auto; color: var(--text); }
.storage-bar { display: flex; height: 6px; margin-top: 8px; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.storage-list { list-style: none; margin: 10px 0 6px; padding: 0; display: grid; gap: 4px; }
.storage-list li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; }
.storage-list i { width: 10px; height: 10px; border-radius: 3px; }
.storage-foot { display: flex; align-items: center; gap: 4px; font-size: .75rem; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 8px 6px; font-weight: 600; }
.nav-label:first-child { margin-top: 0; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  color: var(--text); font-size: .93rem;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .child { padding-left: 26px; }
.nav .child::before { content: "└"; color: var(--muted); margin-left: -14px; width: 10px; }
.nav .count { margin-left: auto; font-size: .78rem; color: var(--muted); }
.nav a.sub { padding: 4px 8px 4px 20px; font-size: .88rem; }
.nav-row { display: flex; align-items: center; }
.nav-row > a { flex: 1; min-width: 0; }
.nav-toggle {
  flex: none; width: 24px; height: 24px; margin-left: 2px; border: 0; border-radius: 5px;
  background: none; color: var(--muted); cursor: pointer; font-size: .8rem; line-height: 1;
}
.nav-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-group[hidden] { display: none; }
.nav a.nav-archive { margin-top: 4px; border-top: 1px dashed var(--border); border-radius: 0 0 6px 6px; padding-top: 8px; color: var(--muted); }
.nav a.nav-archive.active { color: var(--accent); }
.arch-thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; display: block; }
.nav a.sub2 { padding-left: 36px; font-size: .84rem; }
.nav a.sub::before { content: ""; align-self: stretch; width: 3px; border-radius: 2px; background: var(--bar); margin-right: 2px; }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 220px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* Cards & grids */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card { min-width: 0; }
a.card { display: block; color: var(--text); }
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.card p { margin: 4px 0; }
.stat { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 8px; }
/* Audit log */
.audit-table td { vertical-align: top; }
.audit-table .audit-what { min-width: 220px; white-space: normal; }
.audit-table .audit-detail { min-width: 260px; white-space: normal; font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.audit-target { font-size: .75rem; margin-top: 2px; white-space: normal; overflow-wrap: anywhere; }


/* Image icons used in place of an emoji (e.g. Network devices) */
.ico { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -0.25em; }

/* "Last updated … by …" notes */
.last-updated { margin: 10px 0 0; font-size: .8rem; color: var(--muted); }
span.last-updated { margin: 0 0 0 8px; }
div.last-updated { margin: 2px 0 0; font-size: .75rem; }
.last-updated strong { color: var(--text); font-weight: 600; }

/* Count tiles; a tile with sub-menus opens a dropdown panel */
.stat-tile { display: block; color: var(--text); text-align: left; font: inherit; position: relative; }
button.stat-tile { cursor: pointer; width: 100%; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.stat-tile:hover { border-color: var(--accent); text-decoration: none; }
.tile-caret { position: absolute; top: 12px; right: 14px; color: var(--muted); font-size: .85rem; transition: transform .15s; }
.stat-tile.open { border-color: var(--accent); background: var(--accent-soft); }
.stat-tile.open .tile-caret { transform: rotate(180deg); color: var(--accent); }
.stat-drop { margin: 4px 0 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-drop-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.stat-drop-head a { font-size: .9rem; }
.sub-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.sub-tile { border: 1px solid var(--border); border-left: 4px solid var(--bar); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.sub-tile-main { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; color: var(--text); }
.sub-tile-main strong { font-size: 1.2rem; }
.sub-tile-main:hover { background: var(--accent-soft); text-decoration: none; }
.sub-tile-kids { display: flex; flex-direction: column; border-top: 1px solid var(--border); padding: 4px 0; }
.sub-tile-kids a { display: flex; justify-content: space-between; padding: 4px 12px 4px 20px; font-size: .85rem; color: var(--text); }
.sub-tile-kids a:hover { background: var(--accent-soft); text-decoration: none; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Badges */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* Toolbar & tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.toolbar .filter { max-width: 320px; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); cursor: pointer; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; }
th[data-dir="asc"]::after { content: " ▲"; font-size: .7em; }
th[data-dir="desc"]::after { content: " ▼"; font-size: .7em; }
/* Tables fill the available width; on narrower screens text wraps instead of scrolling sideways,
   while identifiers (names, IPs, serials, dates/badges) stay on one line. */
.table-wrap td { overflow-wrap: break-word; }
.table-wrap td strong, .table-wrap td .badge, .table-wrap td .mono, .table-wrap td a[href^="tel:"] { white-space: nowrap; }
.table-wrap td .wrap { white-space: normal; }   /* free text that happens to be bold/monospace */
@media (min-width: 1500px) { .table-wrap td { white-space: nowrap; } }
@media (max-width: 1499px) {
  .table-wrap table { font-size: .88rem; }
  .table-wrap th, .table-wrap td { padding: 8px 8px; }
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* KB article */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 32px; box-shadow: var(--shadow); }
/* Keep article text at a readable line length on very wide monitors. */
article.article { max-width: 1100px; }
.article h1 { font-size: 1.5rem; }
.article h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.article pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.article :not(pre) > code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.article table { margin: 12px 0; border: 1px solid var(--border); }
.article blockquote { margin: 12px 0; padding: 8px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; }
.article img { max-width: 100%; }
.kb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.kb-list li a { display: block; }

/* Search */
.result { padding: 12px 0; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result .meta { font-size: .82rem; color: var(--muted); }
mark { background: var(--warn-soft); color: inherit; padding: 0 2px; border-radius: 3px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 620px; max-height: 84vh; overflow-y: auto; padding: 20px 24px; }
.modal-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal-card h2 { margin: 0; flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 3px 10px; font-size: .8rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn.small { width: 28px; height: 28px; font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea, .rows-editor input {
  width: 100%; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus, .rows-editor input:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface);
}
.field textarea { resize: vertical; }
/* Password box with a show/hide eye (assets/js/password-eye.js) */
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-wrap input::-ms-reveal, .pw-wrap input::-ms-clear { display: none; }   /* avoid a second eye in Edge */
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 32px; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.pw-eye:hover, .pw-eye:focus-visible { color: var(--text); background: var(--surface-2); }
.pw-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.field-hint { font-size: .8rem; color: var(--muted); }
.field-hint.ok { color: var(--ok); }
.field-hint.warn { color: var(--warn); }
.field-hint.error { color: var(--danger); }
.field input.autofilled { background: var(--ok-soft); border-color: var(--ok); }
.rows-editor { display: grid; gap: 6px; justify-items: start; }
.rows-scroll { overflow-x: auto; width: 100%; }
.rows-editor table { font-size: .88rem; }
.rows-editor th { background: none; cursor: default; position: static; padding: 2px 4px; font-size: .78rem; color: var(--muted); border: 0; }
.rows-editor td { padding: 2px 3px; border: 0; }
.rows-editor input { padding: 5px 8px; min-width: 80px; }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.form-error { color: var(--danger); margin: 0; }
.modal-card.wide { max-width: 880px; }
.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.md-editor textarea { font-family: var(--mono); font-size: .88rem; min-height: 460px; line-height: 1.5; }
.md-preview { min-height: 460px; max-height: 75vh; overflow: auto; padding: 16px 20px; box-shadow: none; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.toast[hidden] { display: none; }

/* PDF documents */
.pdf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 8px; font-size: .88rem; }
.pdf-frame { display: block; width: 100%; height: 80vh; min-height: 420px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
#pdfDrop { margin-bottom: 4px; }

/* Photos */
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.thumb { position: relative; margin: 0; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); cursor: zoom-in; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: .95rem; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.thumb:hover .thumb-x, .thumb-x:focus { opacity: 1; }
.dropzone {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border: 2px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: .9rem;
  transition: border-color .15s, background .15s;
}
.dropzone.big { padding: 26px 20px; justify-content: center; text-align: center; margin-bottom: 16px; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.linklike { color: var(--accent); cursor: pointer; text-decoration: underline; }
tbody tr.drop-target td { background: var(--accent-soft); box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.photo-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.photo-card, .pick {
  display: flex; flex-direction: column; padding: 0; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.photo-card[hidden], .pick[hidden] { display: none; }
.photo-card:hover, .pick:hover { border-color: var(--accent); }
.photo-card img, .pick img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.photo-meta { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; font-size: .85rem; min-width: 0; }
.photo-meta > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin: 12px 0; max-height: 55vh; overflow-y: auto; padding: 2px; }
.pick span { padding: 6px 8px; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.on { border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: -3px; }
.pick.on span::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.photo-full { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto 12px; border-radius: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; }
.chip-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.chip-x:hover { color: var(--danger); }
.input-row select { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.link-row { margin-top: 10px; }

.notice { padding: 12px 16px; border-radius: 8px; background: var(--warn-soft); color: var(--text); border: 1px solid var(--border); margin-bottom: 16px; }

/* Mobile */
@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .sidebar-resizer { display: none; }
  .sidebar { width: min(var(--sidebar-w), 85vw); }
  .brand span { display: none; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 30; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 20px 16px 48px; }
  .article { padding: 18px 16px; }
  .form-grid, .md-editor { grid-template-columns: 1fr; }
  .md-editor textarea, .md-preview { min-height: 280px; }
}

/* Network › WAN / LAN: one card per connection with a full details table */
.net-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); align-items: start; }
.detail-table { font-size: .92rem; }
.detail-table th { position: static; cursor: default; width: 38%; color: var(--muted); font-weight: 500; white-space: normal; }
.detail-table td { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: 0; }

/* Network › Network map */
.map-wrap { overflow: auto; max-height: 78vh; cursor: grab; touch-action: pan-x pan-y; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.map-stage { position: relative; margin: 0 auto; }
.map-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.map-lines { position: absolute; inset: 0; overflow: visible; }
.map-link { fill: none; stroke: var(--accent); stroke-width: 2; }
.map-link.guess { stroke: var(--muted); stroke-width: 1.5; opacity: .6; }
.map-link.wireless { stroke: var(--muted); stroke-dasharray: 5 5; }
.map-node { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 6px 8px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  font: inherit; font-size: .8rem; cursor: pointer; text-align: center; box-shadow: var(--shadow); }
.map-node:hover:not([disabled]), .map-node:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.map-node[disabled] { cursor: default; }
.map-node.role-internet, .map-node.role-wan { background: var(--accent-soft); }
.map-icon { font-size: 1.35rem; line-height: 1; }
.map-icon .ico { width: 1.35rem; height: 1.35rem; }
.map-label { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-sub { color: var(--muted); font-size: .72rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .85rem; }
.map-legend .key { display: inline-block; width: 26px; border-top: 2px solid var(--accent); vertical-align: middle; }
.map-legend .key.guess { border-top: 1.5px solid var(--muted); opacity: .6; }
.map-legend .key.wireless { border-top: 2px dashed var(--muted); }
.map-lans { margin: 10px 0 18px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; }
.map-note { margin: 6px 0 0; font-size: .85rem; }
.map-zoom { display: inline-flex; gap: 4px; }
.map-editbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.map-wrap.editing { border-style: dashed; border-color: var(--accent); }
.map-wrap.editing .map-node[draggable] { cursor: grab; }
.map-node.dragging { opacity: .45; }
.map-node.drop-ok { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.map-remove { display: grid; gap: 8px; }
.map-remove .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 14px; height: auto; }
.map-remove .btn span { font-size: .85rem; font-weight: 400; opacity: .85; white-space: normal; }
.map-offmap { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; }
.map-show { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0 0 0 2px; }
.map-show:hover { text-decoration: underline; }
.map-node.ghost { background: transparent; border: 1.5px dashed var(--muted); box-shadow: none; opacity: .75; }
.map-node.ghost .map-icon { filter: grayscale(1); }
.map-node.ghost:hover:not([disabled]) { opacity: 1; border-color: var(--accent); }
.map-link.ghost { stroke: var(--muted); stroke-dasharray: 3 4; opacity: .7; }
.map-legend .key-box { display: inline-block; width: 22px; height: 14px; border: 1.5px dashed var(--muted); border-radius: 4px; vertical-align: middle; }
.map-wrap.panning { cursor: grabbing; user-select: none; }
.map-wrap .map-node { cursor: pointer; }
.map-tip kbd { font: inherit; font-size: .8em; padding: 0 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); }
/* Full-screen network map (click the map, or ⛶ Full screen) */
.map-frame { position: relative; }
.map-frame-bar { display: none; }
.map-expand { position: absolute; top: 8px; right: 8px; z-index: 2; }
.map-frame.fullscreen { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; background: var(--bg); }
.map-frame.fullscreen .map-frame-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.map-frame.fullscreen .map-frame-bar .grow { flex: 1; }
.map-frame.fullscreen .map-wrap { flex: 1; max-height: none; min-height: 0; }
.map-frame.fullscreen .map-expand { display: none; }
body.map-full-open { overflow: hidden; }
/* Table / Cards switch on device pages */
.view-toggle { display: inline-flex; margin-right: 6px; }
.view-toggle .btn { border-radius: 0; }
.view-toggle .btn:first-child { border-radius: 8px 0 0 8px; }
.view-toggle .btn:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.view-toggle .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Bordered sections for devices made of several parts (e.g. a till: Till, wristband reader, scanner, printer, EFTPOS) */
.detail-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 6px; margin: 10px 0; background: var(--surface-2); }
.detail-group h4 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.detail-group .detail-table th, .detail-group .detail-table td { background: transparent; }
.field-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
.field-group legend { padding: 0 6px; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
/* Section headings on a category page split by sub-menu (e.g. POS: Tills, then Kitchen Printers) */
.group-head { margin: 22px 0 8px; font-size: 1.1rem; }
.group-head:first-of-type { margin-top: 6px; }
/* Company logos (downloaded from the website by Look up) */
.co-logo { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; vertical-align: -3px; margin-right: 6px; background: #fff; }
.co-logo.md { width: 24px; height: 24px; vertical-align: -5px; margin-right: 8px; border-radius: 5px; }
.co-logo.lg { width: 36px; height: 36px; vertical-align: -7px; margin-right: 10px; border-radius: 8px; }
.co-title { display: flex; align-items: center; }
.logo-preview { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: .85rem; }
.logo-preview img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; }
