/* ═══════════════════════════════════════════════════════════
   styles.css — home·org
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }

:root {
  --bg: #f4f2ee; --surface: #fff; --surface2: #f0ede8;
  --border: #e2ddd6; --border2: #ccc8c0;
  --text: #1a1815; --text2: #6b6560; --text3: #a09890;
  --accent: #2d5a3d; --accent-bg: #eaf2ec; --accent2: #1e3d2a;
  --amber: #b85c00; --amber-bg: #fff4e6;
  --red: #b83232; --red-bg: #fff0f0;
  --blue: #1a4a7a; --blue-bg: #eef4fc;
  --font: 'DM Sans', sans-serif; --mono: 'DM Mono', monospace;
  --r: 8px; --r2: 12px; --r3: 16px;
  --topbar: 52px; --sidebar: 300px;
}

html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); overflow: hidden }

/* ── Layout ── */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--topbar) 1fr; height: 100vh; transition: grid-template-columns .25s ease }
.app.sidebar-hidden { grid-template-columns: 0 1fr }
.app.sidebar-hidden .sidebar { border-right: none; pointer-events: none; opacity: 0 }
.app.sidebar-hidden #btn-toggle-sidebar .sidebar-icon { transform: scaleX(-1) }

/* ── Topbar ── */
.topbar { grid-column: 1/-1; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 16px; display: flex; align-items: center; gap: 10px; height: var(--topbar) }
.logo { font-size: 15px; font-weight: 500; letter-spacing: -.3px; color: var(--text) }
.logo span { color: var(--accent) }
.topbar-stats { display: flex; gap: 14px; margin-left: 8px }
.stat { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); font-family: var(--mono) }
.stat-dot { width: 6px; height: 6px; border-radius: 50% }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center }
.tbtn { display: flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: var(--r); border: 1px solid var(--border2); background: var(--surface); color: var(--text2); font-family: var(--font); font-size: 12px; cursor: pointer; white-space: nowrap }
.sidebar-icon { transition: transform .25s ease; flex-shrink: 0 }
.tbtn:hover { background: var(--surface2); color: var(--text) }
.tbtn.pri { background: var(--accent); color: #fff; border-color: var(--accent) }
.tbtn.pri:hover { background: var(--accent2) }
.tbtn.danger { background: var(--red-bg); color: var(--red); border-color: #fcc }
.tbtn.danger:hover { background: #ffe0e0 }

/* ── Sync badge ── */
.sync-badge { display: flex; align-items: center; gap: 5px; font-size: 11px; font-family: var(--mono); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface2); color: var(--text3); white-space: nowrap }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); flex-shrink: 0; transition: background .3s }
.sync-badge.ok .sync-dot { background: #4caf50 }
.sync-badge.saving .sync-dot { background: var(--amber); animation: pulse .7s infinite }
.sync-badge.error .sync-dot { background: var(--red) }
.sync-badge.offline .sync-dot { background: var(--text3) }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .4 } }

/* ── Auth screen ── */
#auth-screen { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; z-index: 500 }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3); padding: 36px 40px; max-width: 420px; width: 90%; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.08) }
.auth-logo { font-size: 28px; font-weight: 500; letter-spacing: -.5px; margin-bottom: 6px }
.auth-logo span { color: var(--accent) }
.auth-sub { font-size: 13px; color: var(--text2); margin-bottom: 24px; line-height: 1.6 }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 22px; border-radius: var(--r2); border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer; width: 100%; transition: background .15s, box-shadow .15s }
.google-btn:hover { background: var(--surface2); box-shadow: 0 2px 8px rgba(0,0,0,.08) }
.auth-note { font-size: 11px; color: var(--text3); line-height: 1.5; max-width: 320px; text-align: center }

/* ── Setup screen ── */
#setup-screen { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 490 }
.setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3); padding: 32px 36px; max-width: 460px; width: 92%; box-shadow: 0 8px 32px rgba(0,0,0,.08) }
.setup-card h2 { font-size: 17px; font-weight: 500; margin-bottom: 6px }
.setup-card p { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 18px }
.setup-or { text-align: center; font-size: 12px; color: var(--text3); margin: 14px 0; position: relative }
.setup-or::before, .setup-or::after { content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border) }
.setup-or::before { left: 0 } .setup-or::after { right: 0 }
.setup-inp { width: 100%; font-family: var(--mono); font-size: 12px; padding: 9px 12px; border: 1px solid var(--border2); border-radius: var(--r); background: var(--surface2); color: var(--text); outline: none; margin-bottom: 10px }
.setup-inp:focus { border-color: var(--accent); background: var(--surface) }
.setup-inp::placeholder { color: var(--text3) }
.user-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--accent-bg); border: 1px solid #b8d4be; border-radius: var(--r2); margin-bottom: 16px; font-size: 13px }
.user-pill img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover }
.user-pill .up-name { font-weight: 500; flex: 1 }
.user-pill .up-email { font-size: 11px; color: var(--text2); font-family: var(--mono) }

/* ── Sidebar ── */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden }
.sb-top { flex-shrink: 0; border-bottom: 1px solid var(--border); padding: 12px }
.sb-label { font-size: 10px; font-weight: 500; letter-spacing: 1.1px; text-transform: uppercase; color: var(--text3); margin-bottom: 8px }
.quick-add { display: flex; gap: 6px; margin-bottom: 10px }
.quick-add input { flex: 1; font-family: var(--font); font-size: 13px; padding: 7px 10px; border: 1px solid var(--border2); border-radius: var(--r); background: var(--surface2); color: var(--text); outline: none }
.quick-add input:focus { border-color: var(--accent); background: var(--surface) }
.quick-add input::placeholder { color: var(--text3) }
.btn-plus { width: 33px; height: 33px; border-radius: var(--r); border: none; background: var(--accent); color: #fff; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0 }
.btn-plus:hover { background: var(--accent2) }
.sb-controls { display: flex; gap: 6px; align-items: center }
.filter-inp { flex: 1; font-family: var(--font); font-size: 12px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface2); color: var(--text); outline: none }
.filter-inp:focus { border-color: var(--accent); background: var(--surface) }
.sort-sel { font-family: var(--font); font-size: 11px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface2); color: var(--text2); outline: none; cursor: pointer }
.sort-sel:focus { border-color: var(--accent) }
.items-pool { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 3px }
.pool-section-header { font-size: 10px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 8px 4px 4px; margin-top: 4px }
.pool-section-header:first-child { margin-top: 0 }

/* ── Item chips (sidebar) ── */
.item-chip { padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface2); font-size: 13px; display: flex; align-items: center; gap: 7px; user-select: none; -webkit-user-select: none; cursor: grab; transition: border-color .12s, background .12s }
.item-chip * { user-select: none; -webkit-user-select: none }
.item-chip:hover { border-color: var(--border2); background: var(--surface) }
.item-chip.dragging { opacity: .3 }
.item-chip.placed { background: var(--accent-bg); border-color: #b8d4be }
.item-chip.placed .i-dot { background: var(--accent) }
.item-chip.selected { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 2px var(--accent-bg) }
.item-chip.selected .i-dot { background: var(--accent) }
.item-chip.selected .i-name { font-weight: 500 }
.multi-drag-badge { position: fixed; pointer-events: none; z-index: 9999; background: var(--accent); color: #fff; border-radius: 20px; padding: 5px 12px; font-size: 12px; font-family: var(--font); font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,.2); display: none; white-space: nowrap }
.sel-clear-btn { display: none; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; background: var(--accent-bg); border: 1px solid #b8d4be; color: var(--accent); font-size: 11px; font-family: var(--mono); cursor: pointer; white-space: nowrap }
.sel-clear-btn.visible { display: flex }
.i-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); flex-shrink: 0 }
.i-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.i-loc { font-size: 10px; color: var(--text3); font-family: var(--mono); white-space: nowrap; flex-shrink: 0; max-width: 90px; overflow: hidden; text-overflow: ellipsis }
.i-actions { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; flex-shrink: 0 }
.item-chip:hover .i-actions { opacity: 1 }
.cbtn { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 13px; padding: 2px 4px; border-radius: 4px; line-height: 1 }
.cbtn:hover { background: var(--border); color: var(--text) }

/* ── Canvas ── */
.canvas { overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 0; background: var(--bg) }
.canvas-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-shrink: 0 }
.canvas-toolbar h2 { font-size: 12px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: .8px }
.sep { flex: 1 }
.rooms-area { display: flex; flex-direction: column; gap: 16px }

/* ── Room block ── */
.room-block { border: 2px solid var(--border2); border-radius: var(--r3); background: var(--surface); transition: border-color .15s, box-shadow .15s; position: relative }
.room-block.drag-over-room { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg) }
.room-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; cursor: default; user-select: none }
.room-block.collapsed .room-header { padding-bottom: 12px }
.room-drag-handle { color: var(--text3); font-size: 14px; cursor: grab; padding: 2px 4px; border-radius: 4px; flex-shrink: 0 }
.room-drag-handle:hover { background: var(--surface2) }
.room-emoji { font-size: 20px; line-height: 1; flex-shrink: 0 }
.room-name-text { font-size: 15px; font-weight: 500; flex: 1; min-width: 0 }
.room-count { font-size: 11px; color: var(--text3); font-family: var(--mono); flex-shrink: 0 }
.room-actions { display: flex; gap: 3px; flex-shrink: 0 }
.room-btn { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 13px; padding: 3px 5px; border-radius: 5px }
.room-btn:hover { background: var(--surface2); color: var(--text) }
.room-body { }
.room-block.collapsed .room-body { display: none }
.room-collapse-btn { transition: transform .2s ease }
.room-block.collapsed .room-collapse-btn { transform: rotate(-90deg) }
.room-groups { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 14px 14px; min-height: 80px; align-content: flex-start }

/* ── Group card ── */
.group-card { width: 180px; border: 1.5px solid var(--border); border-radius: var(--r2); background: var(--surface2); display: flex; flex-direction: column; transition: border-color .12s, box-shadow .12s; flex-shrink: 0; cursor: grab; user-select: none; -webkit-user-select: none }
.group-card:hover { border-color: var(--border2); box-shadow: 0 2px 8px rgba(0,0,0,.06) }
.group-card.dragging-group { opacity: .35; cursor: grabbing }
.group-card.item-drag-over { border-color: var(--accent); background: var(--accent-bg) }
.group-card.full { border-color: #f0b070 }
.group-card * { user-select: none; -webkit-user-select: none }
.gc-btn, .p-del { pointer-events: auto; cursor: pointer }
.gc-header { padding: 9px 10px 7px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 6px }
.gc-name { font-size: 12px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.gc-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s }
.group-card:hover .gc-actions { opacity: 1 }
.gc-btn { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 12px; padding: 1px 3px; border-radius: 3px; line-height: 1 }
.gc-btn:hover { background: var(--border); color: var(--text) }
.gc-type-badge { font-size: 9px; font-family: var(--mono); padding: 1px 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text3); white-space: nowrap; flex-shrink: 0; align-self: center }
.gc-type-badge.tobuy { background: var(--amber-bg); border-color: #f5d5a8; color: var(--amber) }
.gc-cap { padding: 5px 10px; border-bottom: 1px solid var(--border) }
.cap-bg { height: 2px; background: var(--border); border-radius: 1px; overflow: hidden }
.cap-fill { height: 100%; border-radius: 1px; background: var(--accent); transition: width .3s }
.cap-fill.warn { background: var(--amber) }
.cap-fill.over { background: var(--red) }
.cap-lbl { font-size: 9px; color: var(--text3); font-family: var(--mono); margin-top: 3px }
.gc-items { padding: 6px; min-height: 44px; display: flex; flex-direction: column; gap: 3px; flex: 1 }
.gc-empty { font-size: 11px; color: var(--text3); text-align: center; padding: 8px 0; font-style: italic }
.placed-chip { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 6px; background: var(--surface); font-size: 11px; user-select: none; -webkit-user-select: none; border: 1px solid transparent; cursor: grab }
.placed-chip * { user-select: none; -webkit-user-select: none }
.placed-chip:hover { border-color: var(--border) }
.placed-chip.dragging { opacity: .3 }
.p-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0 }
.p-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.p-del { opacity: 0; font-size: 12px; color: var(--text3); cursor: pointer; padding: 0 2px; line-height: 1 }
.placed-chip:hover .p-del { opacity: 1 }
.gc-drop-hint { border: 1px dashed var(--border2); border-radius: 6px; padding: 5px; text-align: center; font-size: 10px; color: var(--text3); margin-top: auto }
.group-card.item-drag-over .gc-drop-hint { border-color: var(--accent); color: var(--accent) }
.gc-note { padding: 5px 10px; font-size: 10px; color: var(--amber); background: var(--amber-bg); border-top: 1px solid #f5d5a8; border-radius: 0 0 calc(var(--r2) - 1.5px) calc(var(--r2) - 1.5px) }
.room-drop-ghost { width: 160px; height: 60px; border: 2px dashed var(--border2); border-radius: var(--r2); display: none; align-items: center; justify-content: center; font-size: 11px; color: var(--text3); flex-shrink: 0 }
.room-block.drag-over-room .room-drop-ghost { display: flex; border-color: var(--accent); color: var(--accent) }

/* ── Unroomed area ── */
.unroomed-area { border: 2px dashed var(--border2); border-radius: var(--r3); padding: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; min-height: 80px; transition: border-color .15s }
.unroomed-area.drag-over-room { border-color: var(--accent) }
.unroomed-label { width: 100%; font-size: 10px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); margin-bottom: 6px }
.add-group-row { display: flex; gap: 6px; align-items: center; width: 100%; padding: 0 4px 4px }
.add-group-row input, .add-group-row select { font-family: var(--font); font-size: 12px; padding: 6px 9px; border: 1px solid var(--border2); border-radius: var(--r); background: var(--surface); color: var(--text); outline: none }
.add-group-row input:focus, .add-group-row select:focus { border-color: var(--accent) }
.add-group-row input { flex: 1; min-width: 80px }
.btn-sm { padding: 6px 11px; border-radius: var(--r); border: 1px solid var(--accent); background: var(--surface); color: var(--accent); font-family: var(--font); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; flex-shrink: 0 }
.btn-sm:hover { background: var(--accent-bg) }

/* ── Modals ── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 100; align-items: center; justify-content: center }
.overlay.open { display: flex }
.modal { background: var(--surface); border-radius: var(--r2); padding: 22px; width: 360px; max-width: 96vw; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); box-shadow: 0 8px 32px rgba(0,0,0,.13) }
.modal h3 { font-size: 15px; font-weight: 500; margin-bottom: 14px }
.modal label { font-size: 12px; color: var(--text2); display: block; margin-bottom: 4px; margin-top: 11px }
.modal input, .modal select, .modal textarea { width: 100%; font-family: var(--font); font-size: 13px; padding: 8px 10px; border: 1px solid var(--border2); border-radius: var(--r); background: var(--surface2); color: var(--text); outline: none; resize: vertical }
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--accent); background: var(--surface) }
.modal-row { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; align-items: center }
.mbtn { padding: 8px 15px; border-radius: var(--r); font-family: var(--font); font-size: 13px; cursor: pointer }
.mbtn.cancel { border: 1px solid var(--border2); background: var(--surface); color: var(--text2) }
.mbtn.cancel:hover { background: var(--surface2) }
.mbtn.save { border: none; background: var(--accent); color: #fff; font-weight: 500 }
.mbtn.save:hover { background: var(--accent2) }
.mbtn.danger { border: 1px solid #fcc; background: var(--red-bg); color: var(--red); margin-right: auto }
.mbtn.danger:hover { background: #ffe0e0 }
.type-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px }
.type-pill { font-size: 11px; font-family: var(--mono); padding: 3px 9px; border-radius: 20px; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); cursor: pointer }
.type-pill:hover { background: var(--border) }
.type-pill.on { background: var(--accent-bg); color: var(--accent); border-color: #b8d4be }
.color-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap }
.color-swatch { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .1s }
.color-swatch.on { border-color: var(--text); transform: scale(1.15) }
.share-wrap { position: relative; margin-top: 4px }
.share-wrap textarea { font-family: var(--mono); font-size: 11px; height: 110px; resize: none }
.copy-btn { position: absolute; top: 7px; right: 7px; padding: 4px 10px; border-radius: var(--r); border: 1px solid var(--border2); background: var(--surface); color: var(--text2); font-family: var(--font); font-size: 11px; cursor: pointer }
.copy-btn:hover { background: var(--surface2) }

/* ── File ID banner ── */
.file-id-banner { background: var(--blue-bg); border: 1px solid #c0d8f0; border-radius: var(--r); padding: 8px 12px; font-size: 11px; font-family: var(--mono); color: var(--blue); display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.file-id-banner .fib-label { font-weight: 500; flex-shrink: 0 }
.file-id-banner .fib-id { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.file-id-banner button { flex-shrink: 0; background: none; border: 1px solid #aac8e8; border-radius: 5px; color: var(--blue); font-size: 10px; font-family: var(--mono); padding: 2px 7px; cursor: pointer }
.file-id-banner button:hover { background: #d8ebfa }

/* ── File picker list ── */
.file-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r2); background: var(--surface2); cursor: pointer; transition: border-color .12s, background .12s }
.file-list-item:hover { border-color: var(--accent); background: var(--accent-bg) }
.file-list-item.active { border-color: var(--accent); background: var(--accent-bg) }
.fli-icon { font-size: 20px; flex-shrink: 0 }
.fli-info { flex: 1; min-width: 0 }
.fli-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.fli-meta { font-size: 10px; color: var(--text3); font-family: var(--mono); margin-top: 2px }
.fli-badge { font-size: 10px; font-family: var(--mono); padding: 2px 7px; border-radius: 10px; background: var(--accent-bg); color: var(--accent); border: 1px solid #b8d4be; flex-shrink: 0 }

/* ── Toast ── */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(50px); background: var(--text); color: #fff; padding: 7px 16px; border-radius: 20px; font-size: 13px; z-index: 300; transition: transform .2s, opacity .2s; pointer-events: none; opacity: 0 }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1 }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 4px; height: 4px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px }

/* ── Bottom nav (mobile only) ── */
#bottom-nav { display: none }

/* ════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  :root { --topbar: 56px; --sidebar: 100% }
  .app { grid-template-columns: 1fr; grid-template-rows: var(--topbar) 1fr var(--topbar) }
  .topbar { padding: 0 10px; gap: 4px }
  .logo { font-size: 13px; min-width: 60px }
  .topbar-stats { display: none }
  .topbar-actions { gap: 3px; flex-wrap: nowrap; overflow-x: auto }
  .tbtn { padding: 6px 9px; font-size: 11px; border-radius: 6px; flex-shrink: 0 }
  .sync-badge { padding: 4px 8px; font-size: 10px; border-radius: 12px }
  .sidebar { position: fixed; top: var(--topbar); left: 0; right: 0; bottom: var(--topbar); background: var(--surface); border-right: none; border-bottom: 1px solid var(--border); z-index: 50; transform: translateX(-100%); transition: transform 0.3s ease }
  .sidebar.visible { transform: translateX(0) }
  .sb-top { padding: 10px }
  .sb-label { font-size: 10px; margin-bottom: 6px }
  .quick-add input, .filter-inp, .sort-sel { font-size: 13px; padding: 8px 10px }
  .btn-plus { width: 38px; height: 38px; font-size: 18px }
  .items-pool { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; align-content: flex-start }
  .item-chip { font-size: 13px; padding: 8px 10px; min-height: 36px }
  .canvas { position: static; grid-column: 1; grid-row: 2 }
  .canvas-toolbar { padding: 10px }
  .canvas-toolbar h2 { font-size: 16px }
  .rooms-area { padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start }
  .room-block { width: 100% }
  .room-header { font-size: 13px; padding: 8px }
  .room-groups { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; align-content: flex-start }
  .group-card { width: calc(50% - 4px); min-width: 120px; flex-shrink: 1 }
  .gc-header { padding: 8px }
  .gc-name { font-size: 13px }
  .gc-items { min-height: 50px; padding: 5px }
  .placed-chip { padding: 5px; font-size: 12px; min-height: 28px }
  .unroomed-area { padding: 10px; min-height: 100px }
  .add-group-row input, .add-group-row select { font-size: 13px; padding: 8px 10px; min-height: 36px }
  .modal { width: 95vw; max-width: 95vw; max-height: 92vh; border-radius: 16px; padding: 18px }
  .modal h3 { font-size: 16px; margin-bottom: 12px }
  .modal label { font-size: 13px; margin-top: 10px }
  .modal input, .modal select, .modal textarea { font-size: 14px; padding: 10px 12px; min-height: 40px; border-radius: 8px }
  .mbtn { padding: 10px 16px; font-size: 14px; min-height: 40px; border-radius: 8px }
  .modal-row { margin-top: 14px; gap: 10px }
  .type-pills { gap: 6px; margin-top: 8px }
  .type-pill { font-size: 12px; padding: 6px 12px; min-height: 32px; border-radius: 8px }
  .color-swatch { width: 32px; height: 32px }
  #bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; height: var(--topbar); background: var(--surface); border-top: 1px solid var(--border); gap: 0; padding: 0; z-index: 40 }
  .nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: none; background: none; color: var(--text3); font-size: 10px; cursor: pointer; padding: 6px; border-radius: 0; transition: color 0.15s, background 0.15s }
  .nav-btn:hover, .nav-btn.active { color: var(--accent); background: var(--accent-bg) }
  .nav-btn svg { width: 18px; height: 18px }
  #btn-add-room { display: none }
  #btn-toggle-sidebar { display: none }
  .canvas-toolbar .sep { display: none }
  .canvas-toolbar h2 { flex: 1 }
  input, button, select, textarea { min-height: 44px }
  .btn-plus, .nav-btn, .tbtn, .mbtn { min-height: 44px }
  .item-chip, .placed-chip { min-height: 36px; padding: 6px 10px }
  .file-list-item { padding: 12px; font-size: 13px; gap: 12px }
  .fli-name { font-size: 14px }
  .fli-meta { font-size: 11px }
  .auth-card { padding: 24px 16px; width: 90vw; max-width: 90vw }
  .auth-logo { font-size: 24px }
  .google-btn { padding: 12px 20px; font-size: 14px; min-height: 44px }
  .setup-card { padding: 20px 16px; width: 90vw; max-width: 90vw }
  .setup-inp { font-size: 13px; padding: 10px 12px; min-height: 40px }
  .user-pill { padding: 10px 12px; font-size: 13px; margin-bottom: 12px }
  .user-pill img { width: 32px; height: 32px }
  .file-id-banner { padding: 10px; font-size: 11px; flex-wrap: wrap; gap: 8px }
  .file-id-banner button { padding: 4px 10px; font-size: 11px }
}

@media (max-width: 480px) {
  :root { --topbar: 52px }
  .app { grid-template-rows: var(--topbar) 1fr var(--topbar) }
  .logo { font-size: 12px; min-width: 50px }
  .tbtn { padding: 5px 8px; font-size: 10px }
  .sync-badge { display: none }
  .rooms-area { padding: 6px; gap: 6px }
  .group-card { width: 100% }
  .gc-header { padding: 6px 8px }
  .gc-name { font-size: 12px }
  .modal { border-radius: 12px; padding: 16px }
  .canvas-toolbar { padding: 8px }
  .canvas-toolbar h2 { font-size: 14px }
  .add-group-row { flex-wrap: wrap }
  .add-group-row input { min-width: 100% }
  .btn-sm { padding: 8px 12px; font-size: 12px }
}
