/* Deltaflow Hangar — shares the website's visual language */
:root {
  --bg: #050505; --bg-2: #0B0B0D; --bg-3: #121215; --line: #232327; --line-2: #34343A;
  --ink: #E8E8E4; --ink-2: #B4B4AF; --ink-3: #8A8A86;
  --accent: #C4A57E; --danger: #E07A6A; --ok: #7FC79A;
  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --side: 232px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--display); font-size: 15px; line-height: 1.45; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .label { font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.label { font-size: 11px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px; gap: 4px; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; text-decoration: none; }
.brand img { height: 24px; width: auto; }
.brand b { font-weight: 800; font-stretch: 125%; text-transform: uppercase; letter-spacing: .02em; font-size: 14px; }
.brand span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--ink-3); }
.nav-group { margin-top: 14px; padding: 0 8px 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 6px; text-decoration: none; color: var(--ink-2); }
.nav a:hover { background: var(--bg-3); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--bg-3); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.nav .count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.side .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-3); border: 1px solid var(--line-2); font-size: 11px; font-weight: 700; flex: none; }
.main { min-width: 0; }
.page { padding: 34px clamp(18px, 4vw, 48px) 80px; max-width: 1500px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-head h1 { margin: 6px 0 0; font-size: clamp(26px, 3vw, 40px); line-height: 1.05; font-weight: 900; font-stretch: 125%; letter-spacing: -0.01em; }
.page-head p { margin: 8px 0 0; color: var(--ink-2); max-width: 680px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--ink); cursor: pointer; text-decoration: none; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid currentColor; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--bg-3); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- panels / cards ---------- */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.panel h2, .panel h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; font-stretch: 110%; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.list { display: grid; gap: 2px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 6px; }
.list-row:hover { background: var(--bg-3); }
.empty { padding: 26px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: 8px; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 260px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.col-head b { font-size: 13px; font-weight: 700; font-stretch: 110%; }
.col-body { padding: 10px; display: grid; gap: 8px; align-content: start; flex: 1; transition: background .15s; border-radius: 0 0 10px 10px; }
.col-body.drop { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.kcard { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; cursor: pointer; display: grid; gap: 8px; }
.kcard:hover { border-color: var(--line-2); }
.kcard.dragging { opacity: .4; }
.kcard .t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.kcard .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kcard .tags { display: flex; gap: 6px; min-width: 0; flex-wrap: wrap; }
.kcard .take { font-size: 12px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer; }
.kcard .take:hover { color: var(--accent); border-color: var(--accent); }
.add-card { margin: 0 10px 10px; padding: 8px; border: 1px dashed var(--line-2); border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; text-align: left; }
.add-card:hover { color: var(--ink); border-color: var(--ink-3); }
.board-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 3D view ---------- */
.model-wrap { position: relative; height: calc(100vh - 150px); height: calc(100dvh - 150px); min-height: 460px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background:
  radial-gradient(120% 90% at 50% 40%, #101014 0%, #050505 70%); }
.model-wrap canvas { display: block; }
.model-wrap.adding canvas { cursor: crosshair; }
.model-tools { position: absolute; left: 14px; top: 14px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 3; }
.model-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; padding: 8px 14px; border-radius: 99px; background: rgba(5,5,5,.8); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.legend { position: absolute; left: 14px; bottom: 14px; z-index: 3; display: flex; gap: 10px; flex-wrap: wrap; max-width: 60%; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.node-label { padding: 3px 8px; border-radius: 4px; background: rgba(5,5,5,.82); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); white-space: nowrap; cursor: pointer; pointer-events: auto; transform: translateY(-14px); }
.node-label:hover, .node-label.sel { border-color: var(--accent); color: var(--accent); }
.drawer { position: absolute; right: 14px; top: 14px; bottom: 14px; width: min(360px, calc(100% - 28px)); z-index: 4; background: rgba(11,11,13,.96); border: 1px solid var(--line-2); border-radius: 10px; padding: 18px; overflow: auto; }
.parts-list { position: absolute; right: 14px; top: 14px; z-index: 3; width: 260px; max-height: calc(100% - 28px); overflow: auto; background: rgba(11,11,13,.9); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.parts-list button { all: unset; display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.parts-list button:hover { background: var(--bg-3); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- part page ---------- */
.status-big { font-size: 18px; line-height: 1.45; margin: 10px 0 0; }
.history { display: grid; gap: 10px; }
.history .h { border-left: 2px solid var(--line-2); padding-left: 12px; }

/* ---------- files ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.ftable { width: 100%; border-collapse: collapse; }
.ftable th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ftable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ftable tr:hover td { background: var(--bg-2); }
.ftable .name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ftable .name a { text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext { display: inline-grid; place-items: center; width: 40px; height: 22px; border-radius: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-2); flex: none; }
.ext.cad { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.ext.dir { color: var(--ink); }
.dropzone { border: 1px dashed var(--line-2); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-3); margin-bottom: 16px; transition: .15s; }
.dropzone.over { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .1s; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 22px; }
.modal h2 { margin: 0 0 16px; font-size: 20px; font-weight: 800; font-stretch: 112%; }
.modal .actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
#toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--bg-3); border: 1px solid var(--line-2); font-size: 14px; max-width: 360px; }
.toast.err { border-color: var(--danger); color: var(--danger); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(90% 70% at 70% 30%, #121216 0%, #050505 65%); }
.auth .box { width: min(420px, 100%); }
.auth h1 { font-size: 34px; line-height: 1; font-weight: 900; font-stretch: 125%; text-transform: uppercase; margin: 18px 0 8px; }
.auth .switch { margin-top: 14px; font-size: 14px; color: var(--ink-3); }
.auth .switch button { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

/* ---------- dashboard ---------- */
.stat { display: grid; gap: 4px; }
.stat b { font-size: 32px; font-weight: 800; font-stretch: 125%; line-height: 1; }
.feed .list-row { align-items: flex-start; }
.status-bars { display: grid; gap: 8px; }
.status-bars .bar { display: grid; grid-template-columns: 110px 1fr 28px; align-items: center; gap: 10px; font-size: 13px; }
.status-bars .bar span:nth-child(2) { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.status-bars .bar i { display: block; height: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .parts-list { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; gap: 2px; }
  .brand, .nav-group, .side .me .who { display: none; }
  .side .me { margin: 0 0 0 auto; padding: 0; border: 0; }
  .nav { display: contents; }
  .nav a { flex-direction: column; justify-content: center; gap: 2px; font-size: 11px; padding: 6px 8px; white-space: nowrap; }
  .nav .count { display: none; }
  .page { padding-bottom: 110px; }
  .kanban { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .model-wrap { height: calc(100dvh - 210px); }
  .ftable .hide-sm { display: none; }
}

/* ---------- storage meter ---------- */
.meter { display: grid; gap: 6px; }
.meter-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 4px; }
.storage-warn { display: block; margin: 10px 8px 0; padding: 8px 10px; border-radius: 6px; font-size: 12px; text-decoration: none;
  color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* ---------- links ---------- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.link-tile { position: relative; display: flex; align-items: stretch; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s; }
.link-tile:hover { border-color: var(--line-2); }
.link-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; }
.link-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #f4f4f1; }
.link-icon img { width: 24px; height: 24px; }
.link-letter { font-weight: 800; color: #111; font-size: 18px; }
.link-text { min-width: 0; display: grid; }
.link-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-text span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-edit { align-self: flex-start; margin: 6px; width: 28px; height: 28px; border-radius: 6px; border: 0; background: none; color: var(--ink-3); cursor: pointer; opacity: 0; }
.link-tile:hover .link-edit, .link-edit:focus-visible { opacity: 1; }
@media (hover: none) { .link-edit { opacity: 1; } }
.link-grid.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.link-grid.compact .link-main { padding: 9px 10px; }
.link-grid.compact .link-icon { width: 32px; height: 32px; }

/* =========================================================
   v3: loader, search, docs, milestones, previews, admin, phones
   ========================================================= */

/* Boot loader: the Deltaflow mark, like the website's curtain */
#boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 16px; background: var(--bg); transition: opacity .6s ease, visibility .6s; }
#boot img { width: 92px; height: auto; animation: boot-mark 1.6s cubic-bezier(.2,.7,.2,1) infinite alternate; }
#boot span { font-family: var(--mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3); animation: boot-fade 1.2s ease .3s both; }
#boot.done { opacity: 0; visibility: hidden; }
@keyframes boot-mark { 0% { opacity: .25; transform: scale(.94); filter: blur(3px); } 60%, 100% { opacity: 1; transform: none; filter: none; } }
@keyframes boot-fade { from { opacity: 0; transform: translateY(6px); } }
.topbar-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 90; pointer-events: none; opacity: 0; transition: opacity .2s; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat; }
.topbar-progress.on { opacity: 1; animation: topbar 1s linear infinite; }
@keyframes topbar { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* Search */
.search-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 0 0 8px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-3); cursor: pointer; font-size: 14px; }
.search-btn:hover { color: var(--ink); border-color: var(--ink-3); }
kbd { font-family: var(--mono); font-size: 10px; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--ink-3); }
.modal.search { align-self: start; margin-top: 10vh; width: min(640px, 100%); }
.modal.search > h2 { display: none; }
.modal.search > input { font-size: 18px; padding: 12px 14px; }
.search-results { margin-top: 10px; max-height: 56vh; overflow: auto; display: grid; gap: 2px; }
.search-row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 78px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; }
.search-row.on { background: var(--bg-3); }
.search-row .st { display: grid; min-width: 0; }
.search-row .kind { color: var(--accent); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Docs */
.doc-row { text-decoration: none; align-items: flex-start; }
.claude-badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: #D9A27A; border: 1px solid color-mix(in srgb, #D9A27A 45%, transparent); }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.doc-side { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; }
.doc-side .h { border-left: 2px solid var(--line-2); padding: 2px 0 2px 12px; }
.doc-side .h.cur { border-color: var(--accent); }
.doc-editor { width: 100%; min-height: 62vh; font-family: var(--mono); font-size: 14px; line-height: 1.6; padding: 16px; }
.doc-savebar { position: sticky; bottom: 0; margin-top: 10px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); flex-wrap: nowrap; }
.doc-savebar input { flex: 1; }
.md { font-size: 16px; line-height: 1.65; padding: 26px clamp(18px, 3vw, 36px); }
.md h2, .md h3, .md h4, .md h5 { font-stretch: 112%; line-height: 1.2; margin: 1.4em 0 .5em; }
.md h2 { font-size: 26px; font-weight: 800; margin-top: 0; } .md h3 { font-size: 20px; } .md h4 { font-size: 17px; }
.md p, .md ul, .md ol { margin: 0 0 1em; color: var(--ink-2); }
.md li { margin: .25em 0; }
.md strong { color: var(--ink); }
.md a { color: var(--accent); }
.md code { font-family: var(--mono); font-size: .88em; padding: 1px 5px; border-radius: 4px; background: var(--bg-3); }
.md pre { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; }
.md pre code { padding: 0; background: none; }
.md blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.md-table { overflow-x: auto; margin: 0 0 1em; } .md table { border-collapse: collapse; font-size: 14px; } .md th, .md td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; }
.md-box { display: inline-block; width: 13px; height: 13px; border: 1px solid var(--ink-3); border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.md-box.on { background: var(--accent); border-color: var(--accent); }
.diff { background: var(--bg-3); border-radius: 8px; padding: 12px; max-height: 56vh; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.d-add { background: rgba(127,199,154,.14); color: #A9E2BE; } .d-del { background: rgba(224,122,106,.14); color: #F0A89C; text-decoration: line-through; } .d-same { color: var(--ink-3); }
.modal.wide { width: min(880px, 100%); }

/* Milestones */
.progress.big { height: 6px; border-radius: 3px; }
.phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.phase { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.phase.now { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.phase-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.phase-head h2 { margin: 2px 0 0; font-size: 18px; font-weight: 800; font-stretch: 112%; }
.phase-body { padding: 10px; display: grid; gap: 10px; }
.ms-card { all: unset; box-sizing: border-box; display: grid; gap: 8px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); cursor: pointer; }
.ms-card:hover { border-color: var(--line-2); }
.ms-card b { font-weight: 700; font-stretch: 110%; }
.ms-card .muted { font-size: 13px; }

/* File preview */
.preview { border-radius: 10px; overflow: hidden; background: var(--bg-3); border: 1px solid var(--line); min-height: 120px; }
.preview img { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; }
.preview iframe { display: block; width: 100%; height: 62vh; border: 0; background: #fff; }
.preview .text-preview { margin: 0; padding: 16px; max-height: 60vh; overflow: auto; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; }
.preview .md { max-height: 60vh; overflow: auto; }
.preview.stl canvas { display: block; width: 100% !important; }

/* Settings: Claude + admin */
.steps { padding-left: 20px; display: grid; gap: 10px; color: var(--ink-2); margin: 0; }
.copybox { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 8px 8px 12px; border-radius: 8px; background: var(--bg-3); border: 1px solid var(--line-2); }
.copybox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13px; color: var(--ink); }
.user-row.off { opacity: .55; }
a.me { text-decoration: none; }

/* Phones: tab bar, More sheet, one kanban column at a time */
.tabbar { display: none; }
.kanban-tabs { display: none; }
.next-btn { display: none; }
.sheet-back { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 80vh; overflow: auto; background: var(--bg-2); border-top: 1px solid var(--line-2); border-radius: 16px 16px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 14px; }
.sheet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-links a { display: flex; align-items: center; min-height: 52px; padding: 0 14px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.sheet-links a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }

@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { position: static; max-height: none; }
  .phases { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .side { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(8,8,10,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { all: unset; display: grid; justify-items: center; gap: 3px; padding: 6px 0; font-size: 11px; color: var(--ink-3); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar [aria-current="page"] { color: var(--accent); }
  .page { padding: 22px 16px 120px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 30px; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 36px; padding: 0 12px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea { font-size: 16px; padding: 11px 12px; }
  .modal-back { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal.search { margin-top: 0; align-self: end; }
  .kanban-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; padding: 4px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .kanban-tabs button { all: unset; text-align: center; padding: 9px 2px; border-radius: 7px; font-size: 13px; color: var(--ink-3); cursor: pointer; }
  .kanban-tabs button span { display: block; font-family: var(--mono); font-size: 11px; }
  .kanban-tabs button[aria-selected="true"] { background: var(--bg-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
  .kanban { display: block; overflow: visible; }
  .kanban .col { display: none; min-height: 0; }
  .kanban[data-col="0"] .col:nth-child(1), .kanban[data-col="1"] .col:nth-child(2), .kanban[data-col="2"] .col:nth-child(3), .kanban[data-col="3"] .col:nth-child(4) { display: flex; }
  .kanban .col-head { display: none; }
  .kcard { padding: 14px; }
  .next-btn { display: block; justify-self: start; margin-top: 2px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line-2); background: none; color: var(--ink-2); font-size: 13px; }
  .model-wrap { height: calc(100dvh - 220px); border-radius: 10px; }
  .model-tools { left: 8px; right: 8px; top: 8px; }
  .legend { display: none; }
  .drawer { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 70%; border-radius: 16px 16px 0 0; }
  .ftable thead { display: none; }
  .ftable, .ftable tbody, .ftable tr, .ftable td { display: block; width: 100%; }
  .ftable tr { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .ftable td { border: 0; padding: 2px 0; }
  .ftable td:last-child .row { justify-content: flex-start !important; margin-top: 6px; }
  .link-grid { grid-template-columns: 1fr; }
  .grid-3 { gap: 10px; }
  #toast-root { bottom: calc(76px + env(safe-area-inset-bottom)); left: 16px; right: 16px; }
}

/* Language switch */
.lang-switch { display: inline-flex; padding: 2px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-2); flex: none; }
.lang-switch button { all: unset; padding: 4px 9px; border-radius: 5px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--ink-3); cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--bg-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.side .me { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me-link { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.me-link .who { min-width: 0; } .me-link .who div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-who { font-size: 12px; font-weight: 600; color: var(--ink-3); }
