/* ── app.css — Reporty v3 ────────────────────────────────────
   Mobile-first · CSS custom properties · Dark mode
   ─────────────────────────────────────────────────────────── */

/* ── Variables ───────────────────────────────────────────────*/
:root {
  --accent:       #2563eb;
  --accent-bg:    #eff6ff;
  --accent-dark:  #1d4ed8;
  --done:         #16a34a;
  --done-bg:      #f0fdf4;
  --issue:        #dc2626;
  --issue-bg:     #fef2f2;
  --pending:      #d97706;
  --pending-bg:   #fffbeb;
  --partial:      #2563eb;

  --bg1:    #ffffff;
  --bg2:    #f8fafc;
  --bg3:    #f1f5f9;
  --border: #e2e8f0;
  --text1:  #0f172a;
  --text2:  #334155;
  --text3:  #64748b;
  --text4:  #94a3b8;

  --radius:  10px;
  --radius-sm: 6px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);

  --fm: 'IBM Plex Mono', 'Courier New', monospace;
  --fs: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --nav-h:     60px;
  --header-h:  52px;
}

[data-theme="dark"] {
  --accent:     #3b82f6;
  --accent-bg:  #1e3a5f;
  --done:       #22c55e;
  --done-bg:    #052e16;
  --issue:      #f87171;
  --issue-bg:   #450a0a;
  --pending:    #fbbf24;
  --pending-bg: #451a03;

  --bg1:   #0f172a;
  --bg2:   #1e293b;
  --bg3:   #334155;
  --border:#334155;
  --text1: #f8fafc;
  --text2: #cbd5e1;
  --text3: #94a3b8;
  --text4: #475569;
}

/* ── Reset ───────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--fs);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text1);
  background: var(--bg1);
  min-height: 100%;
  overscroll-behavior: none;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--accent); }

/* ── Typography ──────────────────────────────────────────────*/
.mono { font-family: var(--fm); }
.section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text3); padding: 10px 16px 6px;
}

/* ── Loading bar ─────────────────────────────────────────────*/
#loadingBar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  animation: loading-slide 1.2s ease-in-out infinite;
}
@keyframes loading-slide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ── Offline banner ──────────────────────────────────────────*/
#offlineBanner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9998;
  background: #f59e0b; color: #fff;
  padding: 6px 16px; font-size: 13px; font-weight: 600;
  text-align: center;
}

/* ── Toast ───────────────────────────────────────────────────*/
#toastWrap { position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 24px; font-size: 14px; font-weight: 500;
  background: var(--text1); color: var(--bg1);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
  white-space: nowrap; max-width: 90vw; text-align: center;
}
.toast.toast-show { opacity: 1; transform: none; }
.toast-success { background: var(--done); }
.toast-error   { background: var(--issue); }
.toast-info    { background: var(--accent); }

/* ── App layout ──────────────────────────────────────────────*/
#app {
  display: flex; flex-direction: column;
  height: 100dvh; max-height: 100dvh; overflow: hidden;
}
#app[hidden] { display: none !important; }

/* ── Header ──────────────────────────────────────────────────*/
.app-header {
  height: var(--header-h); flex-shrink: 0;
  background: var(--bg1); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 12px; gap: 8px;
  position: relative; z-index: 100;
}
.header-project { flex: 1; min-width: 0; cursor: pointer; }
.header-project-name {
  font-size: 15px; font-weight: 700; color: var(--text1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-project-sub {
  font-size: 11px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text2); flex-shrink: 0;
  transition: background .15s;
}
.header-btn:hover, .header-btn:focus-visible { background: var(--bg3); }
.header-btn.active { color: var(--accent); }

/* ── Views ───────────────────────────────────────────────────*/
.views-wrap { flex: 1; overflow: hidden; position: relative; }
.view { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Bottom nav ──────────────────────────────────────────────*/
.bottom-nav {
  height: var(--nav-h); flex-shrink: 0;
  background: var(--bg1); border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  position: relative; z-index: 100;
}
[data-nav] {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--text3); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .4px;
  transition: color .15s; padding: 0 4px;
  border-radius: 0; /* reset for buttons */
}
[data-nav] .nav-icon { font-size: 22px; line-height: 1; }
[data-nav].active { color: var(--accent); }
[data-nav]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Login ───────────────────────────────────────────────────*/
#loginScreen {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: var(--bg2); padding: 24px;
}
#loginScreen[hidden] { display: none !important; }
.login-card {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 24px;
  width: 100%; max-width: 360px; box-shadow: var(--shadow-md);
}
.login-logo { font-size: 28px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.login-sub  { font-size: 13px; color: var(--text3); margin-bottom: 24px; }
.login-err  { background: var(--issue-bg); color: var(--issue); border: 1px solid var(--issue);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }

/* ── Forms ───────────────────────────────────────────────────*/
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.form-input  {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg1); color: var(--text1);
  font-size: 15px; transition: border-color .15s;
  -webkit-appearance: none;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-input::placeholder { color: var(--text4); }
.form-select { width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg1); color: var(--text1); font-size: 15px; }

/* ── Buttons ─────────────────────────────────────────────────*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; transition: background .15s, opacity .15s;
  border: 1px solid transparent;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: var(--bg3); color: var(--text2); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-danger    { background: var(--issue); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ghost     { background: transparent; color: var(--text3); padding: 6px; }
.btn-sm        { padding: 6px 12px; font-size: 13px; }

/* ── Overlays / sheets ───────────────────────────────────────*/
.overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.4); backdrop-filter: blur(2px);
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--bg1); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px; max-height: 90dvh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
}

/* Settings dropdown — top right, not bottom sheet */
#settingsMenu {
  position: fixed; top: calc(var(--header-h) + 6px); right: 12px;
  width: 260px; z-index: 600;
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; overflow: hidden;
}
#settingsMenu[hidden] { display: none !important; }
#settingsMenu .sheet-handle { display: none; }
#settingsMenu .settings-item { padding: 12px 16px; font-size: 14px; }
#settingsMenu .settings-user { padding: 12px 16px; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 12px auto 0; }
.sheet-header { padding: 12px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sheet-title  { font-size: 17px; font-weight: 700; color: var(--text1); }
.sheet-sub    { font-size: 13px; color: var(--text3); }
.sheet-close  { position: absolute; top: 12px; right: 16px; width: 32px; height: 32px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text3); background: var(--bg3); }
.sheet-close:focus-visible { outline: 2px solid var(--accent); }
.sheet-body   { flex: 1; overflow-y: auto; padding: 16px 20px; }
.sheet-footer { padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
  display: flex; gap: 8px; }

/* ── Cards ───────────────────────────────────────────────────*/
.device-card {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px;
  box-shadow: var(--shadow); overflow: hidden;
}
.device-card.status-done  { border-left: 3px solid var(--done); }
.device-card.status-issue { border-left: 3px solid var(--issue); }
.device-card.status-pending { border-left: 3px solid var(--border); }
.device-card-header {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; cursor: pointer; user-select: none;
}
.device-card-header:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.status-icon  { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.device-info  { flex: 1; min-width: 0; }
.device-name  { font-size: 14px; font-weight: 700; color: var(--text1); }
.device-meta  { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.device-meta span { font-size: 12px; color: var(--text3); }
.device-by    { font-size: 11px; color: var(--text3); font-style: italic; margin-top: 3px; }
.card-end     { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chevron      { font-size: 16px; color: var(--text3); transition: transform .2s; }
.chevron.open { transform: rotate(180deg); }
.photo-count  { font-size: 11px; color: var(--text3); }
.reset-btn    { font-size: 16px; color: var(--text4); opacity: .6; padding: 2px 4px; }
.reset-btn:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }

.device-body {
  padding: 0 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border);
}
.device-body[hidden] { display: none; }

/* ── Photos ──────────────────────────────────────────────────*/
.photo-add-btn {
  width: 100%; padding: 20px; border: 2px dashed var(--border);
  border-radius: var(--radius-sm); text-align: center; color: var(--text3);
  font-size: 14px; cursor: pointer; margin-top: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.photo-single { position: relative; }
.photo-single img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.photo-thumb { position: relative; }
.photo-thumb img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; }
.photo-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.add-photo-link { font-size: 13px; color: var(--accent); cursor: pointer; text-align: center; padding: 4px 0; }

/* ── Comments ────────────────────────────────────────────────*/
.comment-row { display: flex; gap: 8px; align-items: flex-end; }
.comment-input { flex: 1; resize: none; min-height: 40px; }
.send-btn {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.send-btn[hidden] { display: none; }
.send-btn:focus-visible { outline: 2px solid var(--accent-dark); }
.issue-hint { font-size: 11px; color: var(--issue); margin-top: -4px; }

.action-row { display: flex; gap: 8px; }
.action-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s; background: var(--bg2);
}
.action-btn.done-btn.selected  { background: var(--done-bg);  border-color: var(--done);  color: var(--done); }
.action-btn.issue-btn.selected { background: var(--issue-bg); border-color: var(--issue); color: var(--issue); }
.action-btn:focus-visible { outline: 2px solid var(--accent); }

.comments-inline { margin-top: 4px; }
.comments-thread { border-top: 1px solid var(--border); padding-top: 10px; }
.comments-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); margin-bottom: 8px; }
.comment-item    { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.comment-item.activity .comment-avatar { background: var(--bg3); border: 1px solid var(--border); color: var(--text3); }
.comment-avatar  { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--accent-bg); border: 1px solid var(--accent); color: var(--accent); }
.comment-body    { flex: 1; min-width: 0; }
.comment-meta    { font-size: 11px; color: var(--text3); margin-bottom: 2px; display: flex; gap: 6px; }
.comment-text    { font-size: 13px; color: var(--text2); }
.comment-item.activity .comment-text { font-style: italic; color: var(--text3); }
.comment-del     { font-size: 13px; color: var(--text4); padding: 2px 4px; flex-shrink: 0; opacity: .5; }
.loading-comments { font-size: 12px; color: var(--text3); padding: 4px 0; }

/* ── Inline confirm ──────────────────────────────────────────*/
.inline-confirm { background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; font-size: 13px; }
.inline-confirm[hidden] { display: none; }
.confirm-msg  { display: block; margin-bottom: 8px; }
.confirm-btns { display: flex; gap: 8px; }

/* ── Floor accordion ─────────────────────────────────────────*/
.floor-group { margin-bottom: 8px; }
.floor-header {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: background .15s;
  font-size: 14px; font-weight: 600; color: var(--text1);
}
.floor-header.open  { border-radius: var(--radius) var(--radius) 0 0; border-bottom: none; }
.floor-header:focus-visible { outline: 2px solid var(--accent); }
.floor-chevron { font-size: 14px; transition: transform .2s; }
.floor-header.open .floor-chevron { transform: rotate(180deg); }
.floor-name  { flex: 1; text-align: left; }
.floor-pills { display: flex; gap: 4px; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.pill-done    { background: var(--done-bg);    color: var(--done); }
.pill-issue   { background: var(--issue-bg);   color: var(--issue); }
.pill-pending { background: var(--pending-bg); color: var(--pending); }
.floor-pct   { font-size: 13px; font-weight: 700; flex-shrink: 0; }

.floor-body  { border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; display: none; }
.floor-body.open { display: block; }
.floor-progress-bar  { height: 3px; background: var(--bg3); }
.floor-progress-fill { height: 100%; background: var(--accent); transition: width .4s; }
.floor-empty { padding: 12px 16px; font-size: 13px; color: var(--text3); }

/* ── Room rows ───────────────────────────────────────────────*/
.room-row {
  display: flex; align-items: center; gap: 0;
  padding: 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
  min-height: 54px;
}
.room-row:last-child { border-bottom: none; }
.room-row:hover, .room-row:focus-visible { background: var(--bg3); outline: none; }
.room-strip { width: 4px; align-self: stretch; flex-shrink: 0; }
.room-strip.done    { background: var(--done); }
.room-strip.issue   { background: var(--issue); }
.room-strip.partial { background: var(--accent); }
.room-strip.pending { background: var(--border); }
.room-info  { flex: 1; padding: 10px 12px; min-width: 0; }
.room-name  { font-size: 14px; font-weight: 600; color: var(--text1); }
.room-meta  { font-size: 12px; color: var(--text3); }
.issue-count { color: var(--issue); }
.room-bar   { height: 3px; background: var(--bg3); border-radius: 2px; margin-top: 5px; }
.room-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.room-chevron { font-size: 18px; color: var(--text4); padding: 0 14px; flex-shrink: 0; }

/* ── Type badge ──────────────────────────────────────────────*/
.type-badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: var(--accent-bg); color: var(--accent);
}

/* ── Status dot (inventory) ──────────────────────────────────*/
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.status-done    { background: var(--done); }
.status-dot.status-issue   { background: var(--issue); }
.status-dot.status-pending { background: var(--pending); }

/* ── Filter chips ────────────────────────────────────────────*/
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text2);
  transition: all .15s; white-space: nowrap;
}
.filter-chip.active  { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-chip:focus-visible { outline: 2px solid var(--accent); }

/* ── Inventory ───────────────────────────────────────────────*/
.inv-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.inv-row   { border-bottom: 1px solid var(--border); }
.inv-row:last-child { border-bottom: none; }
.inv-row-main { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; min-height: 44px; }
.inv-row-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.inv-parts { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.inv-num   { font-weight: 700; color: var(--accent); }
.inv-sn, .inv-mac { color: var(--text3); }
.dot-sep   { color: var(--border); }
.inv-chevron { font-size: 14px; color: var(--text3); flex-shrink: 0; }
.inv-detail { padding: 10px 14px 14px; background: var(--bg2); border-top: 1px solid var(--border); }
.inv-detail[hidden] { display: none; }
.inv-detail-info { font-size: 13px; color: var(--text3); margin-bottom: 8px; display: flex; flex-direction: column; gap: 3px; }
.inv-room-group { margin-bottom: 16px; }
.inv-room-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.inv-empty { font-size: 13px; color: var(--text3); padding: 16px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.detail-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ── Scan mode ───────────────────────────────────────────────*/
.scan-panel { overflow: hidden; max-height: 0; transition: max-height .3s ease; }
.scan-body  { padding: 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 16px 16px; }
.scan-status { font-size: 13px; min-height: 20px; padding: 4px 0; font-weight: 600; }
.scan-success { color: var(--done); }
.scan-error   { color: var(--issue); }
.scan-log-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ── Assign from field sheet ─────────────────────────────────*/
.assign-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.assign-info { flex: 1; min-width: 0; }
.assign-name { font-size: 13px; font-weight: 600; display: block; }
.assign-meta { font-size: 11px; color: var(--text3); display: block; }
.empty-search { font-size: 13px; color: var(--text3); padding: 16px; text-align: center; }

/* ── Stats ───────────────────────────────────────────────────*/
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 16px; }
.stat-card  { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); margin-top: 2px; }

/* ── Progress bar ────────────────────────────────────────────*/
#progressBar { height: 6px; background: var(--bg3); border-radius: 3px; margin: 0 16px 12px; overflow: hidden; }
#progressFill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }

/* ── Issues ──────────────────────────────────────────────────*/
.issue-card { background: var(--bg1); border: 1px solid var(--border); border-left: 3px solid var(--issue);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow); }
.issue-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 14px; }
.issue-title  { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.issue-location { font-size: 12px; color: var(--text3); margin-top: 2px; }
.issue-by       { font-size: 11px; color: var(--text3); font-style: italic; margin-top: 2px; }
.issue-actions  { display: flex; gap: 6px; flex-shrink: 0; }
.issue-comments { padding: 0 14px 14px; }
.issue-last-comment { background: var(--bg2); border-radius: var(--radius-sm); padding: 10px; }
.comment-more   { font-size: 11px; color: var(--accent); margin-top: 4px; }

/* ── Edit mode card ──────────────────────────────────────────*/
.edit-card { border-color: var(--accent); background: var(--accent-bg) !important; }
.edit-card-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.edit-row  { display: flex; align-items: center; gap: 8px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg1); color: var(--text1);
  font-size: 13px; -webkit-appearance: none;
}
.edit-input.mono { font-family: var(--fm); }
.edit-input:focus { outline: none; border-color: var(--accent); }
.edit-actions { display: flex; gap: 8px; }

/* ── Wizard ──────────────────────────────────────────────────*/
.wizard-steps { display: flex; gap: 8px; margin-bottom: 20px; }
.wizard-step  { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.wizard-step.active { background: var(--accent); }
.wizard-step.done   { background: var(--done); }
.room-chip    { display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-bg); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 20px; padding: 3px 10px; font-size: 13px;
  font-weight: 600; margin: 3px; }
.room-chip-remove { background: none; border: none; color: var(--accent);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 0 0 2px; }

/* ── Project cards ───────────────────────────────────────────*/
.project-card { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color .15s; }
.project-card:hover, .project-card:focus-visible { border-color: var(--accent); outline: none; }
.project-card.current { border-color: var(--accent); }
.project-card-row   { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.project-card-name  { font-size: 15px; font-weight: 700; }
.project-card-meta  { font-size: 12px; color: var(--text3); margin-top: 2px; }
.project-card-btns  { display: flex; gap: 6px; flex-shrink: 0; }
.current-badge { font-size: 11px; color: var(--accent); font-weight: 500; }
.archived-badge { font-size: 13px; }

/* ── User rows ───────────────────────────────────────────────*/
.user-row   { border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-main  { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-bg); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--accent); }
.user-info  { flex: 1; min-width: 0; }
.user-name  { font-size: 14px; font-weight: 700; }
.user-meta  { display: flex; gap: 8px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; }
.role-badge.role-admin  { background: var(--accent-bg); color: var(--accent); }
.role-badge.role-tech   { background: var(--done-bg);   color: var(--done); }
.role-badge.role-viewer { background: var(--bg3);       color: var(--text3); }
.totp-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: var(--done-bg); color: var(--done); }
.pass-row      { padding: 0 14px; }
.pass-row-inner { display: flex; align-items: center; gap: 8px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; }
.pass-label    { font-size: 12px; color: var(--text3); flex-shrink: 0; }
.pass-input-wrap { flex: 1; position: relative; }
.pass-input-wrap input { padding-right: 36px; }
.pass-input-wrap .btn-ghost { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 4px; }

/* ── Models ──────────────────────────────────────────────────*/
.model-row    { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.model-row:last-child { border-bottom: none; }
.model-info   { flex: 1; min-width: 0; }
.model-name   { font-size: 14px; font-weight: 600; }
.model-meta   { font-size: 12px; color: var(--text3); }
.model-notes  { font-size: 12px; color: var(--text3); font-style: italic; }
.model-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Report ──────────────────────────────────────────────────*/
.report-content { padding: 16px; }
.report-header  { margin-bottom: 20px; }
.report-project { font-size: 18px; font-weight: 800; }
.report-date    { font-size: 14px; color: var(--text3); }
.report-stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 14px; }
.report-stat-card  { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.report-stat-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.report-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text3); margin-top: 2px; }
.report-section { margin-bottom: 20px; }
.report-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); margin-bottom: 8px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th { padding: 6px 8px; background: var(--bg2); font-weight: 700; text-align: left; font-size: 11px; border: 1px solid var(--border); }
.report-table td { padding: 6px 8px; border: 1px solid var(--border); }
.report-footer { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.report-notes  { background: var(--bg2); border-radius: var(--radius-sm); padding: 12px; font-size: 13px; }
.date-chip     { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-bg); border: 1px solid var(--accent); border-radius: 20px; padding: 3px 10px; font-size: 13px; color: var(--accent); font-weight: 600; margin: 3px; }
.chip-remove   { background: none; border: none; color: var(--accent); font-size: 15px; cursor: pointer; }

/* ── Settings ────────────────────────────────────────────────*/
.settings-item { display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 15px; }
.settings-item:hover { background: var(--bg3); }
.settings-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.settings-user { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.settings-name { font-size: 16px; font-weight: 700; }
.settings-role { font-size: 13px; color: var(--text3); }

/* ── Changelog ───────────────────────────────────────────────*/
.changelog-entry   { margin-bottom: 24px; }
.changelog-version { font-size: 15px; font-weight: 700; color: var(--accent); }
.changelog-date    { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.changelog-list    { padding-left: 18px; font-size: 13px; color: var(--text2); line-height: 1.8; }
.changelog-about   { background: var(--bg2); border-radius: var(--radius); padding: 16px; margin-top: 16px; text-align: center; }
.about-title       { font-size: 18px; font-weight: 800; color: var(--accent); }
.about-sub, .about-meta { font-size: 13px; color: var(--text3); margin-top: 4px; }
.roadmap-title     { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); margin-top: 14px; margin-bottom: 4px; }
.roadmap-items     { font-size: 13px; color: var(--text2); }

/* ── Edit project floors ─────────────────────────────────────*/
.ep-floor        { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; }
.ep-floor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ep-floor-name   { font-weight: 600; font-size: 13px; }
.ep-floor-btns   { display: flex; gap: 4px; }
.ep-rooms        { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Lightbox ────────────────────────────────────────────────*/
.lightbox-inner { width: 100%; max-width: 640px; padding: 16px; }
.lightbox-img   { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: var(--radius); }
.lightbox-caption { font-size: 13px; color: var(--text3); text-align: center; margin-top: 8px; }
.lightbox-nav   { display: flex; justify-content: center; gap: 16px; margin-top: 12px; }
.lightbox-thumbs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.lightbox-thumb { border: 2px solid transparent; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; }
.lightbox-thumb.active { border-color: var(--accent); }
.lightbox-thumb img { width: 52px; height: 52px; object-fit: cover; display: block; }

/* ── Confirm dialog ──────────────────────────────────────────*/
#confirmDialog { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow-md); width: min(380px, 92vw); z-index: 600; }
#confirmDialog[hidden] { display: none; }
#confirmTitle  { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
#confirmMsg    { font-size: 14px; color: var(--text2); margin-bottom: 14px; }

/* ── Toggle switch ───────────────────────────────────────────*/
.toggle-switch { position: relative; width: 44px; height: 24px; border-radius: 12px;
  background: var(--border); transition: background .2s; flex-shrink: 0; }
.toggle-switch[aria-checked="true"] { background: var(--accent); }
.toggle-knob  { position: absolute; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.toggle-switch[aria-checked="true"] .toggle-knob { transform: translateX(20px); }

/* ── Empty state ─────────────────────────────────────────────*/
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon  { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--text1); margin-bottom: 6px; }
.empty-sub   { font-size: 14px; color: var(--text3); margin-bottom: 20px; }

/* ── Accessibility ───────────────────────────────────────────*/
#a11yAnnounce { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ── Utility ─────────────────────────────────────────────────*/
.page-pad { padding: 12px 16px; }
.divider  { height: 1px; background: var(--border); }
