/* Sellstack — minimal, neutral inventory UI. No external fonts or frameworks. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #fafaf8; --ink: #141413; --ink-2: #3a3a37; --muted: #6d6d67; --line: #e4e3de; --line-2: #d6d5cf;
  --focus: #2f5bd3;
  --ok: #1d6b45; --ok-bg: #e7f2ea; --warn: #7d5300; --warn-bg: #f9efd8; --bad: #9e2723; --bad-bg: #f8e4e2;
  --info: #234e8c; --info-bg: #e6edf8; --sim: #57399c; --sim-bg: #eee8f8; --neutral: #55554f; --neutral-bg: #eeeeea;
  --r: 8px; --r-sm: 6px; --shadow: 0 1px 2px rgba(20,20,19,.04);
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --surface: #1a1a19; --surface-2: #1f1f1d; --ink: #f1f0ec; --ink-2: #d4d3ce; --muted: #9b9a94; --line: #2c2c2a; --line-2: #3a3a37;
    --ok: #7fd1a3; --ok-bg: #1b2e23; --warn: #e8c26d; --warn-bg: #33291a; --bad: #f19b95; --bad-bg: #3a1f1e; --info: #9dbcf0; --info-bg: #1c2638;
    --sim: #c4b0f2; --sim-bg: #2a2340; --neutral: #bdbcb6; --neutral-bg: #262624; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); font-feature-settings: "tnum" 1, "cv11" 1; }
a { color: inherit; text-underline-offset: 2px; }
a:hover { color: var(--ink-2); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 14px; font-weight: 650; }
h3, .h3 { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
p { margin: 0 0 8px; }
code { font-family: var(--mono); font-size: 12px; background: var(--neutral-bg); padding: 1px 4px; border-radius: 4px; }
pre { margin: 0; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--surface); padding: 8px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.i { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre { white-space: pre-wrap; }
.mt { margin-top: 12px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; } .row.between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.stack > .btn, .stack > form > .btn { justify-content: center; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 14px 10px; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 4px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--ink); color: var(--surface); display: grid; place-items: center; font-weight: 750; font-size: 15px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-weight: 500; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar nav a.on { background: var(--neutral-bg); color: var(--ink); font-weight: 600; }
.sidebar nav a span { flex: 1; }
.count { font-style: normal; font-size: 11px; background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 0 7px; font-weight: 650; }
.count.warn { background: var(--bad-bg); color: var(--bad); }
.sidebar-foot { margin-top: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 14px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
main { padding: 20px 28px 96px; max-width: 1280px; width: 100%; }
main.wide { max-width: none; }
.tabbar { display: none; }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card.inner { margin: 0; background: var(--surface-2); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.cards > .card { margin: 0; }
.form-grid, .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.col-side { position: sticky; top: 84px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid > .card { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.grid2.tight { gap: 8px 10px; }
.span2 { grid-column: span 2; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 550 13px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--neutral-bg); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; display: inline-flex; gap: 6px; align-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 14px; line-height: 1; }
.icon-btn.danger:hover { color: var(--bad); border-color: var(--bad); }
.icon-btn[aria-pressed="true"] { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.chip { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 999px; padding: 1px 10px; font: 550 12px var(--font); cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--ink); }

/* Forms */
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > span:first-child { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.fld.inline { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
input[type=text], input[type=search], input[type=url], input[type=password], input[type=date], input:not([type]), input[inputmode], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 14px var(--font);
}
textarea { height: auto; padding: 8px 10px; line-height: 1.45; resize: vertical; }
textarea.mono { font: 13px/1.55 var(--mono); }
select { padding-right: 26px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.err { color: var(--bad); font-size: 12px; margin: 2px 0 0; }
.hint { color: var(--muted); font-size: 12px; }
.unit-input { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.unit-input:focus-within { border-color: var(--ink); }
.unit-input input, .unit-input select { border: 0; border-radius: 0; box-shadow: none !important; }
.unit-input em { font-style: normal; white-space: nowrap; color: var(--muted); font-size: 12px; padding: 0 10px; display: grid; place-items: center; background: var(--surface-2); border-left: 1px solid var(--line); }
.unit-input.pre em { border-left: 0; border-right: 1px solid var(--line); font-weight: 600; color: var(--ink-2); }
.unit-input select.cur { width: 92px; flex: none; border-right: 1px solid var(--line); background: var(--surface-2); }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; display: flex; gap: 14px; flex-wrap: wrap; margin: 0; }
legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
details > summary { cursor: pointer; font-weight: 550; }
details[open] > summary { margin-bottom: 8px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline { display: inline-flex; gap: 4px; }
.w-xs { width: 64px !important; } .w-s { width: 96px !important; } .w-l { width: 280px !important; } .w-full { flex-basis: 100%; }
.suggest { font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px; }
.sticky-actions { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 3; }
.sticky-actions .btn { flex: 1; justify-content: center; height: 40px; }

/* Pills & badges */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--info-bg); color: var(--info); }
.pill.sim { background: var(--sim-bg); color: var(--sim); } .pill.dark { background: var(--ink); color: var(--surface); }
a .pill { cursor: pointer; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.small td { padding: 6px 8px; font-size: 12.5px; }
.tbl .cb { width: 34px; }
.tbl .t { width: 56px; }
.tbl a.strong { font-weight: 600; text-decoration: none; }
.tbl a.strong:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-bad td { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); }
.row-warn td { background: color-mix(in srgb, var(--warn-bg) 45%, transparent); }
.tbl.caps td:first-child { color: var(--muted); }
.matrix td { white-space: nowrap; }
.item-cell { display: flex; gap: 10px; align-items: center; min-width: 220px; white-space: normal; }
.thumb { width: 44px; height: 44px; border-radius: 5px; object-fit: cover; background: var(--neutral-bg); display: block; }
.thumb.empty { display: inline-block; border: 1px dashed var(--line-2); }
.mk-dots { display: flex; gap: 4px; }
.mk-dot { width: 22px; height: 22px; border-radius: 5px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--neutral-bg); color: var(--muted); border: 1px dashed var(--line-2); }
.mk-dot.active { background: var(--ok-bg); color: var(--ok); border: 0; }
.mk-dot.awaiting_manual, .mk-dot.prepared, .mk-dot.queued, .mk-dot.publishing { background: var(--warn-bg); color: var(--warn); border: 0; }
.mk-dot.failed, .mk-dot.unknown { background: var(--bad-bg); color: var(--bad); border: 0; }
.mk-dot.sold { background: var(--ink); color: var(--surface); border: 0; }
.mk-dot.sim { background: var(--sim-bg); color: var(--sim); border: 0; }
.legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select { width: auto; max-width: 220px; }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); padding: 0 0 0 10px; flex: 1 1 240px; color: var(--muted); }
.search input { border: 0; box-shadow: none !important; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 12px; }
.seg a { padding: 6px 12px; text-decoration: none; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); background: var(--surface); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ink); color: var(--surface); }
.filters .seg { margin: 0; }
.seg-checks { display: flex; gap: 14px; flex-wrap: wrap; }
.bulkbar { position: sticky; top: 72px; z-index: 4; display: flex; gap: 10px; align-items: center; background: var(--ink); color: var(--surface); border-radius: var(--r-sm); padding: 6px 8px 6px 14px; margin-bottom: 10px; }
.bulkbar[hidden] { display: none; }
.bulkbar .btn.primary { background: var(--surface); color: var(--ink); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.pager span { margin-right: auto; }

/* Dashboard */
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
a.stat:hover { border-color: var(--line-2); }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--muted); line-height: 1.3; }
.stat.bad .v { color: var(--bad); } .stat.warn .v { color: var(--warn); } .stat.ok .v { color: var(--ok); }
.small-stats { grid-template-columns: repeat(4, 1fr); }
.note { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--r-sm); padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }
.feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.feed li { line-height: 1.4; }
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; padding: 3px 0; font-size: 13px; }
meter { width: 100%; height: 8px; }
.checked-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.checked-strip > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 180px; }

/* Key/values */
.kv { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv li:last-child { border-bottom: 0; }
.kv li > span:first-child { color: var(--muted); flex: none; }
.kv li > span:last-child { text-align: right; }
.notes { padding-left: 18px; color: var(--muted); }
.notes li { margin-bottom: 4px; }

/* Flash */
.flash { margin: 14px 28px 0; padding: 10px 14px; border-radius: var(--r-sm); font-size: 13.5px; border: 1px solid var(--line); background: var(--surface); display: flex; gap: 8px; align-items: center; }
main .flash { margin: 0 0 14px; }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-bg); color: var(--ok); }
.flash.error { border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-bg); color: var(--bad); }
.flash.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }

/* Photos */
.dropzone { position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--r); background: var(--surface-2); transition: border-color .15s; }
.dropzone.over { border-color: var(--ink); background: var(--neutral-bg); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-label { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 22px; color: var(--muted); text-align: center; pointer-events: none; }
.drop-label strong { color: var(--ink); }
.photos { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--neutral-bg); cursor: grab; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.dragging { opacity: .4; }
.photo.flaw { outline: 2px solid var(--warn); outline-offset: -2px; }
.photo .idx, .gallery-strip .idx { position: absolute; top: 6px; left: 6px; background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 6px; line-height: 18px; }
.photo:first-child .idx::after { content: " · cover"; font-weight: 500; }
.photo-tools { position: absolute; bottom: 6px; left: 6px; right: 6px; display: flex; gap: 4px; justify-content: flex-end; }
.photo-tools .icon-btn { width: 26px; height: 26px; background: color-mix(in srgb, var(--surface) 92%, transparent); }
.photo.uploading::after { content: attr(data-progress); position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent); font-weight: 650; }
.photo.failed { border-color: var(--bad); }
.gallery-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.gallery-strip a { position: relative; display: block; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--neutral-bg); }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; }
.flaw-tag { position: absolute; bottom: 4px; left: 4px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 650; padding: 0 6px; border-radius: 4px; }

/* Measurements */
.meas.dim { opacity: .5; }
.meas.used > span:first-child::after { content: " · in description"; color: var(--ok); font-weight: 500; }

/* Description preview */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 7px 12px; font: 550 13px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.preview-pane { display: none; }
.preview-pane.on { display: block; }
pre.desc { white-space: pre-wrap; font: 13px/1.55 var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; margin: 0; min-height: 60px; }
.warnings { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }
.warnings li { font-size: 12.5px; background: var(--warn-bg); color: var(--warn); border-radius: var(--r-sm); padding: 5px 10px; }
.warnings li.bad { background: var(--bad-bg); color: var(--bad); }
.warn-line { color: var(--warn); font-size: 13px; }
.override { margin-top: 12px; }
.ship-src { margin: 0 0 10px; }
.kv.small li { font-size: 12.5px; }
.mkt-choices { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 10px; }

/* Assisted */
.copy-row { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px; }
.copy-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.copy-val { font-size: 15px; font-weight: 550; word-break: break-word; }
.checklist { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; font-size: 13px; }
.steps { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface); }
.empty h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 15px; margin: 0 0 6px; }
.empty .row { justify-content: center; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(360px, 92vw); display: flex; flex-direction: column; gap: 14px; }

/* Responsive */
@media (max-width: 1080px) {
  .form-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .grid5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 780px) {
  body { font-size: 15px; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; width: 36px; height: 36px; }
  .topbar { padding: 12px 16px; }
  .topbar .actions .btn { height: 32px; padding: 0 10px; }
  main { padding: 14px 16px 110px; }
  .flash { margin: 10px 16px 0; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .grid2.tight { grid-template-columns: 1fr 1fr; }
  .grid5 { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: auto; }
  .small-stats { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 2px 8px; }
  .tabbar a.on { color: var(--ink); font-weight: 600; }
  .tabbar a.new { color: var(--surface); background: var(--ink); border-radius: 12px; padding: 6px 14px; }
  .sticky-actions { bottom: 62px; }
  .filters select { max-width: none; flex: 1 1 45%; }
  .tbl.inv th:nth-child(6), .tbl.inv td:nth-child(6) { display: none; }
  .w-l { width: 100% !important; }
  .inline-form { flex-wrap: wrap; }
  .bars li { grid-template-columns: 90px 1fr 30px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.conn-list { list-style: none; margin: 0; padding: 0; }
.conn-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.conn-list li:last-child { border-bottom: 0; }
.conn-list .row { gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.conn-list p { margin: 3px 0 0; }

/* Home-screen (standalone) app on iPhone: respect the notch and home indicator */
.topbar { padding-top: max(18px, env(safe-area-inset-top)); }
.note.install { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note.install[hidden] { display: none; }
@media (max-width: 780px) {
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .sidebar { padding-top: max(14px, env(safe-area-inset-top)); }
}
[hidden] { display: none !important; }

.photo-sources { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-sources .btn { flex: 1 1 auto; justify-content: center; cursor: pointer; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sidebar-foot .pill { white-space: normal; }
@media (max-width: 780px) {
  .sidebar { visibility: hidden; box-shadow: none; transition: transform .2s, visibility .2s; }
  .sidebar.open { visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.2); }
}
