:root {
  color-scheme: light;
  --bg: #f6f7fb; --panel: #ffffff; --panel-2: #f1f2f8; --line: #e4e6ef; --text: #1b1d2a; --muted: #6b7088;
  --accent: #4f46e5; --accent-2: #eef0ff; --accent-text: #ffffff;
  --green: #12805c; --green-bg: #e3f6ee; --amber: #9a6700; --amber-bg: #fff4d6; --red: #c0262d; --red-bg: #fde8e8;
  --blue: #1d5fd1; --blue-bg: #e6efff; --violet: #6d3fd0; --violet-bg: #efe8ff;
  --shadow: 0 1px 2px rgba(20,22,40,.06), 0 4px 14px rgba(20,22,40,.06);
  --radius: 12px; --side: 264px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #11131c; --panel: #181b27; --panel-2: #1f2331; --line: #2a2f42; --text: #e8eaf4; --muted: #9096b0;
    --accent: #7c75ff; --accent-2: #232650; --accent-text: #0f1020;
    --green: #4cd2a0; --green-bg: #12302a; --amber: #f0c04a; --amber-bg: #3a2f10; --red: #ff7b80; --red-bg: #3b1a1d;
    --blue: #7fb0ff; --blue-bg: #172a4d; --violet: #b69bff; --violet-bg: #2a1f4d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11131c; --panel: #181b27; --panel-2: #1f2331; --line: #2a2f42; --text: #e8eaf4; --muted: #9096b0;
    --accent: #7c75ff; --accent-2: #232650; --accent-text: #0f1020;
    --green: #4cd2a0; --green-bg: #12302a; --amber: #f0c04a; --amber-bg: #3a2f10; --red: #ff7b80; --red-bg: #3b1a1d;
    --blue: #7fb0ff; --blue-bg: #172a4d; --violet: #b69bff; --violet-bg: #2a1f4d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; } .grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; } .gap-s { gap: 6px; } .gap-l { gap: 18px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; }
.btn.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:checked) { background: var(--accent-2); border-color: var(--accent); }

/* layout */
.app { display: flex; height: 100dvh; }
.side { width: var(--side); flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.side .brand { padding: 16px 16px 10px; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 15px; }
.side nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 5px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.nav-h button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; }
.nav-h button:hover { color: var(--accent); }
.nav-a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; color: var(--text); cursor: pointer; }
.nav-a:hover { background: var(--panel-2); text-decoration: none; }
.nav-a.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.nav-a .ico { width: 20px; text-align: center; flex: none; }
.badge { margin-left: auto; background: var(--accent); color: var(--accent-text); border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.dot.on { background: #22c55e; box-shadow: 0 0 0 1px #22c55e; }
.side .me { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.topbar { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.page { flex: 1; overflow: auto; padding: 26px 30px 40px; }
.page.flush { padding: 0; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow h1 { margin-bottom: 3px; }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; } .avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatars { display: flex; } .avatars .avatar { margin-left: -7px; border: 2px solid var(--panel); } .avatars .avatar:first-child { margin-left: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat { padding: 14px 16px; } .stat b { display: block; font-size: 26px; line-height: 1.1; } .stat span { color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill.todo { background: var(--panel-2); color: var(--muted); }
.pill.doing { background: var(--blue-bg); color: var(--blue); }
.pill.review { background: var(--amber-bg); color: var(--amber); }
.pill.changes { background: var(--red-bg); color: var(--red); }
.pill.approved { background: var(--green-bg); color: var(--green); }
.pill.overdue { background: var(--red-bg); color: var(--red); }
.pill.soon { background: var(--amber-bg); color: var(--amber); }
.prio { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
.prio.high { background: var(--red); } .prio.low { background: var(--blue); }

/* task rows */
.list { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.trow:first-child { border-top: 0; } .trow:hover { background: var(--panel-2); }
.trow .t { font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 30px; background: var(--panel); overflow-x: auto; flex: none; }
.tab { padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.proj-head { padding: 20px 30px 6px; background: var(--panel); flex: none; }

/* board */
.board { flex: 1; display: flex; gap: 14px; padding: 20px 30px 30px; overflow: auto; align-items: flex-start; }
.col { width: 290px; flex: none; background: var(--panel-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 100%; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-weight: 650; font-size: 13.5px; }
.col-h .n { color: var(--muted); font-weight: 500; }
.col-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 20px; }
.tcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(20,22,40,.05); }
.tcard:hover { border-color: var(--accent); }
.tcard.dragging { opacity: .45; }
.tcard .t { font-weight: 600; margin-bottom: 8px; word-break: break-word; }
.tcard .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.quick { border: 1px dashed var(--line); background: transparent; border-radius: 10px; padding: 8px; color: var(--muted); cursor: pointer; text-align: left; }
.quick:hover { color: var(--accent); border-color: var(--accent); }

/* table */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--panel-2); }

/* drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(10,12,24,.45); z-index: 40; display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.drawer { width: min(720px, 100%); height: 100%; background: var(--panel); display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.25); }
.drawer-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.modal { width: min(520px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal-h { padding: 16px 20px 0; } .modal-b { padding: 16px 20px; } .modal-f { padding: 0 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fields label.field { margin: 0; }
.title-input { font-size: 19px; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 6px 8px; margin: -6px -8px; }
.title-input:hover { border-color: var(--line); }
.banner { padding: 12px 14px; border-radius: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.review { background: var(--amber-bg); color: var(--amber); }
.banner.changes { background: var(--red-bg); color: var(--red); }
.banner.approved { background: var(--green-bg); color: var(--green); }
.copybox { display: flex; gap: 8px; } .copybox input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* chat */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; position: relative; }
.chat.boxed { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); height: min(520px, 70vh); flex: none; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; }
.msg { display: flex; gap: 10px; padding: 5px 0; } .msg.cont { padding: 0 0 0 40px; }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-weight: 650; margin-right: 8px; } .msg .when { color: var(--muted); font-size: 12px; }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.msg .del { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.msg:hover .del { opacity: 1; } .msg .del:hover { color: var(--red); }
.sysmsg { text-align: center; color: var(--muted); font-size: 12.5px; padding: 6px 0; }
.sysmsg b { color: var(--text); font-weight: 600; }
.filecard { margin-top: 5px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; max-width: 460px; background: var(--panel-2); }
.filecard .fname { font-weight: 600; word-break: break-all; }
.filecard video { aspect-ratio: 16 / 9; }
.filecard video, .filecard img { width: 100%; max-height: 300px; border-radius: 8px; margin-top: 8px; background: #000; display: block; object-fit: contain; }
.filecard audio { width: 100%; margin-top: 8px; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; align-items: flex-end; background: var(--panel); border-radius: 0 0 var(--radius) var(--radius); }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; }
.dropzone { position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 2px dashed var(--accent); border-radius: inherit; display: none; place-items: center; font-weight: 700; color: var(--accent); z-index: 5; pointer-events: none; }
.chat.drag .dropzone { display: grid; }
.upload-cta { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; cursor: pointer; color: var(--muted); }
.upload-cta:hover, .upload-cta.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-2); }
.upload-cta b { color: var(--text); display: block; }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; }
.toast.err { background: var(--red); color: #fff; }
.toast .bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin-top: 7px; overflow: hidden; }
.toast .bar i { display: block; height: 100%; background: #fff; width: 0; transition: width .2s; }

/* auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(400px, 100%); padding: 28px; }
.auth h1 { margin: 14px 0 4px; }
.err-text { color: var(--red); font-size: 13.5px; min-height: 20px; margin: 4px 0 10px; }

/* mobile */
@media (max-width: 860px) {
  .side { position: fixed; z-index: 30; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; width: min(300px, 86vw); box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .topbar { display: flex; }
  .page { padding: 18px 16px 40px; }
  .proj-head, .tabs { padding-left: 16px; padding-right: 16px; } .board { padding: 14px 16px 24px; }
  .col { width: 262px; }
  .grid.cols-2, .fields { grid-template-columns: minmax(0, 1fr); }
  .trow { flex-wrap: wrap; row-gap: 6px; }
  .trow .grow { flex-basis: 55%; }
  .page-head .btn { flex: none; }
  .overlay.center { align-items: flex-end; padding: 0; }
  .overlay.center .modal { border-radius: 16px 16px 0 0; }
  .drawer { width: 100%; }
  .tbl .hide-m { display: none; }
}

/* ── planner additions ── */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--text); max-width: 100%; }
.chip.plain { color: var(--muted); font-weight: 500; }
.cdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.pill.pub { background: var(--accent-2); color: var(--accent); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 30px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.toolbar select { width: auto; padding: 5px 10px; font-size: 13.5px; }
.toolbar .check { padding: 4px 10px; font-size: 13px; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.col.ghost { background: transparent; border: 2px dashed var(--line); }
.col-h b { font-size: 14px; }
.tbl tr.grp td { background: var(--panel-2); font-weight: 700; font-size: 13px; padding: 7px 16px; }
.popmenu { position: fixed; z-index: 90; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 180px; display: flex; flex-direction: column; }
.popmenu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.popmenu button:hover { background: var(--panel-2); } .popmenu button.danger { color: var(--red); }

/* calendar */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav h2 { margin-left: 8px; font-size: 20px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); } .legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--panel); }
.cal-dow { border-radius: 12px 12px 0 0; } .cal-dow div { padding: 8px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 118px; padding: 4px 5px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.other { background: var(--panel-2); opacity: .7; }
.cal-cell.over { background: var(--accent-2); outline: 2px dashed var(--accent); outline-offset: -2px; }
.cal-d { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0 3px; min-height: 22px; }
.cal-cell.today .cal-d span { background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 0 7px; }
.cal-add { opacity: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 3px; }
.cal-cell:hover .cal-add { opacity: 1; }
.cchip { display: block; font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 6px; border-left: 3px solid transparent; background: var(--panel-2); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-decoration: none; }
.cchip:hover { filter: brightness(1.08); text-decoration: none; }
.cchip.pub { font-weight: 600; } .cchip.due { background: transparent; border: 1px dashed var(--line); border-left-width: 1px; color: var(--muted); }
.cchip.due.done { text-decoration: line-through; opacity: .6; }
.cchip.vid { background: var(--green-bg); color: var(--green); border-left-color: var(--green); } .cchip.vid .cdot { margin-right: 4px; }
.cal-more { border: 0; background: none; text-align: left; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0 4px; font-weight: 600; }
.daylist { display: flex; flex-direction: column; gap: 6px; } .daylist .cchip { font-size: 14px; padding: 7px 10px; white-space: normal; }

/* card drawer */
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin: 6px 0 8px; } .progress i { display: block; height: 100%; background: var(--green); }
.ck { display: flex; align-items: center; gap: 9px; padding: 5px 0; } .ck input { accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.ck .done { text-decoration: line-through; color: var(--muted); }
.ck .del { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; } .ck:hover .del { opacity: 1; } .ck .del:hover { color: var(--red); }
.ck-add { margin-top: 6px; }
.vlink { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel-2); }
.vlink:hover { text-decoration: none; border-color: var(--accent); } .vlink img { width: 120px; border-radius: 6px; flex: none; }

/* channels */
.chan .cavatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.chan .stat b { font-size: 22px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.vcard { color: var(--text); display: block; } .vcard:hover { text-decoration: none; } .vcard img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--panel-2); display: block; }
.vcard .vt { font-size: 13px; font-weight: 600; margin: 5px 0 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
input[type=color] { width: 56px; height: 38px; padding: 3px; cursor: pointer; }

@media (max-width: 860px) {
  .toolbar { padding: 8px 16px; }
  .cal-cell { min-height: 84px; padding: 3px; } .cchip { font-size: 10.5px; padding: 1px 4px; } .cal-dow div { padding: 6px 3px; font-size: 10px; text-align: center; }
  .cal-add { display: none; } .legend { display: none; }
}
.chan .grid.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chan .stat { padding: 10px 12px; } .chan .stat span { font-size: 12px; }

/* ── color coding ── */
.btn.primary { background: linear-gradient(135deg, var(--accent), #8b5cf6); border-color: transparent; }
.logo { background: linear-gradient(135deg, #4f46e5, #ec4899); }
.pdot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.nav-a.on { box-shadow: inset 3px 0 0 var(--accent); }
.col { border-top: 4px solid var(--c, var(--line)); background: color-mix(in srgb, var(--c, #888) 8%, var(--panel-2)); }
.col .col-h .n { background: color-mix(in srgb, var(--c, #888) 20%, transparent); color: var(--c, var(--muted)); border-radius: 999px; padding: 0 8px; font-weight: 700; font-size: 12px; }
.col .col-h b { color: var(--text); }
.col.ghost { border-top-color: var(--line); background: transparent; }
.tcard { border-left: 4px solid var(--c, var(--line)); }
.trow.st { border-left: 4px solid var(--c); }
.stat.colored { border-top: 4px solid var(--c); } .stat.colored b { color: var(--c); }
.tbl tr.grp td { border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c, #888) 11%, var(--panel-2)); }
.cal-cell.wknd { background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.cal-cell.other.wknd { background: var(--panel-2); }
.pill.doing { background: var(--blue-bg); color: var(--blue); }
.tcard:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--c, #888) 30%, transparent); }

/* ── responsive ── */
@media (min-width: 1600px) { .page:not(.flush) > * { max-width: 1480px; margin-left: auto; margin-right: auto; } }
@media (max-width: 1100px) { :root { --side: 232px; } .page { padding: 22px 22px 40px; } .proj-head, .tabs, .toolbar { padding-left: 22px; padding-right: 22px; } .board { padding-left: 22px; } }
@media (max-width: 860px) {
  .board { scroll-snap-type: x proximity; gap: 10px; } .col { width: 82vw; max-width: 330px; scroll-snap-align: start; }
  .topbar { position: sticky; top: 0; z-index: 20; }
  .drawer-b { padding: 14px; } .drawer-h { padding: 10px 14px; }
  .page-head h1 { font-size: 20px; }
  .composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .msgs { padding: 12px; }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj-head .row.wrap { row-gap: 8px; }
}
@media (min-width: 561px) and (max-width: 860px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cal-nav h2 { font-size: 17px; flex-basis: 100%; order: -1; margin: 0 0 4px; } .toolbar select { max-width: 150px; } }
@media (pointer: coarse) {
  .btn { min-height: 40px; } .btn.sm { min-height: 36px; }
  input[type=text], input[type=email], input[type=password], input[type=date], select, textarea { font-size: 16px; min-height: 42px; }
  .nav-a { padding: 10px 9px; } .tab { padding: 12px 14px; }
}

/* ── analytics dashboard ── */
.stats4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat.big { padding: 18px 20px 14px; text-align: center; }
.stat.big .lab { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.stat.big b { font-size: 46px; font-weight: 500; line-height: 1.15; display: block; }
.stat.big .fl { color: var(--accent); margin-top: 8px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.chart-card { overflow: hidden; }
.chart-card h3 { padding: 16px 20px 0; font-size: 15px; color: var(--text); font-weight: 650; }
.chart-card .cb { padding: 10px 20px 14px; }
.chart-card.flushbody .cb { padding: 8px 0 0; }
.chart-card.flushbody .list { border: 0; }
.chart-card .cf { border-top: 1px solid var(--line); padding: 10px 20px; font-size: 13px; color: var(--accent); }
svg.chart, svg.donut { width: 100%; height: auto; display: block; }
svg.donut { width: 190px; flex: none; }
svg text { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg text.val { fill: var(--text); font-weight: 700; } svg text.center { fill: var(--text); font-size: 30px; font-weight: 500; }
svg .gl { stroke: var(--line); stroke-width: 1; }
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.legend-col { display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.legend-col i, .legend-row i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 7px; vertical-align: -1px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.hbar { display: flex; align-items: center; gap: 10px; margin: 11px 0; }
.hbar .who { width: 120px; flex: none; font-size: 14px; }
.hbar .track { flex: 1; height: 14px; background: var(--panel-2); border-radius: 7px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 7px; }
@media (max-width: 1100px) { .stats4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .stat.big b { font-size: 36px; } .hbar .who { width: 84px; } svg.donut { width: 160px; } }

/* ── goals, agenda, covers ── */
.goal { cursor: pointer; border-left: 5px solid var(--c); } .goal:hover { box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 28%, transparent); }
.goal .t { font-weight: 650; font-size: 16px; }
.gbar { flex: 1; height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; } .gbar i { display: block; height: 100%; border-radius: 6px; transition: width .4s; }
.pct { min-width: 42px; text-align: right; }
.kr-line { display: flex; gap: 10px; font-size: 13.5px; padding: 2px 0; }
.stat.colored.on { background: color-mix(in srgb, var(--c) 12%, var(--panel)); }
.kr { padding: 12px 0; border-top: 1px solid var(--line); } .kr:first-of-type { border-top: 0; }
.kr-val { display: flex; align-items: baseline; gap: 2px; white-space: nowrap; } .kr-in { width: 70px; padding: 4px 8px; text-align: right; font-weight: 700; }
.agenda { max-width: 760px; } .ag-day { padding: 12px 0; border-top: 1px solid var(--line); } .ag-day:first-child { border-top: 0; }
.ag-h { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; font-size: 15px; } .ag-h b { font-size: 16px; }
.tcard .cover { display: block; width: calc(100% + 24px); margin: -11px -12px 9px; height: 104px; object-fit: cover; border-radius: 6px 6px 0 0; background: var(--panel-2); }

/* ── inbox + rules ── */
.quickbtn { width: 100%; justify-content: space-between; margin-bottom: 6px; background: var(--accent-2); border-color: transparent; color: var(--accent); }
.quickbtn kbd { font: 600 11px ui-monospace, Menlo, monospace; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--green); } .switch input:checked + i::after { transform: translateX(18px); }
.rule { border-left: 5px solid var(--green); } .rule.off { border-left-color: var(--line); opacity: .65; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tpl { text-align: left; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.tpl:hover { border-color: var(--accent); background: var(--accent-2); }
.ruleblock { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin-bottom: 14px; background: var(--panel-2); }
.ruleblock:last-child { padding-bottom: 14px; } .rb-h { font-weight: 700; margin-bottom: 10px; }
.act { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; flex-wrap: wrap; } .act-t { width: 100%; } .act .grow { flex-basis: 70%; }
.act textarea { width: 100%; margin-top: 6px; }

/* ── complete / delete controls ── */
.btn.dangerfill { background: var(--red); border-color: var(--red); color: #fff; } .btn.dangerfill:hover { filter: brightness(1.1); }
.extra-wrap { display: flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }
.tcard { position: relative; }
.tcard .t { display: flex; align-items: flex-start; gap: 8px; padding-right: 22px; }
.tcard .t.done .tt { text-decoration: line-through; color: var(--muted); }
.ccheck { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: transparent; flex: none; margin-top: 2px; cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 11px; line-height: 1; padding: 0; }
.ccheck:hover { border-color: var(--green); background: var(--green-bg); } .ccheck.on { background: var(--green); border-color: var(--green); }
.cmore { position: absolute; top: 6px; right: 6px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; opacity: 0; }
.tcard:hover .cmore, .cmore:focus { opacity: 1; } .cmore:hover { background: var(--panel-2); color: var(--text); }
@media (pointer: coarse) { .cmore { opacity: 1; } .ccheck { width: 22px; height: 22px; } }

/* ── invoices ── */
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bigamt { font-size: 34px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.money { display: flex; align-items: center; gap: 6px; } .money span { font-weight: 700; color: var(--muted); }
.wisehelp { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-top: 4px; }
.paybox { border: 2px solid var(--accent); border-radius: 12px; padding: 14px 16px; background: var(--accent-2); }
.stat.colored.on { background: color-mix(in srgb, var(--c) 12%, var(--panel)); }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.hbar .track { display: flex; }

/* ── bonuses ── */
.vthumb { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--panel-2); display: block; flex: none; }
.award-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.totalline { background: var(--accent-2); border-radius: 10px; padding: 10px 14px; margin: 4px 0 14px; color: var(--text); } .totalline .tiny { color: var(--muted); margin-top: 2px; }
.breakdown { background: var(--panel-2); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 560px) { .vthumb { width: 92px; } }

/* ── theme switch ── */
.theme-btn { font-size: 16px; padding: 4px 8px; }
.auth-theme { position: fixed; top: 14px; right: 14px; z-index: 5; }
.themeseg { display: inline-flex; background: var(--panel-2); border-radius: 9px; padding: 3px; gap: 2px; }
.themeseg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.themeseg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.checks.col { flex-direction: column; align-items: stretch; margin-top: 4px; }
.check.wide { border-radius: 12px; align-items: flex-start; padding: 10px 14px; } .check.wide input { margin-top: 4px; }

/* ── sidebar project menu + drag to reorder ── */
.nav-row { position: relative; border-radius: 8px; }
.nav-row .nav-more { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: var(--panel); color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 17px; line-height: 1; padding: 2px 7px; opacity: 0; box-shadow: 0 0 0 1px var(--line); }
.nav-row:hover .nav-more, .nav-row .nav-more:focus { opacity: 1; } .nav-row:hover .badge { visibility: hidden; }
.nav-row .nav-more:hover { color: var(--text); background: var(--panel-2); }
.nav-row.dragging { opacity: .4; }
.nav-row.over-top::before, .nav-row.over-bottom::after { content: ''; position: absolute; left: 6px; right: 6px; height: 3px; background: var(--accent); border-radius: 2px; z-index: 2; }
.nav-row.over-top::before { top: -2px; } .nav-row.over-bottom::after { bottom: -2px; }
@media (pointer: coarse) { .nav-row .nav-more { opacity: 1; } .nav-row .badge { visibility: hidden; } }

/* ══════════ ArcFlow ══════════ */
.brand { padding: 14px 14px 8px; gap: 10px; }
.brandtxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
#brandname { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brandtag { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .02em; }
.logosvg { flex: none; display: block; border-radius: 9px; }
.nav-a .cnt { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px; }
.nav-a.on .cnt { color: var(--accent); }
.nav-a .cnt + .badge { margin-left: 4px; }
.nav-h { padding-top: 12px; }

/* the flow (pipeline funnel) */
.flow { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding-bottom: 4px; }
.flow-step { flex: 1 0 86px; min-width: 86px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; background: color-mix(in srgb, var(--c, #888) 11%, var(--panel-2)); border-top: 3px solid var(--c, #888); color: var(--text); text-decoration: none; }
.flow-step:hover { text-decoration: none; background: color-mix(in srgb, var(--c, #888) 20%, var(--panel-2)); }
.flow-step.empty { opacity: .55; }
.fs-n { font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--c); } .fs-l { font-size: 12px; font-weight: 600; color: var(--muted); }
.flow-arrow { align-self: center; padding: 0 3px; color: var(--muted); font-size: 20px; flex: none; }
.chgrid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.chcard { color: var(--text); text-decoration: none; border-left: 5px solid var(--c); display: block; } .chcard:hover { text-decoration: none; box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 28%, transparent); }
.chmini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 12px; text-align: center; }
.chmini b { display: block; font-size: 18px; } .chmini span { font-size: 11px; color: var(--muted); } .chmini .z { opacity: .4; }

/* pipeline rows */
.prow { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); border-left: 4px solid var(--c, var(--line)); cursor: pointer; flex-wrap: wrap; }
.prow:first-child { border-top: 0; } .prow:hover { background: var(--panel-2); }
.prow-main { flex: 1 1 320px; min-width: 0; } .prow-t { display: flex; align-items: center; gap: 8px; } .prow-t .t { font-weight: 650; }
.prow-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill.sm { font-size: 11px; padding: 1px 8px; }

/* card pane: stepper, tabs, docs */
.flowbar { background: var(--panel-2); border-radius: 12px; padding: 12px 14px; }
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.step { flex: 1 0 auto; min-width: 70px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding-top: 4px; }
.step i { display: block; height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 5px; }
.step.done i { background: color-mix(in srgb, var(--c) 55%, var(--line)); } .step.done { color: var(--text); }
.step.cur i { background: var(--c); height: 8px; margin-top: -1px; } .step.cur { color: var(--c); }
.dtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-top: 4px; }
.dtab { padding: 9px 13px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dtab:hover { text-decoration: none; color: var(--text); } .dtab.on { color: var(--accent); border-bottom-color: var(--accent); }
.panel-stack { display: flex; flex-direction: column; gap: 16px; }
.docarea { width: 100%; min-height: 260px; resize: vertical; line-height: 1.65; font-size: 15px; padding: 14px 16px; }
.docarea.serif { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; font-size: 16.5px; line-height: 1.75; }
.doclinks { margin-top: 8px; padding: 8px 12px; background: var(--panel-2); border-radius: 8px; }
.docpreview { white-space: pre-wrap; word-break: break-word; max-height: 55vh; overflow: auto; font-family: Georgia, serif; line-height: 1.7; }

/* channel + animators */
.person .pstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 10px 0 8px; }
.person .pstats b { display: block; font-size: 20px; } .person .pstats span { font-size: 11.5px; color: var(--muted); } .person .pstats .bad b { color: var(--red); }
.pgrid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* assets */
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.asset { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); } .asset:hover { border-color: var(--accent); }
.athumb { position: relative; aspect-ratio: 16 / 10; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; } .athumb img { width: 100%; height: 100%; object-fit: cover; }
.aicon { font-size: 40px; } .abadge { position: absolute; top: 6px; left: 6px; background: #f59e0b; color: #1b1d2a; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.ainfo { padding: 9px 11px 11px; }
.assetview { width: 100%; max-height: 52vh; border-radius: 10px; background: #000; object-fit: contain; display: block; }

/* messages hub */
.msgs-layout { flex-direction: row; min-height: 0; }
.conv-list { width: 310px; flex: none; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.conv-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 10px; }
.conv-items { flex: 1; overflow-y: auto; padding: 0 6px 12px; }
.conv-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 4px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.conv-add { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; } .conv-add:hover { color: var(--accent); }
.conv { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); } .conv:hover { background: var(--panel-2); text-decoration: none; } .conv.on { background: var(--accent-2); }
.convico { width: 30px; height: 30px; border-radius: 9px; background: var(--panel-2); display: grid; place-items: center; font-weight: 700; flex: none; }
.convav { position: relative; display: inline-flex; flex: none; } .convav .dot { position: absolute; right: -2px; bottom: -2px; }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); flex: none; }
.back-m { display: none; font-size: 22px; }
@media (max-width: 860px) {
  .msgs-layout .conv-list { width: 100%; border-right: 0; }
  .msgs-layout.open .conv-list { display: none; } .msgs-layout:not(.open) .conv-main { display: none; }
  .back-m { display: inline-flex; }
  .flow-step { flex-basis: 74px; min-width: 74px; } .prow { padding: 12px; } .person .pstats { grid-template-columns: repeat(2, 1fr); }
}
.stagepick{margin:10px 0 0;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--bg2,transparent)}
.stagepick summary{cursor:pointer;font-weight:600}
/* attachments (Trello-style) */
.attach .att{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--line)}
.attach .att:first-child{border-top:0}
.att-i{font-size:22px;width:30px;text-align:center;flex:none}
.att-t a{font-weight:600}
.swatch{width:36px;height:36px;border-radius:10px;border:3px solid transparent;cursor:pointer}
.swatch.on{border-color:var(--text)}
.hidden{display:none!important}
a.brand{color:inherit;text-decoration:none;cursor:pointer}
a.brand:hover{opacity:.85}
.vcol{width:86px;text-align:right;flex:none;font-variant-numeric:tabular-nums}
.vhead{cursor:default}
