/* Layout scaffolding for Code Keeper, on top of SnowDev tokens/components. No new colors invented. */
* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body { margin: 0; font-size: 14px; }
button { cursor: pointer; border: 0; background: none; padding: 0; font-family: inherit; color: inherit; font-size: inherit; }
input, textarea { background: none; border: 0; outline: 0; font-family: inherit; color: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

.app { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }

/* ---------- Top bar: floating project chips ---------- */
.topbar { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 22px 28px 6px; flex: none; }
.brand-mark { display: none; }
.brand-name { display: none; }
.chip-rail { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; flex: none; max-width: 100%; }

.proj-chip { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: 13px; font-weight: 500; flex: none; box-shadow: var(--shadow-card); transition: border-color .12s, color .12s, background .12s, transform .12s; }
.proj-chip:hover { color: var(--text); border-color: var(--chip-hue, var(--border-strong)); transform: translateY(-1px); }
.proj-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.proj-chip .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.proj-chip.active { color: var(--text); background: color-mix(in oklab, var(--chip-hue) 16%, var(--surface)); border-color: color-mix(in oklab, var(--chip-hue) 55%, var(--border)); }
.proj-chip.active .count { color: var(--text); }
.proj-chip.new { color: var(--text-muted); border-style: dashed; }
.proj-chip.new:hover { color: var(--text); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; flex: 1; }
.content { flex: 1; overflow-y: auto; scrollbar-gutter: stable; padding: 52px 56px 150px; }
.content-inner { max-width: 720px; margin: 0 auto; }

/* App header, styled as a media-card: color gradient down to black/white per theme */
.app-head { display: flex; align-items: flex-start; gap: 16px; padding: 26px 28px; margin-bottom: 32px; border-radius: var(--r-soft); position: relative; overflow: hidden;
  background:
    radial-gradient(170% 150% at -20% -20% in oklab, var(--app-hue, var(--accent)) 0%, color-mix(in oklab, var(--app-hue, var(--accent)) 45%, transparent) 40%, oklch(18% 0.015 320) 75%),
    linear-gradient(160deg in oklab, oklch(18% 0.015 320), oklch(8% 0.012 320));
  box-shadow: 0 14px 36px -22px color-mix(in oklch, var(--app-hue, var(--accent)) 80%, transparent); }
:root[data-snowdev-theme="dark"] .app-head {
  background:
    radial-gradient(170% 150% at -20% -20% in oklab, var(--app-hue, var(--accent)) 0%, color-mix(in oklab, var(--app-hue, var(--accent)) 45%, transparent) 40%, oklch(88% 0.01 320) 75%),
    linear-gradient(160deg in oklab, oklch(88% 0.01 320), oklch(96% 0.006 320));
}
.app-glyph { width: 46px; height: 46px; border-radius: var(--r-sharp); display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: 16px; color: oklch(16% 0.006 320); background: oklch(98% 0.005 320); flex: none; margin-top: 2px; position: relative; z-index: 1; }
.app-head-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.app-title { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.15; color: oklch(98% 0.005 320); outline: 0; border-radius: var(--r-sharp); padding: 2px 6px; margin: -2px -6px 0; }
.app-title:hover, .app-title:focus { background: oklch(100% 0 0 / .12); }
.app-title.empty::before { content: attr(data-placeholder); color: oklch(90% 0.01 320 / .7); }
.app-tag { color: oklch(92% 0.01 320 / .85); font-size: 14px; margin-top: 6px; outline: 0; border-radius: var(--r-sharp); padding: 2px 6px; margin-left: -6px; display: inline-block; max-width: 100%; }
.app-tag:hover, .app-tag:focus { background: oklch(100% 0 0 / .12); }
.app-tag.empty::before { content: attr(data-placeholder); color: oklch(90% 0.01 320 / .7); font-style: italic; }
.app-actions { display: flex; gap: 4px; margin-top: 2px; position: relative; z-index: 1; }
.app-actions .btn-icon { background: oklch(100% 0 0 / .14); color: oklch(98% 0.005 320); border-color: transparent; }
.app-actions .btn-icon:hover { background: oklch(100% 0 0 / .22); }

/* ---------- Section ---------- */
.section { margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--r-soft); background: var(--surface); box-shadow: var(--shadow-card); overflow: hidden; }
.section-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
.section.collapsed .section-head { border-bottom-color: transparent; }
.section-count { color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.section-chev { color: var(--text-muted); display: grid; place-items: center; transition: transform .15s; margin-left: auto; }
.section.collapsed .section-chev { transform: rotate(-90deg); }
.section-hint { color: var(--text-muted); font-size: 11.5px; font-family: var(--font-mono); opacity: 0; transition: opacity .15s; }
.section-head:hover .section-hint { opacity: 1; }

.items.list-rows { display: flex; flex-direction: column; max-width: none; padding: 4px 18px; border-radius: var(--r-sharp); transition: background .12s; }
.items.list-rows.drag-over { background: color-mix(in oklch, var(--accent) 8%, transparent); }
.section.collapsed .items { display: none; }

/* Item row — same visual rhythm as .list-row, extended to be editable/interactive (no DS component supports that) */
.item.list-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 6px; position: relative; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: none; }
.item.dragging { opacity: .5; }
.item.drop-over-top::before, .item.drop-over-bottom::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: 1px; }
.item.drop-over-top::before { top: -1px; }
.item.drop-over-bottom::after { bottom: -1px; }

.status-btn { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; color: transparent; background: transparent; margin-top: 2px; transition: border-color .12s, background .12s; }
.status-btn:hover { border-color: var(--text-muted); }
.status-btn[data-status="now"] { border-color: var(--c-progress); background: color-mix(in oklch, var(--c-progress) 18%, transparent); }
.status-btn[data-status="next"] { border-color: var(--c-todo); background: color-mix(in oklch, var(--c-todo) 18%, transparent); }
.status-btn[data-status="someday"] { border-color: var(--c-notstarted); background: color-mix(in oklch, var(--c-notstarted) 16%, transparent); }
.status-btn[data-status="done"] { background: var(--c-done); border-color: var(--c-done); color: var(--bg-elevated); }

.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-title.title { font-family: var(--font-body); outline: 0; border-radius: var(--r-sharp); padding: 1px 4px; margin: 0 -4px; }
.item-title:focus { background: var(--surface-2); }
.item.done .item-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border); }
.item-note.desc { outline: 0; border-radius: var(--r-sharp); padding: 1px 4px; margin: 0 -4px !important; white-space: pre-wrap; }
.item-note:focus { background: var(--surface-2); color: var(--text); }
.item-note.empty { display: none; }
.item:hover .item-note.empty, .item:focus-within .item-note.empty { display: block; }
.item-note.desc:empty:not(:focus)::before { content: "add a note"; color: var(--text-muted); font-style: italic; }

.item-actions { display: flex; gap: 2px; align-items: center; opacity: 0; transition: opacity .12s; padding-top: 1px; }
.item:hover .item-actions { opacity: 1; }
.tiny-btn { width: 26px; height: 26px; border-radius: var(--r-sharp); display: grid; place-items: center; color: var(--text-muted); }
.tiny-btn:hover { background: var(--surface-2); color: var(--text); }
.tiny-btn.danger:hover { color: var(--c-blocked); }

/* Add row */
.add-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; color: var(--text-muted); cursor: text; border-radius: var(--r-sharp); margin: 0 -6px; }
.add-row:hover { color: var(--text); }
.add-row .plus { width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed var(--border); display: grid; place-items: center; color: var(--text-muted); flex: none; }
.add-row input { flex: 1; color: var(--text); }
.add-row input::placeholder { color: var(--text-muted); }

/* Status menu */
.status-menu { position: absolute; z-index: 50; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-soft); padding: 6px; min-width: 170px; box-shadow: var(--shadow-card); }
.status-menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; width: 100%; text-align: left; border-radius: var(--r-sharp); font-size: 13px; color: var(--text-muted); }
.status-menu button:hover { background: var(--surface-2); color: var(--text); }
.status-menu button .pip { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Empty state ---------- */
.empty-view { text-align: center; padding: 90px 20px 40px; color: var(--text-muted); }
.empty-view .emp-glyph { font-family: var(--font-display); font-size: 40px; color: var(--text-muted); margin-bottom: 10px; }
.empty-view .emp-title { color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 20px; margin-bottom: 6px; }

/* ---------- Quick capture (same rhythm as .prompt-bar, controlled + app picker added) ---------- */
.qc-wrap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; }
.qc-bar.prompt-bar { position: absolute; bottom: 26px; width: min(600px, calc(100vw - 48px)); max-width: none; padding-left: 20px; }
.qc-bar input.qc-input { flex: 1; font-size: 14.5px; color: var(--text); }
.qc-bar input.qc-input::placeholder { color: var(--text-muted); }
.qc-bar .qc-kbd { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); padding: 3px 7px; border: 1px solid var(--border); border-radius: var(--r-sharp); }
.qc-target { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r-pill); background: var(--surface-2); font-size: 12px; color: var(--text-muted); border: 1px solid var(--border); flex: none; }
.qc-target:hover { color: var(--text); }
.qc-target .dot { width: 7px; height: 7px; border-radius: 50%; }
.qc-send { width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--accent-gradient); color: var(--on-gradient); display: grid; place-items: center; border: none; flex: none; transition: transform .12s, filter .12s, background .15s; }
.qc-send:hover { transform: scale(1.06); filter: brightness(1.05); }
.qc-send.tinted { background: linear-gradient(135deg in oklab, var(--tint), oklch(0% 0 0)); }
:root[data-snowdev-theme="dark"] .qc-send.tinted { background: linear-gradient(135deg in oklab, var(--tint), oklch(100% 0 0)); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: oklch(16% 0.006 320 / .45); backdrop-filter: blur(6px); z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal.meta-card { width: min(440px, 100%); padding: 0; overflow: hidden; }
.modal-head { padding: 20px 22px 6px; }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--text); }
.modal-body { padding: 8px 22px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
.field { margin-bottom: 14px; }
.field label { display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.field input.text, .field textarea { width: 100%; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sharp); font-size: 14px; color: var(--text); }
.field input.text:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
.color-swatches { display: flex; gap: 8px; padding-top: 2px; flex-wrap: wrap; }
.color-swatches button { width: 22px; height: 22px; border-radius: var(--r-sharp); border: 2px solid transparent; }
.color-swatches button.sel { border-color: var(--text); }

/* ---------- Tweaks panel ---------- */
.tweaks-panel { position: fixed; bottom: 92px; right: 26px; width: 270px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-soft); padding: 16px 16px 14px; box-shadow: var(--shadow-card); z-index: 150; font-size: 13px; }
.tweaks-panel h4 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.tweaks-panel h4 .x { margin-left: auto; color: var(--text-muted); width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--r-sharp); }
.tweaks-panel h4 .x:hover { background: var(--surface-2); color: var(--text); }
.tweak-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 12.5px; color: var(--text-muted); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 2px; gap: 2px; }
.seg button { padding: 4px 10px; border-radius: var(--r-pill); font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.seg button.active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-card); }

@media (max-width: 860px) {
  .topbar { padding: 14px 18px; gap: 12px; }
  .brand-name { display: none; }
  .content { padding: 30px 20px 150px; }
}
