/* styles.css — Divyakar Studio. Bold, airy, playful, editorial.
   Inter type · indigo accent · big whitespace · soft rounded surfaces.
   Reference feel: catlabs.studio / askcatgpt.com + Linear-grade craft. */

:root {
  --bg: #f4f4f7;
  --bg-tint: #eef0fb;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --border: #ececf1;
  --border-2: #e0e0e8;
  --ink: #0c0c10;
  --ink-2: #3a3a44;
  --muted: #76767f;
  --faint: #a6a6b0;

  --accent: #1625b0;
  --accent-2: #2f3fd6;
  --accent-soft: #eaecfc;
  --lav: #d9ddf8;

  --ok: #0c8a44;
  --ok-soft: #e6f6ec;
  --warn: #b5730a;
  --warn-soft: #fcf2df;
  --orange: #d9641a;
  --orange-soft: #fcebdd;
  --teal: #138a78;
  --teal-soft: #e0f4f0;
  --rose: #c8326b;
  --danger: #d23b3b;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-lg: 24px;
  --r: 18px;
  --r-sm: 12px;
  --r-xs: 9px;
  --shadow-sm: 0 1px 2px rgba(16,16,40,.04), 0 4px 14px -8px rgba(16,16,40,.14);
  --shadow: 0 2px 6px rgba(16,16,40,.05), 0 24px 60px -24px rgba(16,16,40,.28);
  --ring: 0 0 0 4px rgba(22,37,176,.15);
  --ease: cubic-bezier(.22,.68,.18,1);
  --side-w: 264px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  letter-spacing: -.005em;
}
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: .6rem; }
code { font-family: var(--mono); font-size: .85em; }
::selection { background: var(--lav); }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: #d6d6df; border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #c2c2cd; }

/* ---- brand ---- */
.wordmark { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: -.02em; }
.wordmark .mark { color: var(--accent); font-size: 1.1em; }
.wordmark .tag { font-family: var(--mono); font-size: .56rem; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: #fff; background: var(--accent); padding: .2rem .45rem; border-radius: 7px; }

/* ---- buttons ---- */
.btn-primary, .btn-ghost, .btn-danger, .btn-soft {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--r-sm); font-weight: 650; border: 1px solid transparent;
  transition: all .18s var(--ease); white-space: nowrap; letter-spacing: -.01em;
}
.btn-primary { background: var(--accent); color: #fff; padding: .7rem 1.25rem; box-shadow: 0 8px 20px -8px rgba(22,37,176,.5); }
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgba(22,37,176,.55); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; transform: none; box-shadow: none; cursor: default; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-2); padding: .62rem 1rem; }
.btn-ghost:hover { background: var(--surface-2); border-color: #d2d2dc; transform: translateY(-1px); }
.btn-soft { background: var(--accent-soft); color: var(--accent); padding: .62rem 1rem; }
.btn-soft:hover { background: var(--lav); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f1cccc; padding: .62rem 1rem; }
.btn-danger:hover { background: #fdf1f1; }
.btn-danger.sm, .btn-ghost.sm, .btn-soft.sm { padding: .38rem .7rem; font-size: 13px; }
.linkbtn { background: none; border: none; color: var(--muted); padding: .25rem .5rem; border-radius: 8px; font-weight: 550; }
.linkbtn:hover { background: var(--surface-2); color: var(--ink); }
.linkbtn.danger:hover { color: var(--danger); background: #fdf1f1; }

/* ---- fields ---- */
.field { display: flex; flex-direction: column; gap: .4rem; font-size: 13px; color: var(--muted); font-weight: 550; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
textarea, select, .input {
  background: var(--surface); border: 1.5px solid var(--border-2); border-radius: var(--r-sm);
  padding: .7rem .85rem; color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }

/* ---- status pills ---- */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .26rem .7rem; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: #f0f0f4; color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.brief, .pill.needs_review { color: var(--muted); }
.pill.in_progress { color: var(--accent); background: var(--accent-soft); }
.pill.in_review { color: var(--warn); background: var(--warn-soft); }
.pill.revisions, .pill.changes_requested { color: var(--orange); background: var(--orange-soft); }
.pill.approved { color: var(--ok); background: var(--ok-soft); }
.pill.delivered { color: var(--teal); background: var(--teal-soft); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #f0f0f4; color: var(--muted); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.dot { color: var(--faint); }

/* ============ AUTH ============ */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem;
  background:
    radial-gradient(900px 600px at 85% -15%, var(--accent-soft), transparent 55%),
    radial-gradient(700px 500px at -10% 115%, var(--teal-soft), transparent 50%); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 2.8rem;
  width: min(420px, 94vw); box-shadow: var(--shadow); }
.auth-card .wordmark { font-size: 1.7rem; margin-bottom: .5rem; }
.auth-card p { color: var(--muted); margin: 0 0 1.6rem; font-size: 1rem; }
.auth-card label { margin-bottom: 1rem; }
.auth-card input { width: 100%; padding: .8rem .9rem; }
.auth-card .btn-primary { width: 100%; margin-top: .5rem; padding: .85rem; font-size: 1rem; }
.error-text { color: var(--danger); font-size: 13.5px; min-height: 1.2rem; }

/* ============ APP SHELL ============ */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1.4rem 1rem;
  display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 0; height: 100vh; }
.sidebar .wordmark { font-size: 1.3rem; padding: .4rem .7rem 1.4rem; }
.nav-item { display: flex; align-items: center; gap: .8rem; padding: .72rem .8rem; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 600; cursor: pointer; transition: all .14s var(--ease); border: none;
  background: none; width: 100%; text-align: left; font-size: 14.5px; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--accent); color: #fff; border-radius: 999px; padding: .08rem .45rem; font-weight: 700; }
.nav-sep { height: 1px; background: var(--border); margin: .7rem .5rem; }
.side-foot { margin-top: auto; padding: .6rem .3rem .2rem; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .45rem; border-radius: var(--r-sm); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.user-chip .who { line-height: 1.25; overflow: hidden; }
.user-chip .who b { display: block; font-size: 13.5px; }
.user-chip .who span { font-size: 11.5px; color: var(--faint); text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1.6rem 2.4rem 1.2rem;
  position: sticky; top: 0; z-index: 10; background: linear-gradient(var(--bg), rgba(244,244,247,.85)); backdrop-filter: blur(6px); }
.topbar h1 { font-size: 1.85rem; }
.topbar .sub { color: var(--muted); font-size: 14.5px; margin-top: -.2rem; }
.content { padding: .6rem 2.4rem 4rem; max-width: 1240px; width: 100%; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.5rem 1.6rem; box-shadow: var(--shadow-sm); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .4rem 0 1.2rem; }
.empty { color: var(--muted); text-align: center; padding: 4rem 1rem; }
.empty .big { font-size: 3rem; margin-bottom: .6rem; }
.empty h2 { color: var(--ink); }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 2rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.4rem 1.5rem; box-shadow: var(--shadow-sm); transition: transform .18s var(--ease); }
.stat:hover { transform: translateY(-3px); }
.stat .num { font-size: 2.5rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: .5rem; font-weight: 550; }
.stat:nth-child(2) .num { color: var(--warn); }
.stat:nth-child(4) .num { color: var(--ok); }

/* ---- board (kanban) ---- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 1.1rem; overflow-x: auto; padding-bottom: .8rem; }
.col { background: transparent; border-radius: var(--r); min-height: 140px; }
.col-head { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 13px; padding: .2rem .5rem 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.col-head .n { font-size: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .5rem; color: var(--muted); }
.col.drop { outline: 2px dashed var(--lav); outline-offset: 4px; border-radius: var(--r); }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0; margin-bottom: .8rem; cursor: pointer; transition: all .16s var(--ease); overflow: hidden; box-shadow: var(--shadow-sm); }
.pcard:hover { border-color: var(--lav); transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard .thumb { height: 96px; background: linear-gradient(135deg, var(--accent-soft), var(--teal-soft)); display: grid; place-items: center; font-size: 1.6rem; color: var(--accent); }
.pcard .body { padding: .85rem 1rem 1rem; }
.pcard h4 { font-size: 15px; margin-bottom: .45rem; }
.pcard .meta { display: flex; flex-wrap: wrap; gap: .45rem; font-size: 12px; color: var(--muted); align-items: center; }

/* ---- list view ---- */
.plist { display: flex; flex-direction: column; gap: .8rem; }
.prow { display: flex; align-items: center; gap: 1.1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem 1.4rem; cursor: pointer; transition: all .15s var(--ease); box-shadow: var(--shadow-sm); }
.prow:hover { border-color: var(--lav); transform: translateY(-2px); box-shadow: var(--shadow); }
.prow .pname { font-weight: 700; font-size: 1.02rem; }
.prow .pmeta { color: var(--muted); font-size: 13px; margin-top: .15rem; }

/* ---- toggle ---- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .25rem; box-shadow: var(--shadow-sm); }
.seg button { border: none; background: none; padding: .42rem .95rem; border-radius: 9px; font-weight: 650; font-size: 13.5px; color: var(--muted); }
.seg button.active { background: var(--accent-soft); color: var(--accent); }

/* ---- table ---- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.tbl td { padding: .9rem .9rem; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }
.role-tag { font-size: 11.5px; font-weight: 700; text-transform: capitalize; padding: .16rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(12,12,20,.42); backdrop-filter: blur(5px); display: grid; place-items: center; z-index: 50; padding: 1rem; animation: fade .18s var(--ease); }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 2rem; width: min(480px, 95vw); box-shadow: var(--shadow); animation: pop .22s var(--ease); max-height: 90vh; overflow: auto; }
.modal-card h3 { font-size: 1.4rem; margin-bottom: 1.2rem; }
.modal-actions { display: flex; gap: .7rem; justify-content: flex-end; margin-top: 1.6rem; }
.form-grid { display: grid; gap: 1rem; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hint { font-size: 13px; color: var(--faint); line-height: 1.5; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 1.6rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: .8rem 1.3rem; border-radius: 999px; z-index: 60; box-shadow: var(--shadow); font-weight: 550; }
.toast { animation: toastin .25s var(--ease); }

/* ---- link row ---- */
.linkrow { display: flex; gap: .5rem; }
.linkrow input { flex: 1; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---- animations ---- */
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px) } to { opacity: 1; transform: none } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px) } to { opacity: 1; transform: translate(-50%,0) } }
@keyframes spin { to { transform: rotate(360deg) } }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--lav); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.center-load { display: grid; place-items: center; padding: 5rem; }
.card-in { animation: pop .3s var(--ease) both; }

/* ---- responsive ---- */
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .22s var(--ease); width: var(--side-w); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar, .content { padding-left: 1.2rem; padding-right: 1.2rem; }
  .form-2 { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }

/* ============ REVIEW SURFACE (portal + embedded) ============ */
body.review { background: var(--bg); }
.rv-topbar { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.4rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.rv-topbar .wordmark { font-size: 1.1rem; }
.rv-project { font-weight: 700; }
.version-select { min-width: 150px; font-size: 13.5px; padding: .5rem .7rem; }
.rv-layout { display: flex; height: calc(100vh - 60px); }
.rv-left { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 1.3rem; gap: 1rem; }
.rv-right { width: 400px; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }

.player { display: flex; flex-direction: column; background: #08080b; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border-2); box-shadow: var(--shadow-sm); }
.player-stage { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.player-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; touch-action: none; }
.overlay.drawing { pointer-events: auto; cursor: crosshair; }
.player-message { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; background: rgba(8,8,11,.72); backdrop-filter: blur(3px); color: #fff; text-align: center; padding: 1.5rem; font-size: 14px; }

.draw-toolbar { position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); display: flex; gap: .3rem; align-items: center; background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 999px; padding: .35rem .5rem; z-index: 5; box-shadow: var(--shadow); }
.draw-toolbar .tool { background: transparent; border: none; color: var(--ink); min-width: 34px; height: 34px; border-radius: 999px; }
.draw-toolbar .tool:hover { background: var(--surface-2); }
.draw-toolbar .tool.active { background: var(--accent); color: #fff; }
.draw-toolbar .tool.done { padding: 0 .9rem; background: var(--accent); color: #fff; font-weight: 600; }
.draw-toolbar .color { width: 30px; height: 30px; padding: 0; border: none; background: none; border-radius: 50%; cursor: pointer; }

.controls { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; background: #101015; }
.ctrl-group { display: flex; align-items: center; gap: .3rem; }
.ctrl { background: transparent; border: none; color: #f0f0f4; width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-sm); transition: all .14s var(--ease); }
.ctrl:hover { background: rgba(255,255,255,.1); }
.ctrl:active { transform: scale(.92); }
.ctrl.play { background: var(--accent); color: #fff; }
.ctrl.play:hover { background: var(--accent-2); }
.tc-wrap { font-family: var(--mono); font-size: 12.5px; margin-left: .4rem; white-space: nowrap; color: #f0f0f4; letter-spacing: -.02em; }
.tc { font-weight: 600; }
.dur { color: #8a8a96; }
.vol { width: 80px; accent-color: var(--accent); }

.scrub { position: relative; flex: 1; height: 18px; display: flex; align-items: center; cursor: pointer; }
.scrub::before { content: ""; position: absolute; left: 0; right: 0; height: 5px; background: rgba(255,255,255,.16); border-radius: 3px; }
.scrub-buffered { position: absolute; height: 5px; background: rgba(255,255,255,.28); border-radius: 3px; width: 0; }
.scrub-fill { position: absolute; height: 5px; background: linear-gradient(90deg, var(--accent), #5b6cf0); border-radius: 3px; width: 0; }
.scrub-handle { position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 50%; transform: translateX(-50%); box-shadow: 0 0 0 4px rgba(22,37,176,.4); }
.scrub:hover .scrub-handle { transform: translateX(-50%) scale(1.15); }
.scrub-markers { position: absolute; left: 0; right: 0; height: 100%; }
.marker { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 11px; height: 11px; background: var(--warn); border: 2px solid #101015; border-radius: 50%; padding: 0; cursor: pointer; transition: transform .12s var(--ease); }
.marker:hover { transform: translate(-50%,-50%) scale(1.4); }
.marker.resolved { background: var(--ok); }

.approval-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.approval-bar .status-label { font-weight: 650; font-size: 13px; padding: .4rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-2); color: var(--muted); }
.approval-bar .status-label.approved { color: var(--ok); }
.approval-bar .status-label.changes_requested { color: var(--orange); }
.approval-bar .approve, .approval-bar .changes { border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); padding: .55rem 1rem; border-radius: var(--r-sm); font-weight: 650; transition: all .16s var(--ease); }
.approval-bar .approve:hover { border-color: var(--ok); color: var(--ok); transform: translateY(-1px); }
.approval-bar .changes:hover { border-color: var(--orange); color: var(--orange); transform: translateY(-1px); }
.approval-bar .approve.active { background: var(--ok); color: #fff; border-color: var(--ok); }
.approval-bar .changes.active { background: var(--orange); color: #fff; border-color: var(--orange); }

.panel-head { padding: 1.1rem 1.3rem .6rem; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1.15rem; }
.panel-head-top { display: flex; align-items: center; justify-content: space-between; }
.filters { display: flex; gap: .35rem; margin-top: .7rem; }
.filter { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); padding: .3rem .8rem; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.filter:hover { color: var(--ink); }
.filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.export-menu { position: relative; }
.export-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); width: 36px; height: 32px; border-radius: var(--r-sm); font-size: 18px; line-height: 1; }
.export-btn:hover { background: var(--surface); border-color: var(--border-2); }
.export-dropdown { position: absolute; right: 0; top: 40px; z-index: 30; width: 260px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm); box-shadow: var(--shadow); padding: .4rem; animation: pop .16s var(--ease); }
.export-item { display: flex; align-items: center; justify-content: space-between; width: 100%; background: transparent; border: none; color: var(--ink); padding: .6rem .65rem; border-radius: var(--r-xs); text-align: left; }
.export-item:hover { background: var(--surface-2); }
.export-ext { color: var(--faint); font-family: var(--mono); font-size: 10.5px; font-weight: 600; }
.export-sep { height: 1px; background: var(--border); margin: .35rem .25rem; }
.export-note { color: var(--faint); font-size: 11.5px; padding: .4rem .65rem .25rem; line-height: 1.45; }

.comment-list { flex: 1; overflow-y: auto; padding: .7rem .8rem; }
.comment { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .8rem .9rem; margin-bottom: .6rem; cursor: pointer; transition: all .15s var(--ease); }
.comment:hover { border-color: var(--border-2); transform: translateX(2px); }
.comment.active { border-color: var(--accent); box-shadow: var(--ring); }
.comment.reply { margin-left: 1.6rem; background: var(--surface); }
.comment.resolved { opacity: .58; }
.comment.resolved .c-body { text-decoration: line-through; text-decoration-color: var(--faint); }
.c-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.c-name { font-weight: 650; font-size: 13.5px; }
.c-time { font-size: 11.5px; margin-left: auto; color: var(--faint); }
.chip { background: var(--accent); color: #fff; border: none; font-family: var(--mono); font-size: 11px; font-weight: 600; padding: .14rem .5rem; border-radius: 7px; }
.chip:hover { background: var(--accent-2); }
.ann-badge { font-size: 12px; color: var(--orange); }
.c-body { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.c-actions { display: flex; gap: .25rem; margin-top: .5rem; }

.composer { border-top: 1px solid var(--border); padding: .9rem; background: var(--surface); }
.name-wrap { font-size: 12.5px; margin-bottom: .5rem; display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.name-input { padding: .35rem .6rem; }
.comment-input { width: 100%; resize: vertical; min-height: 56px; }
.composer-row { display: flex; align-items: center; gap: .45rem; margin-top: .6rem; }
.pin-btn, .draw-btn { background: var(--surface-2); border: 1px solid var(--border-2); color: var(--muted); padding: .45rem .7rem; border-radius: var(--r-sm); font-family: var(--mono); font-size: 11.5px; }
.draw-btn { font-family: var(--font); font-weight: 600; }
.pin-btn:hover, .draw-btn:hover { color: var(--ink); }
.pin-btn.active { color: var(--ink); border-color: var(--accent); }
.draw-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.send-btn { background: var(--accent); color: #fff; border: none; padding: .55rem 1.2rem; border-radius: var(--r-sm); font-weight: 700; margin-left: auto; }
.send-btn:hover { background: var(--accent-2); }
.send-btn:disabled { opacity: .5; }
.reply-banner { font-size: 12.5px; background: var(--accent-soft); border-radius: 8px; padding: .4rem .6rem; margin-bottom: .5rem; display: flex; gap: .5rem; align-items: center; }

@media (max-width: 860px) {
  .rv-layout { flex-direction: column; height: auto; }
  .rv-right { width: 100%; border-left: none; border-top: 1px solid var(--border); max-height: 70vh; }
}

/* ============ CHAT ============ */
.chat-shell { display: grid; grid-template-columns: 240px 1fr; gap: 0; height: calc(100vh - 150px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
.chan-list { border-right: 1px solid var(--border); padding: .8rem; overflow-y: auto; background: var(--surface-2); }
.chan-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: .3rem .6rem .6rem; font-weight: 700; }
.chan-item { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; border: none; background: none; padding: .55rem .65rem; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; font-size: 14px; }
.chan-item:hover { background: var(--surface); }
.chan-item.active { background: var(--accent-soft); color: var(--accent); }
.chan-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-unread { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; }

.convo { display: flex; flex-direction: column; min-width: 0; }
.convo-head { padding: 1rem 1.4rem; border-bottom: 1px solid var(--border); font-weight: 750; font-size: 1.05rem; }
.msg-scroll { flex: 1; overflow-y: auto; padding: 1.2rem 1.4rem; display: flex; flex-direction: column; gap: .2rem; }
.msg { display: flex; gap: .7rem; padding: .5rem 0; }
.msg.reply { padding-left: .2rem; }
.msg-body { min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: .5rem; }
.msg-head b { font-size: 14px; }
.msg-head .faint { font-size: 11.5px; }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; margin-top: .1rem; }
.thread-toggle { align-self: flex-start; margin: 0 0 .4rem 2.5rem; background: none; border: none; color: var(--accent); font-weight: 600; font-size: 12.5px; padding: .2rem .4rem; border-radius: 7px; }
.thread-toggle:hover { background: var(--accent-soft); }
.thread-toggle.faint { color: var(--faint); font-weight: 500; }
.thread { margin: 0 0 .8rem 2.5rem; padding-left: .9rem; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: .2rem; }
.reply-box { display: flex; gap: .5rem; margin-top: .5rem; }
.reply-box .chat-input { flex: 1; }
.chat-composer { display: flex; gap: .6rem; padding: 1rem 1.4rem; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input { flex: 1; resize: none; min-height: 42px; max-height: 140px; }

/* ============ NOTIFICATIONS + ACTIVITY ============ */
.bell { position: relative; }
.bell-btn { background: var(--surface); border: 1px solid var(--border-2); width: 44px; height: 44px; border-radius: var(--r-sm); font-size: 18px; position: relative; transition: all .15s var(--ease); }
.bell-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.bell-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 19px; height: 19px; padding: 0 4px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.bell-dd { position: absolute; right: 0; top: 54px; width: 350px; max-height: 64vh; overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow); z-index: 40; padding: .5rem; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: .5rem .6rem; }
.notif { display: flex; gap: .6rem; padding: .7rem .6rem; border-radius: var(--r-sm); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--accent-soft); }
.notif .nb { font-size: 13.5px; line-height: 1.4; }
.notif .nt { font-size: 11.5px; color: var(--faint); margin-top: .2rem; }

.act { display: flex; gap: .8rem; padding: .55rem 0; }
.act-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lav); margin-top: .45rem; flex-shrink: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.act-text { font-size: 14px; }
.act-time { font-size: 11.5px; color: var(--faint); margin-top: .1rem; }

@media (max-width: 860px) {
  .bell-dd { width: min(350px, 92vw); }
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chan-list { display: flex; gap: .4rem; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .chan-head { display: none; }
  .convo { min-height: 60vh; }
}

/* ---- Calendar ---------------------------------------------------------- */
.cal-bar { display: flex; align-items: center; gap: .6rem; }
.cal-nav { display: flex; align-items: center; gap: .4rem; }
.cal-title { margin: 0 0 0 .5rem; font-size: 1.15rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--border); gap: 1px; }
.cal-dow { background: var(--surface-2); text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; padding: .5rem 0; }
.cal-cell { background: var(--surface); min-height: 104px; padding: .35rem .4rem; display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; transition: background .12s var(--ease); }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-daynum { color: var(--faint); }
.cal-daynum { font-size: 12.5px; font-weight: 600; color: var(--ink-2); align-self: flex-end; line-height: 1.4;
  width: 22px; height: 22px; text-align: center; }
.cal-cell.today .cal-daynum { background: var(--accent); color: #fff; border-radius: 50%; }
.cal-ev { display: block; width: 100%; text-align: left; border: none; cursor: pointer; font: inherit;
  font-size: 11.5px; font-weight: 550; padding: .18rem .4rem; border-radius: 6px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; color: var(--ink-2); background: #eef0f4; border-left: 3px solid var(--muted); }
.cal-ev:hover { filter: brightness(.97); }
.cal-ev.t-deadline { background: #fdecec; border-left-color: var(--danger); color: #9b2b2b; }
.cal-ev.t-milestone { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent); }
.cal-ev.t-meeting { background: var(--teal-soft); border-left-color: var(--teal); color: var(--teal); }
.cal-ev.t-custom { background: var(--warn-soft); border-left-color: var(--warn); color: var(--warn); }
.cal-ev.due { background: repeating-linear-gradient(45deg, #fdecec, #fdecec 6px, #fbe3e3 6px, #fbe3e3 12px); font-weight: 600; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: .2rem; }
@media (max-width: 860px) {
  .cal-cell { min-height: 72px; }
  .cal-ev span { display: none; }
  .cal-ev { height: 7px; padding: 0; border-radius: 3px; }
  .cal-title { font-size: 1rem; }
}

/* ---- R2 upload -------------------------------------------------------- */
.up-drop { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center;
  border: 2px dashed var(--border-2); border-radius: var(--r-sm); padding: 1.6rem 1rem; color: var(--muted);
  background: var(--surface-2); transition: border-color .12s var(--ease), background .12s var(--ease); }
.up-drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.up-ico { font-size: 1.5rem; line-height: 1; }
.up-file { font-size: 13.5px; padding: .5rem .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.up-bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .15s var(--ease); }

