/* ==========================================================
   Haven — Best Life Apps brand
   ========================================================== */

@font-face { font-family: "Cinzel"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/cinzel-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("../fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/eb-garamond-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #07070F;
  --surface: #0F0F1A;
  --surface-2: #16162A;
  --surface-3: #1D1D35;
  --border: rgba(186, 141, 53, 0.22);
  --border-strong: rgba(186, 141, 53, 0.45);
  --gold: #BA8D35;
  --gold-hover: #CFA24A;
  --text: #C9B88C;
  --text-body: #AF9B6E;
  --text-strong: #EDE2C4;
  --muted: #8A7E5C;
  --steel: #486D9A;
  --steel-light: #7FA3CF;
  --forest: #195429;
  --emerald: #30C763;
  --danger: #D9534F;
  --danger-bg: rgba(217, 83, 79, 0.12);
  --warn: #E0A83B;
  --warn-bg: rgba(224, 168, 59, 0.12);
  --ok-bg: rgba(48, 199, 99, 0.12);

  --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body: "EB Garamond", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 8px;
  --r-lg: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --glow: 0 0 22px rgba(186, 141, 53, 0.28);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text-body);
  font: 400 1.125rem/1.55 var(--font-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--gold); font-weight: 600; letter-spacing: 0.03em; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.25rem; }
p { margin: 0 0 0.9em; }
a { color: var(--gold); text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
a:hover { color: var(--gold-hover); }
code, .mono { font-family: var(--font-mono); font-size: 0.85em; }
code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 4px; color: var(--text-strong); }
strong { color: var(--text-strong); font-weight: 600; }
em { color: var(--text); }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: var(--bg); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--bg); padding: 8px 12px; border-radius: var(--r); z-index: 100; }
.skip:focus { left: 8px; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.eyebrow { font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.4rem; }
.lead { font-size: 1.2rem; color: var(--text); max-width: 60ch; }
.hint { color: var(--muted); font-size: 1rem; }
small { color: var(--muted); font-size: 0.9rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 42px; padding: 0.5rem 1.15rem; border-radius: var(--r);
  font: 600 1rem/1 var(--font-display); font-variant: small-caps; letter-spacing: 0.08em;
  border: 1px solid var(--gold); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s, border-color .15s;
}
.btn--primary { background: var(--gold); color: var(--bg); }
.btn--primary:hover { background: var(--gold-hover); color: var(--bg); box-shadow: var(--glow); }
.btn--secondary { background: transparent; color: var(--gold); }
.btn--secondary:hover { background: rgba(186, 141, 53, 0.1); color: var(--gold-hover); }
.btn--ghost { background: transparent; color: var(--text); border-color: transparent; }
.btn--ghost:hover { color: var(--gold); background: var(--surface-2); }
.btn--danger { background: transparent; color: #F08A86; border-color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { min-height: 34px; padding: 0.3rem 0.8rem; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn.is-busy { opacity: 0.7; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r);
  background: transparent; border: 1px solid transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--gold); }
.icon-btn--danger:hover { color: #F08A86; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field > span { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.field > span small { text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input:not([type]), input[inputmode] {
  width: 100%; min-height: 44px; padding: 0.55rem 0.8rem; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--border); color: var(--text-strong); font: inherit; font-size: 1.05rem;
}
input:focus { border-color: var(--gold); outline: none; box-shadow: var(--glow); }
input[type=checkbox], input[type=radio] { accent-color: var(--gold); width: 1.1rem; height: 1.1rem; }
.code-input { font-family: var(--font-mono) !important; letter-spacing: 0.3em; font-size: 1.35rem !important; text-align: center; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check-row { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.check-row input { margin-top: 0.3rem; }
.form--inline { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.6rem; }
.form--inline .code-input { max-width: 200px; }
.actions { display: flex; gap: 0.75rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }
.actions--left { justify-content: flex-start; }
.actions--center { justify-content: center; }
.meter { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: -0.4rem; }
.meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.choice-group { border: 0; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.choice { display: flex; gap: 0.8rem; align-items: flex-start; padding: 1rem; border: 1px solid var(--border); border-radius: var(--r-lg); cursor: pointer; background: var(--bg); }
.choice:has(input:checked) { border-color: var(--gold); box-shadow: var(--glow); }
.choice input { margin-top: 0.35rem; }
.choice__body { display: grid; gap: 0.2rem; }
.choice.is-disabled { opacity: 0.45; cursor: not-allowed; }
.badge { font-family: var(--font-display); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--emerald); border: 1px solid rgba(48,199,99,.4); border-radius: 999px; padding: 0.1rem 0.5rem; margin-left: 0.4rem; vertical-align: 0.15em; }
.advanced { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.advanced summary { cursor: pointer; color: var(--gold); font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.08em; }
.advanced[open] summary { margin-bottom: 0.8rem; }
.advanced .field { margin-top: 0.8rem; }

/* ---------- Notes & flashes ---------- */
.flashes { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
.flash, .note { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.75rem 1rem; border-radius: var(--r); border: 1px solid; font-size: 1.02rem; }
.flash .icon, .note .icon { margin-top: 0.2rem; }
.flash--success { background: var(--ok-bg); border-color: rgba(48,199,99,.35); color: #9BE3B3; }
.flash--error { background: var(--danger-bg); border-color: rgba(217,83,79,.45); color: #F4AAA7; }
.flash--warning, .note--warn { background: var(--warn-bg); border-color: rgba(224,168,59,.4); color: #F0CD85; }
.flash--info { background: rgba(72,109,154,.15); border-color: rgba(72,109,154,.5); color: var(--steel-light); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 1.25rem; align-items: start; }
.card__head { display: flex; gap: 0.9rem; align-items: flex-start; margin-bottom: 1rem; }
.card__head h2 { margin-bottom: 0.2rem; }
.card__head p { margin: 0; }
.card__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--gold); flex: none; }
.card__icon .icon { width: 22px; height: 22px; }
.card__icon.is-ok { color: var(--emerald); background: var(--ok-bg); }
.card__icon.is-warn { color: var(--warn); background: var(--warn-bg); }

/* ---------- Checks list ---------- */
.checks { list-style: none; margin: 1.25rem 0; padding: 0; display: grid; gap: 0.5rem; }
.check { display: grid; grid-template-columns: auto 1fr auto; gap: 0.8rem; align-items: center; padding: 0.7rem 0.9rem; border-radius: var(--r); background: var(--bg); border: 1px solid var(--border); }
.check__badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.check--ok .check__badge { color: var(--emerald); background: var(--ok-bg); }
.check--warn .check__badge { color: var(--warn); background: var(--warn-bg); }
.check--fail .check__badge { color: var(--danger); background: var(--danger-bg); }
.check--fail { border-color: rgba(217,83,79,.5); }
.check__text { display: grid; line-height: 1.3; }
.check__text span { color: var(--muted); font-size: 0.98rem; }
.check__tag { font-family: var(--font-display); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.check--fail .check__tag { color: var(--danger); }
.check--warn .check__tag { color: var(--warn); }
.checks--compact .check { padding: 0.5rem 0.7rem; }

/* ---------- Setup wizard ---------- */
.setup__wrap { max-width: 760px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3.5rem) 1rem 3rem; }
body.setup, body.auth {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(25, 84, 41, 0.45), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(72, 109, 154, 0.2), transparent 70%),
    var(--bg);
  background-attachment: scroll;
}
.setup__head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.8rem; }
.setup__head img { filter: drop-shadow(0 0 18px rgba(48, 199, 99, 0.25)); }
.setup__head h1 { margin: 0; }
.setup__card { padding: clamp(1.25rem, 4vw, 2.25rem); }
.setup__foot, .auth__foot { text-align: center; color: var(--muted); font-size: 0.95rem; margin-top: 1.5rem; }
.stepper { list-style: none; display: flex; gap: 0.5rem; padding: 0; margin: 0 0 1.25rem; counter-reset: s; }
.stepper__item { flex: 1; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 0.95rem; min-width: 0; }
.stepper__dot { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; border: 1px solid var(--border-strong); font-family: var(--font-display); font-size: 0.8rem; }
.stepper__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper__item.is-current { color: var(--text-strong); border-color: var(--gold); }
.stepper__item.is-current .stepper__dot { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.stepper__item.is-done .stepper__dot { background: var(--ok-bg); color: var(--emerald); border-color: rgba(48,199,99,.4); }
@media (max-width: 560px) { .stepper__label { display: none; } .stepper__item { justify-content: center; } }
.done { text-align: center; }
.done .lead { margin: 0 auto 1rem; }
.done__icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg); color: var(--emerald); margin-bottom: 1rem; }
.done__icon .icon { width: 36px; height: 36px; }
.tips { list-style: none; padding: 0; margin: 1rem auto 1.5rem; display: grid; gap: 0.5rem; max-width: 520px; text-align: left; }
.tips li { display: flex; gap: 0.6rem; }
.tips .icon { color: var(--gold); margin-top: 0.25rem; }

/* ---------- Auth pages ---------- */
.auth__wrap { min-height: 100vh; display: grid; place-content: center; padding: 2rem 1rem; }
.auth__card { width: min(420px, calc(100vw - 2rem)); background: rgba(15, 15, 26, 0.92); border: 1px solid var(--border); border-radius: 18px; padding: 2rem 1.75rem; box-shadow: var(--shadow); }
.auth__brand { text-align: center; margin-bottom: 1.5rem; }
.auth__brand img { filter: drop-shadow(0 0 22px rgba(48, 199, 99, 0.3)); margin-bottom: 0.6rem; }
.auth__brand .eyebrow { margin-bottom: 0.2rem; }
.auth__title { font-size: 1.9rem; margin: 0; }
.auth__lead { color: var(--text); text-align: center; }
.auth__alt { text-align: center; margin: 1rem 0 0; font-size: 1rem; }
.auth .advanced { margin-top: 1.2rem; }
.auth .setup-steps { margin-top: 0.5rem; }
.auth .qr-box { flex-direction: column; align-items: center; text-align: center; }

/* ---------- 2FA setup ---------- */
.setup-steps { padding-left: 1.3rem; display: grid; gap: 1.2rem; }
.setup-steps li::marker { color: var(--gold); font-family: var(--font-display); }
.qr-box { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; margin-top: 0.8rem; }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: 204px; height: 204px; display: grid; place-items: center; }
.qr svg, .qr img { width: 180px; height: 180px; display: block; }
.qr-manual { display: grid; gap: 0.45rem; justify-items: start; }
.auth .qr-manual { justify-items: center; }
.secret { font-size: 1rem; letter-spacing: 0.08em; word-break: break-all; padding: 0.4rem 0.6rem; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin: 1.25rem 0; padding: 1.1rem; background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); max-width: 460px; }
.codes code { font-size: 1.05rem; text-align: center; padding: 0.35rem; background: var(--surface-2); letter-spacing: 0.06em; }
.confirm-save { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }

/* ---------- App shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 0.75rem; padding: 0 1rem; background: rgba(7, 7, 15, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand img { filter: drop-shadow(0 0 10px rgba(48,199,99,.25)); }
.brand__name { font-family: var(--font-display); color: var(--gold); font-size: 1.2rem; letter-spacing: 0.1em; }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.topbar__name { color: var(--text); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--forest); color: var(--text-strong); font-family: var(--font-display); border: 1px solid rgba(48,199,99,.4); }
.topbar__menu { display: none; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 0.75rem; border-right: 1px solid var(--border); background: var(--surface); }
.nav-link { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.8rem; border-radius: var(--r); color: var(--text); text-decoration: none; font-size: 1.08rem; background: none; border: 0; width: 100%; cursor: pointer; font-family: inherit; text-align: left; }
.nav-link:hover { background: var(--surface-2); color: var(--gold); }
.nav-link.is-active { background: var(--surface-3); color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.sidebar__soon { margin-top: 1.25rem; padding: 0.8rem; border: 1px dashed var(--border); border-radius: var(--r); font-size: 0.95rem; color: var(--muted); display: grid; gap: 0.2rem; }
.sidebar__logout { margin-top: auto; }
.main { padding: clamp(1rem, 3vw, 2rem); min-width: 0; }
.page { max-width: 1100px; }
.page--narrow { max-width: 720px; }

@media (max-width: 860px) {
  .topbar__menu { display: inline-grid; }
  .topbar__name { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 64px; left: 0; width: 260px; z-index: 30; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
}

/* ---------- Files ---------- */
.files__head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.files__actions { display: flex; gap: 0.6rem; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 0.04em; min-width: 0; }
.crumbs a { color: var(--text); text-decoration: none; }
.crumbs a:hover { color: var(--gold); }
.crumbs__current { color: var(--gold); overflow-wrap: anywhere; }
.crumbs__sep { color: var(--muted); display: inline-flex; }
.crumbs__sep .icon { width: 0.9em; height: 0.9em; }
.dropzone { position: relative; min-height: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.drop-overlay { position: absolute; inset: 0; display: none; flex-direction: column; gap: 0.6rem; align-items: center; justify-content: center; background: rgba(7,7,15,.88); border: 2px dashed var(--gold); border-radius: var(--r-lg); color: var(--gold); font-family: var(--font-display); letter-spacing: 0.08em; }
.drop-overlay .icon { width: 48px; height: 48px; }
.dropzone.is-dragging .drop-overlay { display: flex; }
.empty { text-align: center; padding: 4rem 1.5rem; max-width: 520px; margin: 0 auto; }
.empty__icon { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--surface-3); color: var(--gold); margin-bottom: 1rem; }
.empty__icon .icon { width: 36px; height: 36px; }
.file-table, .log-table { width: 100%; border-collapse: collapse; }
.file-table th, .log-table th { text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 0.75rem 0.8rem; border-bottom: 1px solid var(--border); }
.file-table td { padding: 0.45rem 0.8rem; border-bottom: 1px solid rgba(186,141,53,.09); vertical-align: middle; }
.file-table tbody tr:hover { background: var(--surface-2); }
.file-table tbody tr.is-selected { background: rgba(186,141,53,.1); }
.col-check { width: 44px; }
.col-size { width: 110px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.col-date { width: 130px; white-space: nowrap; color: var(--muted); }
.col-actions { width: 132px; text-align: right; white-space: nowrap; }
.col-actions .icon-btn { opacity: 0.55; }
tr:hover .col-actions .icon-btn, .col-actions .icon-btn:focus-visible { opacity: 1; }
.file-link { display: flex; align-items: center; gap: 0.75rem; color: var(--text-strong); text-decoration: none; min-width: 0; }
.file-link:hover .fname { color: var(--gold); text-decoration: underline; text-decoration-color: var(--border-strong); }
.fname { overflow-wrap: anywhere; }
.ficon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-3); color: var(--text); flex: none; }
.ficon .icon { width: 20px; height: 20px; }
.ficon--folder { color: var(--gold); background: rgba(186,141,53,.14); }
.ficon--image { color: var(--emerald); background: rgba(48,199,99,.12); }
.ficon--video, .ficon--audio { color: #B893E6; background: rgba(160,110,220,.13); }
.ficon--pdf { color: #F08A86; background: var(--danger-bg); }
.ficon--doc, .ficon--slides { color: var(--steel-light); background: rgba(72,109,154,.18); }
.ficon--sheet { color: #6FD39A; background: rgba(25,84,41,.35); }
.ficon--archive { color: var(--warn); background: var(--warn-bg); }
.usage { color: var(--muted); font-size: 0.98rem; margin-top: 0.8rem; }
.selection-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.9rem; margin-bottom: 0.75rem; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--r); }
@media (max-width: 700px) {
  .col-date, .file-table th.col-date { display: none; }
  .col-size { width: 80px; }
  .col-actions { width: auto; }
  .col-actions .icon-btn { opacity: 1; width: 32px; }
  .files__actions .btn span { display: none; }
  .file-table td { padding: 0.45rem 0.4rem; }
}

/* Uploads panel */
.uploads { position: fixed; right: 1rem; bottom: 1rem; width: min(380px, calc(100vw - 2rem)); max-height: 50vh; overflow: auto; z-index: 40; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.uploads__head { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.uploads__list { list-style: none; margin: 0; padding: 0.4rem 0.9rem 0.8rem; display: grid; gap: 0.6rem; }
.upload-item { display: grid; gap: 0.25rem; font-size: 0.98rem; }
.upload-item__row { display: flex; justify-content: space-between; gap: 0.5rem; }
.upload-item__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.upload-item__status { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.upload-item.is-error .upload-item__status { color: #F4AAA7; white-space: normal; }
.upload-item.is-done .upload-item__status { color: var(--emerald); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--emerald)); transition: width .15s; }

/* Dialogs */
.dialog { width: min(440px, calc(100vw - 2rem)); background: var(--surface); color: var(--text-body); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.dialog form { display: grid; gap: 1rem; }
.dialog h2 { margin: 0; }

/* Tables & info */
.table-wrap { overflow-x: auto; }
.log-table td { padding: 0.45rem 0.8rem; border-bottom: 1px solid rgba(186,141,53,.09); font-size: 1rem; }
.log-table tr.is-bad td { color: #F4AAA7; }
.log-detail { max-width: 340px; overflow-wrap: anywhere; color: var(--muted); }
.info { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; margin: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }

@media print {
  body { background: #fff; color: #000; }
  .topbar, .sidebar, .actions, .confirm-save, .flashes { display: none !important; }
  .codes { border-color: #000; }
  .codes code { background: #fff; color: #000; }
  h1 { color: #000; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ==========================================================
   Stage 2: search, grid view, viewer, versions, move, trash
   ========================================================== */
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 0.7rem; color: var(--muted); pointer-events: none; }
.search input[type=search] {
  width: min(260px, 50vw); min-height: 42px; padding: 0.45rem 0.8rem 0.45rem 2.2rem; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--border); color: var(--text-strong); font: inherit; font-size: 1.02rem;
}
.search input[type=search]:focus { border-color: var(--gold); outline: none; box-shadow: var(--glow); }
.files__actions { flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); padding: 2px; }
.seg .icon-btn { width: 36px; height: 34px; }
.seg .icon-btn.is-on { background: var(--surface-3); color: var(--gold); }
.page-title { display: flex; align-items: center; gap: 0.5rem; margin: 0; }

/* layouts */
.files[data-layout="list"] .file-grid,
.files[data-layout="grid"] .file-table { display: none; }
.files:not([data-layout]) .file-grid { display: none; }

/* thumbnails inside the list */
.ficon--thumb { background: var(--bg); overflow: hidden; padding: 0; }
.ficon--thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.col-where { color: var(--muted); max-width: 220px; overflow-wrap: anywhere; }
.col-where a { color: var(--text); }
.file-link--static { cursor: default; }
.inline-form { display: inline; }

/* grid view */
.file-grid { list-style: none; margin: 0; padding: 1rem; display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); overflow: hidden; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--gold); transform: translateY(-1px); }
.tile__link { display: grid; text-decoration: none; color: var(--text-strong); }
.tile__art { aspect-ratio: 1 / 1; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.tile__art img { width: 100%; height: 100%; object-fit: cover; }
.tile__icon { width: 46%; height: 46%; color: var(--text); }
.tile__icon--folder { color: var(--gold); }
.tile__icon--image { color: var(--emerald); }
.tile__icon--pdf { color: #F08A86; }
.tile__icon--video, .tile__icon--audio { color: #B893E6; }
.tile__icon--doc, .tile__icon--slides { color: var(--steel-light); }
.tile__name { padding: 0.5rem 0.65rem 0; font-size: 1rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__meta { padding: 0 0.65rem 0.55rem; font-size: 0.88rem; color: var(--muted); }
.tile__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; background: rgba(7,7,15,.85); border-radius: var(--r); }
.tile:hover .tile__actions, .tile:focus-within .tile__actions { opacity: 1; }
@media (hover: none) { .tile__actions { opacity: 1; } }
.tile__actions .icon-btn { width: 30px; height: 30px; }

/* selection bar */
.selection-bar { flex-wrap: wrap; }
.selection-bar__count { margin-right: auto; color: var(--text-strong); }
@media (max-width: 700px) { .selection-bar .btn span { display: none; } }

/* viewer */
.viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(4, 4, 9, 0.97); color: var(--text); }
.viewer[open] { display: grid; grid-template-rows: auto 1fr; }
.viewer::backdrop { background: rgba(0,0,0,.8); }
.viewer__bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); background: rgba(7,7,15,.9); }
.viewer__name { color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer__count { color: var(--muted); font-size: 0.95rem; white-space: nowrap; }
.viewer__tools { margin-left: auto; display: flex; gap: 0.25rem; }
.viewer__stage { position: relative; display: grid; place-items: center; overflow: auto; padding: 1rem 3.5rem; min-height: 0; }
.viewer__stage img { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; border-radius: 6px; box-shadow: var(--shadow); background: repeating-conic-gradient(#1a1a2a 0 25%, #11111c 0 50%) 0 0 / 20px 20px; }
.viewer__stage video { max-width: 100%; max-height: calc(100vh - 100px); border-radius: 6px; background: #000; }
.viewer__stage audio { width: min(560px, 90vw); }
.viewer__stage iframe { width: min(1100px, 100%); height: calc(100vh - 100px); border: 0; border-radius: 6px; background: #fff; }
.viewer__stage pre { width: min(1000px, 100%); max-height: calc(100vh - 110px); overflow: auto; margin: 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text-strong); font: 0.92rem/1.55 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; place-self: start center; }
.viewer__msg { text-align: center; color: var(--muted); display: grid; gap: 0.8rem; justify-items: center; }
.viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--r); background: rgba(7,7,15,.75); color: var(--text); cursor: pointer; }
.viewer__nav:hover { color: var(--gold); border-color: var(--gold); }
.viewer__nav .icon { width: 26px; height: 26px; }
.viewer__nav--prev { left: 0.5rem; }
.viewer__nav--next { right: 0.5rem; }
@media (max-width: 600px) { .viewer__stage { padding: 0.5rem; } .viewer__nav { width: 36px; height: 52px; top: auto; bottom: 1rem; transform: none; } }

/* dialogs */
.dialog--wide { width: min(620px, calc(100vw - 2rem)); }
.dialog__body { display: grid; gap: 0.8rem; }
.version-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; max-height: 50vh; overflow: auto; }
.version { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.version__when { color: var(--text-strong); }
.version__size { color: var(--muted); font-size: 0.95rem; }
.version__actions { margin-left: auto; display: flex; gap: 0.25rem; }
.version--current { border-color: var(--border-strong); }
.crumbs--small { font-size: 0.95rem; }
.folder-picker { list-style: none; margin: 0; padding: 0.3rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); max-height: 45vh; min-height: 140px; overflow: auto; }
.folder-picker button { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.5rem 0.6rem; border: 0; border-radius: 6px; background: none; color: var(--text-strong); font: inherit; cursor: pointer; text-align: left; }
.folder-picker button:hover:not(:disabled) { background: var(--surface-3); }
.folder-picker button:disabled { opacity: 0.4; cursor: not-allowed; }
.folder-picker .icon { color: var(--gold); }
.folder-picker .muted { padding: 0.6rem; }
.dropzone--static { min-height: 200px; }

/* Phones: keep the name readable. Move/versions/download stay available via selection bar and viewer. */
@media (max-width: 700px) {
  .file-table .col-size, .file-table th.col-size { display: none; }
  .col-actions [data-versions], .col-actions [data-move-one], .col-actions a[download] { display: none; }
  .col-actions { width: 76px; }
  .files__actions { width: 100%; }
  .search { flex: 1 1 100%; }
  .search input[type=search] { width: 100%; }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0.6rem; gap: 0.6rem; }
}

/* ==========================================================
   Stage 3: people, settings, sharing, public links
   ========================================================== */
select {
  width: 100%; min-height: 44px; padding: 0.5rem 0.8rem; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--border); color: var(--text-strong); font: inherit; font-size: 1.02rem;
}
select:focus { border-color: var(--gold); outline: none; box-shadow: var(--glow); }
input[type=date] {
  width: 100%; min-height: 44px; padding: 0.5rem 0.8rem; border-radius: var(--r); background: var(--bg);
  border: 1px solid var(--border); color: var(--text-strong); font: inherit; color-scheme: dark;
}
input[readonly] { color: var(--text); background: var(--surface-2); }
.nav-group { margin: 0.9rem 0.8rem 0.2rem; font-family: var(--font-display); font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.mt { margin-top: 1.5rem; }
.stack { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.stack-lg { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.card--flush { padding: 0; overflow: hidden; }
.card--danger { border-color: rgba(217,83,79,.45); margin-top: 1.25rem; }
.card--danger h2 { color: #F08A86; }
.cards + .card, .card + .card { margin-top: 1.25rem; }
.ok-text { color: var(--emerald); display: inline-flex; align-items: center; gap: 0.25rem; }
.bad-text { color: #F4AAA7; }
.pill { display: inline-block; padding: 0.12rem 0.6rem; border-radius: 999px; font-size: 0.85rem; border: 1px solid; white-space: nowrap; }
.pill--active { color: var(--emerald); border-color: rgba(48,199,99,.4); background: var(--ok-bg); }
.pill--invited { color: var(--steel-light); border-color: rgba(72,109,154,.5); background: rgba(72,109,154,.15); }
.pill--disabled { color: #F4AAA7; border-color: rgba(217,83,79,.45); background: var(--danger-bg); }
.avatar--sm { width: 36px; height: 36px; flex: none; }
.user-table td { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.user-table small { color: var(--muted); }
.quota { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 4px; max-width: 160px; }
.quota span { display: block; height: 100%; background: var(--gold); }
.quota span.is-high { background: var(--danger); }
.linkbox { margin-bottom: 1.25rem; border-color: rgba(48,199,99,.35); }
.copyrow { display: flex; gap: 0.5rem; }
.copyrow input { flex: 1; min-width: 0; }
.choice--sm { padding: 0.6rem 0.8rem; align-items: center; }
.choice--sm input { margin-top: 0; }
.choice-group--row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.check-row--field { align-self: end; padding-bottom: 0.6rem; }
.field-legend { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.5rem; }
.card .check-row { margin: 0.5rem 0; }
.card h2 + .check-row { margin-top: 0.25rem; }
tr.is-muted td { opacity: 0.55; }
.icon-btn--accent { color: var(--gold); }
.badge-icon { display: inline-flex; color: var(--steel-light); margin-left: 0.2rem; }
.badge-icon .icon { width: 0.95em; height: 0.95em; }
.tile__name .badge-icon .icon { width: 0.85em; height: 0.85em; }

/* Shared banner */
.share-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; padding: 0.7rem 1rem; margin-bottom: 1rem;
  border: 1px solid rgba(72,109,154,.5); background: rgba(72,109,154,.12); border-radius: var(--r); color: var(--text); }
.share-banner > .icon { color: var(--steel-light); }
.share-banner__back { margin-left: auto; }

/* Share dialog */
.dialog--share { width: min(680px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; }
.share-head { display: flex; gap: 0.9rem; align-items: center; }
.share-head h2 { margin: 0; overflow-wrap: anywhere; }
.share-head p { margin: 0; }
.share-sec { border-top: 1px solid var(--border); padding-top: 0.9rem; }
.share-sec h3 { font-size: 0.95rem; display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.7rem; }
.share-row { display: grid; grid-template-columns: 1fr 150px auto; gap: 0.5rem; }
@media (max-width: 560px) { .share-row { grid-template-columns: 1fr; } }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.share-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.7rem; align-items: center; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); }
.share-item.is-expired { opacity: 0.55; }
.share-item__icon { color: var(--gold); display: grid; place-items: center; }
.share-item__body { display: grid; gap: 0.15rem; min-width: 0; }
.share-item__body .muted { font-size: 0.95rem; }
.share-item__actions { display: flex; gap: 0.15rem; }
.share-url { min-height: 34px !important; font-size: 0.8rem !important; padding: 0.3rem 0.5rem !important; margin-top: 0.25rem; }
.share-msg { min-height: 1.4em; margin: 0; color: var(--emerald); }
.share-msg.is-bad { color: #F4AAA7; }

/* Public link pages */
.app--public .shell { display: block; }
.main--public { max-width: 1100px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) 1rem 2rem; min-height: calc(100vh - 64px); }
.public-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 1rem; }
.public-foot { text-align: center; color: var(--muted); font-size: 0.95rem; margin-top: 2rem; }
.auth__card--center { margin: 3rem auto; text-align: center; }
.auth__card--center .form { text-align: left; }
.empty--drop .btn { margin-top: 0.5rem; }
@media (max-width: 600px) { .public-meta { display: none; } }

/* Calendar */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 1rem 0; }
.cal-nav { display: flex; align-items: center; gap: 0.35rem; }
.cal-heading { margin: 0 0 0 0.4rem; font-size: 1.15rem; white-space: nowrap; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.cal-chip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; color: var(--muted); }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cal-grid { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.cal-grid__head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); }
.cal-grid__head div { padding: 0.5rem; text-align: center; font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.cal-grid__row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { min-height: 110px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); padding: 0.35rem; display: flex; flex-direction: column; gap: 0.25rem; }
.cal-grid__row .cal-day:first-child { border-left: 0; }
.cal-day.is-outside { background: rgba(0,0,0,.18); }
.cal-day.is-outside .cal-day__num { color: var(--muted); }
.cal-day.is-today { background: rgba(186,141,53,.08); }
.cal-day__num { align-self: flex-start; border: 0; background: none; color: var(--text-strong); font-family: var(--font-display); font-size: 0.95rem; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.cal-day__num:hover { background: var(--surface-3); color: var(--gold); }
.is-today .cal-day__num { background: var(--gold); color: var(--bg); }
.cal-day__events { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cal-more { font-size: 0.85rem; color: var(--muted); text-decoration: none; padding-left: 0.2rem; }
.cal-more:hover { color: var(--gold); }
.cal-chip-event { display: block; width: 100%; text-align: left; border: 0; border-radius: 5px; padding: 0.15rem 0.4rem; font-size: 0.85rem; line-height: 1.35;
  background: color-mix(in srgb, var(--cal-color, var(--gold)) 22%, transparent); color: var(--text-strong); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--cal-color, var(--gold)); }
.cal-chip-event:hover { background: color-mix(in srgb, var(--cal-color, var(--gold)) 38%, transparent); }
.cal-chip-event__time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 0.3rem; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 0.75rem; overflow-x: auto; }
.cal-col { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; min-height: 200px; }
.cal-col.is-today { border-color: var(--border-strong); box-shadow: var(--glow); }
.cal-col__head { border: 0; background: none; color: var(--text-strong); font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.04em; text-align: left; cursor: pointer; padding: 0.2rem; }
.cal-col__head:hover { color: var(--gold); }
.cal-col__events { display: flex; flex-direction: column; gap: 0.25rem; }
.cal-col__empty { margin: 0; font-size: 0.9rem; }
.cal-agenda-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.cal-agenda-list .cal-chip-event { padding: 0.5rem 0.7rem; font-size: 1rem; white-space: normal; }
.cal-agenda-day { margin-bottom: 1.25rem; }
.cal-agenda-day h3 { font-size: 1rem; margin-bottom: 0.5rem; }
@media (max-width: 860px) { .cal-day { min-height: 70px; } .cal-heading { font-size: 1rem; } }

.seg .cal-view-tab { width: auto; padding: 0 0.7rem; }
.actions-spacer { flex: 1; }

/* Contacts */
.contact-photo-row { display: flex; align-items: center; gap: 0.9rem; }
.contact-photo-row .avatar { flex: none; }
.contact-photo-row .field { flex: 1; }
.contact-row { cursor: pointer; }
.field-legend.field-legend { margin-top: 0.4rem; }
.avatar--md { width: 64px; height: 64px; }
img.avatar { object-fit: cover; }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.project-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.1rem; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s; }
.project-card:hover { border-color: var(--border-strong); }
.project-card h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.project-card p { margin: 0 0 0.7rem; font-size: 0.9rem; min-height: 2.6em; }
.project-card__meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; color: var(--muted); }
.board { display: flex; gap: 0.9rem; overflow-x: auto; padding-bottom: 0.5rem; align-items: flex-start; }
.board-col { flex: 0 0 260px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.board-col.is-dragover { border-color: var(--gold); box-shadow: var(--glow); }
.board-col__head { display: flex; align-items: center; gap: 0.4rem; }
.board-col__head h2 { margin: 0; font-size: 0.9rem; font-family: var(--font-display); letter-spacing: 0.04em; flex: 1; }
.board-col__count { font-size: 0.8rem; color: var(--muted); }
.board-col__list { display: flex; flex-direction: column; gap: 0.5rem; min-height: 40px; }
.board-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 0.6rem 0.7rem;
  cursor: grab; display: flex; flex-direction: column; gap: 0.4rem; }
.board-card:hover { border-color: var(--border-strong); }
.board-card.is-dragging { opacity: 0.4; }
.board-card__title { font-size: 0.92rem; }
.board-card__meta { display: flex; align-items: center; justify-content: space-between; }
.board-card__due { font-size: 0.78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.25rem; }
.board-card__due .icon { width: 13px; height: 13px; }
.board-add { border: 1px dashed var(--border); background: none; color: var(--muted); border-radius: var(--r);
  padding: 0.4rem; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 0.3rem; justify-content: center; }
.board-add:hover { color: var(--gold); border-color: var(--gold); }
.board-col--new { justify-content: flex-start; }
.board-col__input { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
  padding: 0.4rem 0.6rem; font-size: 0.9rem; }
.board-col__del { margin: 0; }
.dialog-sep { border: 0; border-top: 1px solid var(--border); margin: 1.1rem 0; }
.member-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.member-list li { display: flex; align-items: center; gap: 0.6rem; }
.member-list li > span:nth-child(2) { flex: 1; }
.task-comments { list-style: none; margin: 0 0 0.8rem; padding: 0; display: grid; gap: 0.6rem; max-height: 220px; overflow-y: auto; }
.task-comments li { font-size: 0.88rem; border-left: 2px solid var(--border); padding-left: 0.6rem; }
.task-comments .comment-meta { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.15rem; }
@media (max-width: 700px) { .board-col { flex-basis: 220px; } }

/* Project chat */
.chat-layout { display: flex; gap: 1rem; height: calc(100vh - 220px); min-height: 420px; }
.chat-channels { flex: 0 0 190px; display: flex; flex-direction: column; gap: 0.2rem; overflow-y: auto;
  border-right: 1px solid var(--border); padding-right: 0.8rem; }
.chat-channel-link { color: var(--text); text-decoration: none; padding: 0.4rem 0.5rem; border-radius: var(--r); font-size: 0.92rem; }
.chat-channel-link:hover { background: var(--surface-3); }
.chat-channel-link.is-active { background: var(--surface-3); color: var(--gold); }
.chat-new-channel { display: flex; gap: 0.3rem; margin-top: 0.5rem; }
.chat-new-channel input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.chat-head h2 { margin: 0; font-size: 1.05rem; }
.chat-messages { list-style: none; margin: 0; padding: 0.5rem 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.7rem; }
.chat-message { position: relative; max-width: 70%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 0.5rem 0.8rem; }
.chat-message.is-own { align-self: flex-end; background: color-mix(in srgb, var(--gold) 14%, var(--surface-2)); }
.chat-message__meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.15rem; }
.chat-message__body { white-space: pre-wrap; word-break: break-word; font-size: 0.92rem; }
.chat-message__del { position: absolute; top: 0.3rem; right: 0.3rem; border: 0; background: none; color: var(--muted);
  cursor: pointer; opacity: 0; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 4px; }
.chat-message:hover .chat-message__del { opacity: 1; }
.chat-message__del:hover { color: #F08A86; background: var(--surface-3); }
.chat-message__del .icon { width: 13px; height: 13px; }
.chat-compose { display: flex; gap: 0.6rem; align-items: flex-end; margin-top: 0.5rem; }
.chat-compose textarea { flex: 1; min-height: 44px; max-height: 140px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); padding: 0.5rem 0.7rem; font: inherit; resize: vertical; }
@media (max-width: 760px) { .chat-layout { flex-direction: column; height: auto; }
  .chat-channels { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 0.6rem; }
  .chat-messages { max-height: 50vh; } }
