/* ============================================================
   NOVU STUDIO — Design System (black/white, same DNA as P1/P2)
   Dark default, light override. ES5, no build step.
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --bg2: #101010;
  --panel: #141414;
  --panel2: #181818;
  --fg: #f4f4f1;
  --dim: #8a8a85;
  --line: #262625;
  --line2: #333331;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 12px;
  --font: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --mono: 'Inter', ui-monospace, monospace;
}
body.light {
  --bg: #f4f4f1;
  --bg2: #ececea;
  --panel: #ffffff;
  --panel2: #f7f7f4;
  --fg: #0a0a0a;
  --dim: #6b6b66;
  --line: #d9d9d4;
  --line2: #c9c9c4;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit;
  color: var(--fg);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease;
  color-scheme: light;
}
body.light input, body.light select, body.light textarea { color-scheme: dark; }
input:focus, select:focus, textarea:focus { border-color: var(--fg); }

::placeholder { color: var(--dim); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

.dim { color: var(--dim); }
.bell-count--hidden { display: none; }

/* ---------------- Shell layout ---------------- */

#shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 262px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.brand-logo { height: 30px; width: auto; }
.brand-id { font-size: 15px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.2; }
.brand-id .ver {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 2px;
  color: var(--dim);
}

.nav { flex: 1; overflow-y: auto; padding: 10px 14px 20px; }
.nav-group { margin-top: 16px; }
.nav-group:first-child { margin-top: 2px; }
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 10px 7px;
}
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-item a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--dim);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-item a:hover { color: var(--fg); background: var(--panel); }
.nav-item a.active { color: var(--fg); background: var(--panel); border: 1px solid var(--line); padding: 7px 11px; }

.nav-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }

.topbar {
  position: fixed;
  top: 0;
  left: 262px;
  right: 0;
  height: 62px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  z-index: 40;
}
.top-left { display: flex; align-items: center; gap: 14px; flex: 1; }
.top-right { display: flex; align-items: center; gap: 10px; position: relative; }

.burger { display: none; background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: 6px 10px; font-size: 14px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 6px 0 12px;
  max-width: 420px;
  width: 100%;
}
.search-box input { border: 0; background: transparent; padding: 9px 6px; }
.search-box .dim { font-size: 11px; }

.icon-btn {
  position: relative;
  background: none;
  border: 1px solid var(--line);
  color: var(--fg);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.icon-btn:hover { background: var(--panel); }
.bell-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--fg);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.dropdown { display: none; position: absolute; }
.dropdown.open { display: block; }
.bell-panel {
  right: 154px;
  top: 56px;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
}
.quick-panel { right: 74px; top: 56px; width: 210px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.bell-panel > b, .quick-panel > b {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.bell-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
}
.bell-item:hover { background: var(--panel2); }
.bell-item.unread { border-left: 2px solid var(--fg); }
.qr { display: block; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.qr:hover { background: var(--panel2); }

.view {
  margin: 62px 0 0 262px;
  padding: 30px 34px 140px;
  min-height: calc(100vh - 62px);
  max-width: 1320px;
}

.nav-scrim { display: none; }

/* ---------------- Typography / headings ---------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.ph-txt h1 {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}
.ph-txt p { color: var(--dim); margin-top: 6px; font-size: 14px; }
.ph-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.btn:hover { opacity: 0.85; }
.btn.ghost { background: none; color: var(--fg); border-color: var(--line2); font-weight: 500; }
.btn.ghost:hover { border-color: var(--fg); opacity: 1; }
.btn[disabled] { opacity: 0.35; pointer-events: none; cursor: default; }
.link-btn { background: none; border: 0; color: var(--dim); font-size: 12px; text-decoration: underline; padding: 2px 0; }
.link-btn:hover { color: var(--fg); }

/* ---------------- Stats / cards ---------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
a.stat:hover { border-color: var(--fg); transform: translateY(-2px); }
.stat b { font-size: 26px; letter-spacing: -0.02em; }
.stat span { color: var(--dim); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 22px; }
.grid2.m { grid-template-columns: 1fr 1fr; margin-bottom: 0; gap: 12px; }
.grid2 .panel h3 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }

.panel h3 { font-size: 14px; margin-bottom: 14px; }
.panel h4 { font-size: 12.5px; color: var(--dim); margin: 14px 0 8px; font-weight: 600; }

/* ---------------- Rows & lists ---------------- */

.trow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.trow:last-child { border-bottom: 0; }
.trow b { font-weight: 600; }
.taskrow { flex-wrap: wrap; }

.rows { display: flex; flex-direction: column; gap: 2px; }
.crow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.crow:hover { background: var(--panel); border-color: var(--line); }
.crow-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cg { color: var(--dim); font-size: 12.5px; width: 120px; }
.chev { color: var(--dim); }

.row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.row-link:last-child { border-bottom: 0; }
.row-link .dim { flex: 1; min-width: 120px; }
.row-link:hover .chev { color: var(--fg); transform: translateX(2px); }
.chev { transition: transform 0.15s ease; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ---------------- Key/value ---------------- */

.kv { display: grid; gap: 10px 22px; }
.kv3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kv div { display: flex; flex-direction: column; gap: 3px; }
.kv span { color: var(--dim); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.kv b { font-size: 14px; font-weight: 600; }
.blurb { margin-top: 14px; color: var(--dim); font-size: 13.5px; line-height: 1.6; }

/* ---------------- Tabs / filters / chips ---------------- */

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--dim);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); border-bottom-color: var(--fg); }

.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 180px; }
.chip {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--fg); border-color: var(--line2); }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.badge, .badge-demo, .badge-pub {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 9px;
}
.badge { background: var(--panel2); border: 1px solid var(--line2); color: var(--dim); }
.badge-pub { background: var(--fg); color: var(--bg); }
.badge-demo { border: 1px dashed var(--line2); color: var(--dim); }
.due-bad { color: #e0644f; }
body.light .due-bad { color: #c0392b; }

.inline-actions { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.inline-actions .dim { font-size: 12px; }
.st-sel { width: auto; padding: 6px 10px; font-size: 12px; }
select.st-sel { min-width: 150px; }

/* ---------------- Project cards ---------------- */

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pgrid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13.5px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
a.pcard:hover { border-color: var(--fg); transform: translateY(-2px); }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard b { font-size: 15px; }
.meta { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.progress {
  height: 5px;
  background: var(--bg2);
  border-radius: 999px;
  overflow: hidden;
}
.progress i { display: block; height: 100%; background: var(--fg); border-radius: 999px; }

/* ---------------- Kanban ---------------- */

.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: start; }
.kcol { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.kcol h4 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; display: flex; justify-content: space-between; }
.kcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kcard:hover { border-color: var(--fg); }
.kcard .inline-actions { margin: 4px 0 0; }

/* ---------------- Calendar ---------------- */

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-h, .cal-cell { background: var(--panel2); padding: 8px; min-height: 52px; font-size: 11px; }
.cal-h { text-align: center; color: var(--dim); letter-spacing: 0.08em; }
.cal-blank { background: var(--panel2); padding: 8px; min-height: 52px; }
.cal-cell.today { outline: 1px solid var(--fg); outline-offset: -1px; }
.cal-day { display: block; font-weight: 600; font-size: 13px; }
.cal-dot { display: block; margin-top: 4px; color: var(--dim); font-size: 10px; }

/* ---------------- Files ---------------- */

.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.fcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12.5px;
}
.fcard-top { aspect-ratio: 4/3; overflow: hidden; border-radius: 8px; background: var(--bg2); }
.fthumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.fthumb-mono {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: var(--dim);
}

/* ---------------- Phase timeline ---------------- */

.phases { display: flex; gap: 4px; margin: 6px 0 10px; flex-wrap: wrap; }
.phase {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
}
.phase.done { background: var(--panel2); }
.phase.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.phase-name { font-weight: 600; font-size: 14px; }

/* ---------------- Empty / demo ---------------- */

.empty { text-align: center; padding: 56px 20px; }
.empty-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border: 1px solid var(--line2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 12px;
}
.empty h3 { font-size: 17px; font-weight: 600; }
.empty p { color: var(--dim); margin-top: 6px; font-size: 13.5px; }

.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 11px 16px;
  border: 1px dashed var(--line2);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--dim);
  flex-wrap: wrap;
}
.demo-banner .link-btn { white-space: nowrap; }

/* ---------------- Modal ---------------- */

.modal-layer {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 4, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  z-index: 100;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-wide { max-width: 640px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}
.modal-head h2 { font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.modal-x { background: none; border: 1px solid transparent; color: var(--dim); width: 32px; height: 32px; border-radius: 8px; font-size: 18px; }
.modal-x:hover { color: var(--fg); border-color: var(--line2); }
.modal-body { padding: 0 20px 20px; }
.app-form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--fg);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-err { background: #e0644f; color: #fff; }

/* ---------------- Command palette ---------------- */

.palette {
  position: fixed;
  top: 14vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 92vw);
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 150;
  overflow: hidden;
}
.pal-input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 15px; background: transparent; }
.pal-list { max-height: 340px; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.pal-item { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; }
.pal-item:hover { background: var(--panel); }

/* ---------------- Self-test page ---------------- */

.selftest { padding: 40px 24px; max-width: 760px; margin: 0 auto; font-family: var(--mono); font-size: 13px; }
.st-pass { color: var(--fg); padding: 5px 0; border-bottom: 1px solid var(--line); }
.st-fail { color: #e0644f; padding: 5px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.st-total { margin-top: 18px; font-size: 16px; font-weight: 700; }

/* ============================================================
   MOODBOARD CANVAS
   ============================================================ */

.mb-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.mb-chrome b { font-size: 17px; }
.mb-manual { font-size: 11.5px; }

.mb-canvas {
  position: relative;
  height: calc(100vh - 210px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.mb-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

.mb-obj {
  position: absolute;
  border: 1px dashed transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: move;
  background: var(--panel);
}
.mb-obj.selected { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.mb-obj.locked { cursor: default; opacity: 0.85; }
.mb-resize {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  border: 1px solid var(--fg);
  background: var(--bg);
  border-radius: 3px;
  display: none;
  cursor: nwse-resize;
  z-index: 5;
}
.mb-obj.selected .mb-resize { display: block; }

.mb-text { min-height: 24px; white-space: pre-wrap; word-break: break-word; padding: 6px 10px; }
.mb-note-title { font-weight: 700; font-size: 13px; padding: 10px 12px 4px; }
.mb-note-body { font-size: 12.5px; color: var(--dim); padding: 4px 12px 10px; white-space: pre-wrap; }

.mb-link-host { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 10px 12px 2px; }
.mb-link-url { font-size: 11px; color: var(--dim); padding: 0 12px; word-break: break-all; }
.mb-link-open { display: block; font-size: 12.5px; font-weight: 600; padding: 8px 12px 10px; text-decoration: underline; }

.mb-swatch { height: 46px; margin: 8px 8px 0; border-radius: 8px; border: 1px solid var(--line2); }
.mb-swatch-hex { font-family: var(--mono); font-size: 11.5px; text-align: center; padding: 8px; }

.mb-file-name { font-weight: 600; font-size: 12.5px; padding: 10px 12px 2px; }
.mb-file-sub { font-size: 11px; color: var(--dim); padding: 2px 12px 10px; }
.mb-media { width: 100%; height: 100%; object-fit: cover; display: block; }

.mb-section-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--dim);
}
.mb-obj.mb-section { background: transparent; border: 1px dashed var(--line2); border-radius: 0; }
.mb-obj.mb-section.selected { border-color: var(--fg); }

.mb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.mb-tbtn {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
}
.mb-tbtn:hover { border-color: var(--fg); }
.mb-tbtn[disabled] { opacity: 0.35; pointer-events: none; }
.mb-add, .mb-keys, .mb-safe { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mb-safe { flex-direction: row-reverse; }
.mb-sep { color: var(--dim); font-size: 11px; }
.mb-sel { color: var(--dim); font-size: 11.5px; }
.mb-snapshots { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 6px; }
.mb-snap { background: none; border: 1px dashed var(--line2); color: var(--dim); border-radius: 8px; padding: 4px 10px; font-size: 11px; }
.mb-snap:hover { color: var(--fg); border-color: var(--fg); }
.mb-snap.current { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.mb-snap-empty { color: var(--dim); font-size: 11.5px; }

/* ---------------- Project visuals (cover + gallery) ---------------- */

.pcover {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.pcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcover.hero { aspect-ratio: 21 / 9; margin-bottom: 4px; }
.cover-ph { display: flex; align-items: center; justify-content: center; }
.cover-ph span { font-size: 26px; letter-spacing: 0.3em; color: var(--dim); }
.pcard .pcover { margin-bottom: 2px; }
.visual-box { display: flex; flex-direction: column; }

.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.gtile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel2);
}
.gtile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gtile-name {
  position: absolute;
  left: 6px; right: 6px; bottom: 6px;
  font-size: 10.5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.gtile-acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.gtile-acts button {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 0;
  border-radius: 5px;
  font-size: 10.5px;
  padding: 3px 7px;
}
.gtile-acts button:hover { background: rgba(0, 0, 0, 0.8); }
.gtile-acts button.is-cover { background: var(--fg); color: var(--bg); }
.gtile.gadd {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  border-style: dashed;
  font-size: 12.5px;
}
.gtile.gadd:hover { color: var(--fg); border-color: var(--fg); }
.gtile-loading { opacity: 0.5; }

/* ---------------- Auth screen ---------------- */

body.auth-page { overflow: hidden; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card h1 { font-size: 22px; margin: 14px 0 4px; }
.auth-card .app-form { text-align: left; margin-top: 18px; }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-logo { height: 44px; margin: 0 auto; display: block; }
.auth-err { color: #e0644f; font-size: 12px; min-height: 16px; margin: 8px 0 0; text-align: center; }
.auth-hint { margin-top: 14px; font-size: 11.5px; }
.app-form .field.check { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12.5px; }
.app-form .field.check input { width: auto; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .topbar { left: 0; }
  .view { margin-left: 0; padding: 20px 18px 120px; }
  .burger { display: inline-flex; }
  .search-box { max-width: none; }
  .grid2.m { grid-template-columns: 1fr; }
  .sidebar.open ~ .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 45; cursor: pointer; }
  .mb-canvas { height: calc(100vh - 260px); }
  .link-btn,
  .trow a,
  .panel h3 a { display: inline-flex; align-items: center; min-height: 32px; }
  .link-btn { padding: 6px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}