:root {
  --bg: #f6f6f4; --panel: #fff; --text: #1c1c1a; --muted: #6b6b66; --line: #d9d9d3;
  --accent: #b45309; --accent-text: #fff; --danger: #b42318; --ok: #1a7f37; --warn: #9a6700;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --panel: #212120; --text: #ecece8; --muted: #a0a09a; --line: #3a3a37; --accent: #e08a2e; --accent-text: #1a1a18; --danger: #ff7b72; --ok: #56d364; --warn: #e3b341; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
#topbar[hidden], #banner[hidden] { display: none; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.spacer { flex: 1; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.field.wide { grid-column: 1 / -1; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); margin-right: 14px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button {
  font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  border-radius: 6px; padding: 7px 14px; text-decoration: none; display: inline-block;
}
button.secondary, .button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.badge.active { color: var(--ok); border-color: var(--ok); }
.badge.pending { color: var(--warn); border-color: var(--warn); }
.badge.blocked, .badge.disabled { color: var(--danger); border-color: var(--danger); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
#banner { padding: 10px 16px; background: var(--danger); color: #fff; }
#banner.info { background: var(--ok); }
.images { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.image-slot { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.image-slot img { max-width: 100%; max-height: 120px; background: repeating-conic-gradient(#0000000f 0% 25%, transparent 0% 50%) 50% / 16px 16px; border-radius: 4px; }
.swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.login { max-width: 360px; margin: 10vh auto 0; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; }

.qr img { background: #fff; padding: 6px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.grow { flex: 1; min-width: 240px; }
textarea.mono { word-break: break-all; }
pre.report { white-space: pre-wrap; font-size: 12px; margin: 4px 0 0; }
.navlink { color: var(--muted); text-decoration: none; margin-left: 8px; }
.navlink:hover { color: var(--text); }
tr.sub td { font-size: 13px; color: var(--muted); }
