/* Twick brand: indigo #2E11DF fading to lavender, Space Grotesk, 10px corners (matches twick.e70.net). */
:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --surface-2: #f8f7fd;
  --border: #e4e2ee;
  --text: #242424;
  --muted: #767676;
  --hover: #f0eefb;
  --accent: #2e11df;
  --accent-text: #ffffff;
  --accent-weak: #ece8fe;
  --accent-grad: linear-gradient(170deg, #2e11df 50%, #d1b9ff 100%);
  --outline: #909090;
  --danger: #d83a52;
  --shadow: 0 10px 30px rgba(30, 17, 110, .12), 0 2px 6px rgba(30, 17, 110, .06);
  --radius: 10px;
  --radius-sm: 5px;
  --font: "Space Grotesk", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100e24; --surface: #1a1735; --surface-2: #211d42; --border: #322d5c;
    --text: #eceaf7; --muted: #a29fbe; --hover: #2a2552; --accent: #8f7cff;
    --accent-weak: #2b2461; --outline: #5d5885; --danger: #f06b81;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .light-only { display: none; }
  :root:not([data-theme="light"]) .dark-only { display: inline-block; }
}
:root[data-theme="dark"] {
  --bg: #100e24; --surface: #1a1735; --surface-2: #211d42; --border: #322d5c;
  --text: #eceaf7; --muted: #a29fbe; --hover: #2a2552; --accent: #8f7cff;
  --accent-weak: #2b2461; --outline: #5d5885; --danger: #f06b81;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
.dark-only { display: none; }
:root[data-theme="dark"] .light-only { display: none; }
:root[data-theme="dark"] .dark-only { display: inline-block; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.ic { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.loading, .empty-state { padding: 60px; text-align: center; color: var(--muted); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100vh; }
#main { overflow: auto; min-width: 0; }

#sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.brand-logo { height: 30px; width: auto; }
.brand-tag {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-weak); padding: 3px 8px; border-radius: 99px; margin-top: 3px;
}
.nav-link, .board-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 7px; padding: 7px 10px; color: var(--text);
}
.nav-link:hover, .board-link:hover { background: var(--hover); }
.nav-link.active, .board-link.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 10px 4px; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.cat { font-size: 11.5px; color: var(--muted); padding: 10px 10px 3px; font-weight: 600; }
.board-link .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.board-link .count { margin-left: auto; font-size: 11px; color: var(--muted); }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: 12px; }
.save-state.err { color: var(--danger); font-weight: 600; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--outline); background: var(--surface); border-radius: var(--radius); white-space: nowrap; font-weight: 600;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent-grad); border: 0; color: var(--accent-text); padding: 0 16px; }
.btn.primary:hover { filter: brightness(1.12) saturate(1.05); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border: 0; background: none; border-radius: 6px; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
select, input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="email"], input[type="number"], input:not([type]), textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; outline: none;
}
h1, h2, h3, h4, .board-title, .group-name, .p-title { font-weight: 600; letter-spacing: -.01em; }
select { height: 34px; padding: 0 8px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.mobile-only { display: none; }

/* ---------- page header ---------- */
.page { padding: 26px 32px 60px; max-width: 1280px; }
.page h1 { margin: 0; font-size: 26px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }

.board-header { padding: 20px 28px 0; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; left: 0; z-index: 5; }
.bh-top { display: flex; align-items: center; gap: 10px; }
.board-color { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.board-title { font-size: 22px; font-weight: 700; border: 1px solid transparent !important; background: none !important; padding: 2px 6px !important; min-width: 0; flex: 0 1 auto; width: min(520px, 50vw); }
.board-title:hover { border-color: var(--border) !important; }
.board-title:focus { border-color: var(--accent) !important; }
.board-desc { width: 100%; border: 1px solid transparent !important; background: none !important; color: var(--muted); margin: 2px 0 8px 18px; padding: 3px 6px !important; max-width: 760px; }
.board-desc:hover { border-color: var(--border) !important; }
.bh-bar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; }
.tab { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 9px 12px; border-bottom: 2px solid transparent; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.filters { display: flex; align-items: center; gap: 8px; margin-left: auto; padding-bottom: 8px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 0 9px; height: 34px; background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.search input { border: 0 !important; box-shadow: none !important; padding: 0; width: 160px; background: none; color: var(--text); }
.filters select { max-width: 150px; }

/* ---------- table view ---------- */
.table-wrap { padding: 20px 28px 80px; overflow-x: auto; }
.group { margin-bottom: 30px; min-width: 1180px; }
.group-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.group-head .caret { color: var(--gc); }
.group-head .caret .ic { transition: transform .15s; }
.group-head .caret.collapsed .ic { transform: rotate(-90deg); }
.group-name { font-size: 16px; font-weight: 600; color: var(--gc); border: 1px solid transparent !important; background: none !important; padding: 2px 6px !important; width: auto; min-width: 120px; field-sizing: content; }
.group-name:hover { border-color: var(--border) !important; }
.grid {
  --cols: 6px 26px minmax(260px, 1fr) 76px 150px 128px 132px 132px 170px 110px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.row { display: grid; grid-template-columns: var(--cols); min-height: 38px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row > div { border-right: 1px solid var(--border); display: flex; align-items: center; justify-content: center; min-width: 0; gap: 6px; }
.row > div:last-child { border-right: 0; }
.row > .c-bar { background: var(--gc); border-right: 0; }
.row > .c-drag { border-right: 0; color: var(--muted); cursor: grab; opacity: 0; font-size: 11px; letter-spacing: -2px; user-select: none; }
.row.item:hover > .c-drag { opacity: .8; }
.row > .c-name { justify-content: flex-start; padding: 0 6px 0 4px; }
.row.head { background: var(--surface-2); min-height: 34px; font-size: 12.5px; color: var(--muted); }
.row.head > div { font-weight: 500; }
.row.head .sortable { cursor: pointer; user-select: none; }
.row.head .sortable:hover { color: var(--text); }
.row.item:hover { background: var(--surface-2); }
.row.item.dragging { opacity: .4; }
.row.item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.group.drop-on .grid { outline: 2px dashed var(--accent); }
.row.add > .c-name { grid-column: 3 / -1; border-right: 0; }
.row.summary { min-height: 32px; background: var(--surface-2); }
.row.summary > div { border-right: 0; }
.row.summary .sum-status { padding: 0 8px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.cell-input { border: 1px solid transparent !important; background: none !important; padding: 4px 6px !important; width: 100%; min-width: 0; border-radius: 5px; }
.cell-input:hover { border-color: var(--border) !important; }
.cell-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.cell-input.date { font-size: 12.5px; text-align: center; }
.cell-input.overdue { color: var(--danger); font-weight: 600; }
.add-input { border: 1px solid transparent !important; background: none !important; width: 100%; padding: 4px 6px !important; }
.add-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.open-btn { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 5px; font-size: 12px; flex: none; }
.open-btn:hover { background: var(--accent-weak); color: var(--accent); }
.open-btn.has { color: var(--accent); }
.cell-pill { width: 100%; height: 100%; border: 0; color: #fff; font-weight: 500; font-size: 13px; padding: 0 6px; text-shadow: 0 1px 1px rgba(0,0,0,.12); }
.cell-pill:hover { filter: brightness(1.06); }
.cell-pill.empty { background: transparent; }
.cell-pill.empty:hover { background: var(--hover); }
.row > .c-pill { padding: 0; align-items: stretch; }
.mini-progress { width: 52px; height: 6px; border-radius: 9px; background: var(--hover); overflow: hidden; }
.mini-progress > span { display: block; height: 100%; background: #00c875; }
.sbar { display: flex; width: 100%; height: 18px; border-radius: 4px; overflow: hidden; background: var(--hover); }
.sbar > span { display: block; height: 100%; }
.add-group { margin-top: -8px; }

.pill { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 99px; color: #fff; font-weight: 500; padding: 4px 14px; font-size: 13px; white-space: nowrap; }
.pill.sm { font-size: 11px; padding: 1px 8px; }
.pill.empty { background: var(--hover); color: var(--muted); }

/* avatars */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.empty { background: var(--hover); color: var(--muted); }
.avatar.photo { object-fit: cover; background: var(--hover); display: inline-block; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.photo-row { display: flex; align-items: center; gap: 16px; margin: 4px 0 14px; }
.avatar.empty .ic { width: 14px; height: 14px; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; display: inline-grid; }
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--accent-weak); }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 100; min-width: 190px; max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); padding: 5px;
}
.menu-opt { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; }
.menu-opt:hover, .menu-opt:focus { background: var(--hover); outline: none; }
.menu-opt.danger { color: var(--danger); }
.menu-opt.current { font-weight: 600; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 2px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.menu.colors { display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; padding: 10px; min-width: 0; }
.color-opt { width: 28px; height: 28px; border-radius: 7px; border: 2px solid transparent; }
.color-opt:hover { border-color: var(--text); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; padding: 20px 28px 60px; overflow-x: auto; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kcol.drop-on { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-weight: 600; border-top: 4px solid var(--sc); border-radius: var(--radius) var(--radius) 0 0; }
.kcol-head .count { font-size: 12px; color: var(--muted); background: var(--surface); padding: 0 8px; border-radius: 99px; }
.kcol-body { padding: 4px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kadd { border: 0; background: none; color: var(--muted); padding: 10px; text-align: left; border-radius: 0 0 var(--radius) var(--radius); }
.kadd:hover { color: var(--accent); background: var(--hover); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; }
.card-group { font-size: 11px; font-weight: 600; margin-bottom: 3px; }
.card-title { font-weight: 500; margin-bottom: 8px; word-break: break-word; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent-weak); color: var(--accent); }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.card-meta .due { display: inline-flex; align-items: center; gap: 3px; }
.card-meta .ic { width: 13px; height: 13px; }
.overdue-text { color: var(--danger); font-weight: 600; }

/* ---------- calendar ---------- */
.cal { padding: 18px 28px 60px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h3 { margin: 0 8px; font-size: 18px; min-width: 170px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { padding: 8px 10px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.cal-day { min-height: 116px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { opacity: .45; }
.cal-day.drop-on { background: var(--accent-weak); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--muted); align-self: flex-start; padding: 1px 6px; border-radius: 99px; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.chip-item { font-size: 12px; padding: 3px 7px; border-radius: 5px; background: color-mix(in srgb, var(--sc) 18%, var(--surface)); border-left: 3px solid var(--sc); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-item:hover { filter: brightness(.96); }
.chip-item.done { text-decoration: line-through; opacity: .65; }

/* ---------- timeline ---------- */
.tl { padding: 18px 28px 60px; }
.tl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tl-inner { min-width: 1300px; }
.tl-row { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid var(--border); min-height: 36px; }
.tl-row:last-child { border-bottom: 0; }
.tl-label { padding: 7px 12px; border-right: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; position: sticky; left: 0; background: var(--surface); z-index: 2; }
.tl-label:hover { color: var(--accent); }
.tl-row.group-row .tl-label { font-weight: 600; color: var(--gc); cursor: default; background: var(--surface-2); }
.tl-row.group-row .tl-track { background: var(--surface-2); }
.tl-track { position: relative; }
.tl-days { display: grid; grid-template-columns: repeat(var(--span), 1fr); height: 100%; }
.tl-days > div { border-right: 1px solid color-mix(in srgb, var(--border) 55%, transparent); font-size: 10.5px; color: var(--muted); text-align: center; padding-top: 4px; }
.tl-days > .we { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tl-days > .td { color: var(--accent); font-weight: 700; }
.tl-head .tl-days > div { padding: 4px 0; }
.tl-head .mon { display: block; font-weight: 600; color: var(--text); font-size: 10px; height: 13px; }
.tl-bar { position: absolute; top: 7px; bottom: 7px; border-radius: 6px; color: #fff; font-size: 11.5px; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; cursor: pointer; z-index: 1; min-width: 6px; }
.tl-bar:hover { filter: brightness(1.08); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .7; z-index: 1; pointer-events: none; }
.tl-none { position: absolute; left: 10px; top: 9px; font-size: 12px; color: var(--muted); }

/* ---------- home ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-size: 28px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.warn b { color: var(--danger); }
.home-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 15px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.task-list { list-style: none; margin: 0; padding: 4px; }
.task-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.task-row:hover { background: var(--hover); }
.task-row .t-board { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.task-row .t-board .dot { width: 7px; height: 7px; border-radius: 2px; }
.task-row .t-due { font-size: 12px; width: 82px; text-align: right; }
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; text-align: left; border-top: 4px solid var(--bc); display: flex; flex-direction: column; gap: 8px; }
.board-card:hover { box-shadow: var(--shadow); }
.board-card h3 { margin: 0; font-size: 15px; }
.board-card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.board-card.new { border: 2px dashed var(--border); align-items: center; justify-content: center; color: var(--muted); min-height: 130px; background: none; }
.board-card.new:hover { color: var(--accent); border-color: var(--accent); box-shadow: none; }

/* ---------- panel ---------- */
#scrim { position: fixed; inset: 0; background: rgba(10, 12, 30, .25); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
#scrim.show { opacity: 1; pointer-events: auto; }
#panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); z-index: 50;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column;
}
#panel.open { transform: none; }
.panel-head { display: flex; align-items: center; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.panel-body { overflow-y: auto; padding: 16px 22px 40px; }
.p-title { width: 100%; font-size: 21px; font-weight: 700; border: 1px solid transparent !important; background: none !important; resize: none; padding: 4px 6px !important; field-sizing: content; overflow: hidden; }
.p-title:hover { border-color: var(--border) !important; }
.p-title:focus { border-color: var(--accent) !important; }
.props { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; align-items: center; margin: 14px 0 20px; }
.props > label { color: var(--muted); font-size: 13px; }
.props input, .props select { width: 100%; max-width: 280px; }
.owner-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 2px 12px 2px 2px; }
.owner-btn:hover { background: var(--hover); }
.panel-body h4 { margin: 22px 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.p-notes { width: 100%; min-height: 110px; resize: vertical; field-sizing: content; }
.progress { height: 6px; border-radius: 9px; background: var(--hover); overflow: hidden; margin-bottom: 6px; }
.progress > span { display: block; height: 100%; background: #00c875; transition: width .2s; }
.subtasks { list-style: none; margin: 0; padding: 0; }
.subtasks li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.subtasks input[type="checkbox"] { width: 16px; height: 16px; accent-color: #00c875; flex: none; }
.sub-text { flex: 1; border: 1px solid transparent !important; background: none !important; padding: 4px 6px !important; }
.sub-text:hover { border-color: var(--border) !important; }
.sub-text.done { text-decoration: line-through; color: var(--muted); }
.sub-add { width: 100%; margin-top: 4px; }
.update-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.update-box textarea { width: 100%; min-height: 70px; resize: vertical; }
.updates { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.update { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; position: relative; }
.update.system { border-style: dashed; padding: 6px 12px; font-size: 12.5px; color: var(--muted); }
.u-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.u-text { white-space: pre-wrap; word-break: break-word; }
.update .icon-btn { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; opacity: 0; }
.update:hover .icon-btn { opacity: 1; }

/* ---------- settings ---------- */
.settings-grid { display: grid; gap: 22px; max-width: 760px; }
.settings-card { padding: 20px 22px; }
.settings-card h2 { margin: 0 0 4px; font-size: 16px; }
.settings-card p { margin: 0 0 14px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.person-row input[type="color"] { width: 34px; height: 34px; border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; }
.person-row input[type="text"] { flex: 1; max-width: 300px; }
.add-person { display: flex; gap: 8px; margin-top: 10px; }
.add-person input { max-width: 300px; flex: 1; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- dialog ---------- */
#dlg { border: 0; border-radius: 14px; padding: 0; width: min(620px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#dlg::backdrop { background: rgba(10, 12, 30, .45); }
.dlg-form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg-form h2 { margin: 0; font-size: 20px; }
.dlg-form > label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tpl { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; cursor: pointer; }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.tpl input { margin-top: 3px; accent-color: var(--accent); }
.tpl b { display: block; font-size: 13.5px; }
.tpl small { color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- hosted: login & account ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand { padding: 0 0 4px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card p { margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; }
.auth-card .btn { justify-content: center; height: 40px; }
.auth-error { color: var(--danger); font-weight: 600; font-size: 13px; }
.pw-form { display: grid; gap: 8px; max-width: 320px; }
.pw-form .btn { justify-self: start; }
.logout-form { margin: 4px 0 0 -10px; }

/* ---------- hosted: accounts, team & sharing ---------- */
.me-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 500; min-width: 0; }
.me-row .chip { font-size: 10.5px; padding: 1px 7px; }
.sub-h { margin: 22px 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.chip.view-only { color: var(--accent); background: var(--accent-weak); border-color: transparent; }
.board-people { display: flex; padding-left: 8px; }
.board-people .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.invite-form { display: grid; gap: 10px; margin-bottom: 6px; }
.invite-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; }
.invite-form > .btn { justify-self: start; }
.invite-access summary { cursor: pointer; color: var(--accent); font-weight: 500; padding: 4px 0; }
.access-list { display: grid; gap: 4px; max-height: 50vh; overflow: auto; margin: 6px 0; }
.access-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 140px; align-items: center; gap: 10px; padding: 5px 4px; border-radius: var(--radius-sm); font-size: 13.5px; }
.access-row:hover { background: var(--hover); }
.access-row .dot { width: 10px; height: 10px; border-radius: 3px; }
.access-row select { height: 32px; }
.invite-link { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-weak); display: grid; gap: 8px; font-size: 13.5px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: 12.5px; }
.team-list { display: grid; }
.team-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: 0; }
.team-row.disabled { opacity: .55; }

/* View-only projects: inputs stay readable, editing controls disappear. */
.readonly input:disabled, .readonly textarea:disabled, .readonly select:disabled { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; cursor: default; }
.readonly button:disabled { cursor: default; filter: none; }
.readonly .c-drag { visibility: hidden; }   /* keep its grid column so the table stays aligned */
.readonly .row.add, .readonly .kadd, .readonly .add-group, .readonly .update-box, .readonly .sub-add,
.readonly [data-act="add-item"], .readonly [data-act="group-menu"], .readonly [data-act="del-item"], .readonly [data-act="dup-item"],
.readonly [data-act="sub-del"], .readonly [data-act="del-update"] { display: none !important; }
@media (max-width: 860px) {
  .invite-row { grid-template-columns: 1fr; }
  .board-people { display: none; }
}

#toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: #1a1735; color: #fff; padding: 9px 16px; border-radius: var(--radius); opacity: 0; transition: .2s; pointer-events: none; z-index: 200; font-size: 13px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .home-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  #app.side-open #sidebar { transform: none; }
  .mobile-only { display: inline-grid; }
  .page { padding: 18px 16px 60px; }
  .board-header { padding: 14px 16px 0; }
  .table-wrap, .kanban, .cal, .tl { padding-left: 16px; padding-right: 16px; }
  .filters { margin-left: 0; }
  .search input { width: 110px; }
  .board-desc { margin-left: 0; }
  .cal-day { min-height: 80px; padding: 3px; }
  .chip-item { font-size: 10.5px; padding: 2px 4px; }
  .tpl-grid { grid-template-columns: 1fr; }
}

/* ---------- Social ---------- */
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.disabled { opacity: .45; cursor: not-allowed; }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; margin-left: auto; }
.tab .badge { margin-left: 4px; }
.chip.ok { color: #00995a; background: #e3f8ee; border-color: transparent; }
.danger-text { color: var(--danger); }
.linkish { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 6px 13px; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--text); }
.chip-btn span { color: var(--muted); font-size: 12px; }
.chip-btn.on { background: var(--accent-grad); color: #fff; border-color: transparent; }
.chip-btn.on span { color: #ffffffcc; }
.pf { display: inline-grid; place-items: center; border-radius: 50%; background: var(--pc); color: #fff; flex: none; }
.pf svg { width: 72%; height: 72%; }
.acc { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--hover); flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.acc > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.acc > .pf { position: absolute; right: -4px; bottom: -4px; box-shadow: 0 0 0 2px var(--surface); }
.acc.lg { width: 48px; height: 48px; }
.mthumb { position: relative; display: inline-block; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--hover); flex: none; }
.mthumb img, .mthumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mthumb > b { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-shadow: 0 1px 4px #0008; font-size: 18px; }
.mthumb.empty { display: inline-grid; place-items: center; color: var(--muted); }
.social-page { max-width: 1320px; }
.s-tabs { margin: -6px 0 20px; border-bottom: 1px solid var(--border); }
.s-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.s-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.s-cal .cal-day { cursor: default; min-height: 120px; }
.s-cal .cal-day[data-s="compose-day"] { cursor: copy; }
.s-cal .cal-day[data-s="compose-day"]:hover { background: var(--accent-weak); }
.s-chip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 6px; border-radius: 6px; cursor: pointer; background: color-mix(in srgb, var(--sc) 16%, var(--surface)); border-left: 3px solid var(--sc); min-width: 0; }
.s-chip b { font-weight: 600; flex: none; }
.s-chip-p { display: inline-flex; gap: 2px; flex: none; }
.s-chip:hover { filter: brightness(.97); }
.s-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.s-list { display: grid; gap: 12px; }
.s-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.s-row-media { position: relative; }
.s-row-media i { position: absolute; right: 4px; bottom: 4px; background: #000a; color: #fff; font-style: normal; font-size: 11px; padding: 0 5px; border-radius: 5px; }
.s-row-text { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.s-row-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.s-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); }
.s-brand i, .s-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.s-by { display: inline-flex; align-items: center; gap: 6px; }
.s-targets { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.s-target { position: relative; display: inline-flex; }
.s-target > i { position: absolute; left: -2px; top: -2px; width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.s-error { margin-top: 6px; font-size: 12.5px; color: var(--danger); }
.s-note { margin-top: 8px; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, #7f5347 10%, var(--surface)); }
.s-row-side { display: grid; justify-items: end; gap: 10px; }
.s-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.s-brand-box { padding: 20px 22px; margin-bottom: 18px; }
.s-brand-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.s-brand-head h2 { margin: 0; font-size: 18px; }
.s-acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.s-acc { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.s-acc.bad { border-color: var(--danger); }
.s-acc-actions { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.s-connect { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.s-connect .btn { gap: 6px; }
.s-toolbar { margin-bottom: 16px; }
.s-brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.s-brand-card { padding: 20px; border-top: 4px solid var(--bc); display: grid; gap: 12px; }
.s-brand-card .s-brand-head { margin: 0; }
.s-people { display: flex; gap: 4px; flex-wrap: wrap; }
.s-setup-intro { padding: 20px 22px; margin-bottom: 18px; max-width: 760px; }
.s-setup-intro h2 { margin: 0 0 6px; font-size: 18px; }
.s-setup { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.s-key-card { padding: 20px; display: grid; gap: 12px; }
.s-key-card .s-brand-head { margin: 0; }
.s-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.s-field input, .s-field select, .s-field textarea { font-weight: 400; }
.empty-big { padding: 48px 32px; text-align: center; display: grid; justify-items: center; gap: 8px; }
.empty-big h2 { margin: 0; }
.s-home { margin-bottom: 26px; }
.slot-rows { display: grid; gap: 6px; }
.slot-row { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.slot-times { display: flex; gap: 6px; flex-wrap: wrap; }
.slot-add { display: flex; gap: 8px; flex-wrap: wrap; }
.s-detail { display: grid; gap: 14px; }
.s-detail-targets { display: grid; gap: 8px; }
.s-dt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }

/* sidebar tree: brands → accounts */
.s-tree { display: grid; gap: 1px; margin: 2px 0 6px 14px; padding-left: 8px; border-left: 1px solid var(--border); }
.s-tree-row { display: flex; align-items: center; border-radius: 7px; }
.s-tree-row:hover { background: var(--hover); }
.s-tree-row.active { background: var(--accent-weak); }
.s-tree-row.active .s-tree-name { color: var(--accent); font-weight: 600; }
.s-tree-caret { display: grid; place-items: center; width: 22px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; padding: 0; }
.s-tree-caret .ic { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform .15s; }
.s-tree-brand.open .s-tree-caret .ic { transform: none; }
.s-tree-name { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 30px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; padding: 0 8px 0 2px; }
.s-tree-name .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
/* brand logo, or initials on the brand color */
.s-mark { display: inline-grid; place-items: center; flex: none; border-radius: 6px; object-fit: cover; color: #fff; font-weight: 700; line-height: 1; background: var(--hover); overflow: hidden; }
.s-brand-head .s-mark { border-radius: 8px; }
.dlg-form .field-label { font-weight: 500; font-size: 13px; margin-bottom: -8px; }
.s-logo-row { margin: 0; }
.s-logo-prev { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; flex: none; border: 1px solid var(--border); }
.s-logo-prev img, .s-logo-ph { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 22px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-actions p { flex-basis: 100%; margin: 0; }
.s-tree-name .count { margin-left: auto; font-size: 11px; color: var(--muted); }
.s-tree-accs { display: grid; gap: 1px; margin: 1px 0 4px 22px; }
.s-tree-acc { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; min-width: 0; }
.s-tree-acc:hover { background: var(--hover); }
.s-tree-warn { margin-left: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--danger); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.s-tree-add { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.s-tree-add:hover { color: var(--accent); background: var(--hover); }
.s-tree-add .ic { width: 14px; height: 14px; }
.s-tree-add.brand { margin-top: 2px; }
.s-tree-empty { font-size: 12px; color: var(--muted); padding: 4px 8px; }
.s-acc.flash { box-shadow: 0 0 0 3px var(--accent-weak), 0 0 0 1.5px var(--accent); transition: box-shadow .3s; }

/* composer */
#dlg.wide { width: min(1120px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.composer { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100vh - 40px); }
.composer-head { display: flex; align-items: center; padding: 18px 22px 0; }
.composer-head h2 { margin: 0; font-size: 20px; }
.composer-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); min-height: 0; overflow: auto; }
.composer-form { padding: 16px 22px 22px; display: grid; gap: 16px; align-content: start; }
.composer-preview { background: var(--surface-2); border-left: 1px solid var(--border); padding: 18px; display: grid; gap: 12px; align-content: start; }
.s-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.s-pick-acc { display: inline-flex; align-items: center; gap: 8px; max-width: 220px; padding: 5px 12px 5px 5px; border-radius: 99px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; font-size: 13px; color: var(--text); opacity: .6; }
.s-pick-acc.on { opacity: 1; border-color: var(--accent); background: var(--accent-weak); }
.s-pick-acc.bad { border-style: dashed; }
.s-custom-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.s-text { width: 100%; min-height: 150px; resize: vertical; font: inherit; line-height: 1.5; }
.s-counts { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 500; }
.s-counts span { display: inline-flex; align-items: center; gap: 4px; }
.s-counts .over { color: var(--danger); font-weight: 700; }
.s-media { display: flex; gap: 10px; flex-wrap: wrap; }
.s-media-item { position: relative; display: grid; gap: 4px; }
.s-media-item.uploading .mthumb { display: grid; place-items: center; }
.s-up-name { max-width: 64px; font-size: 10.5px; color: var(--muted); }
.s-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--text); color: var(--surface); display: grid; place-items: center; cursor: pointer; }
.s-x .ic { width: 12px; height: 12px; }
.s-add-media { width: 64px; height: 64px; border-radius: 10px; border: 1.5px dashed var(--outline); display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: 11px; cursor: pointer; background: none; }
.s-add-media:hover { border-color: var(--accent); color: var(--accent); }
.s-library { display: grid; grid-template-columns: repeat(auto-fill, 64px); gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); max-height: 190px; overflow: auto; margin-top: 8px; }
.s-lib-item { padding: 0; border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; }
.s-lib-item.on { border-color: var(--accent); }
.s-problems { display: grid; gap: 4px; font-size: 13px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, #fdab3d 14%, var(--surface)); color: var(--text); }
.s-problems.err { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); font-weight: 500; }
.s-when { display: flex; gap: 6px; flex-wrap: wrap; }
.s-when + input { max-width: 260px; }
.composer-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.s-preview-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.s-preview-tabs .chip-btn { padding: 4px 8px; }

/* previews */
.pv { background: #fff; color: #1c1c1c; border-radius: 12px; border: 1px solid #e6e6e6; overflow: hidden; font-size: 14px; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.pv-head .muted { color: #777; }
.pv-text { padding: 0 14px 12px; word-break: break-word; line-height: 1.45; }
.s-detail .pv-text { padding: 0; }
.pv-media { display: grid; gap: 2px; background: #000; }
.pv-media img, .pv-media video { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 420px; }
.pv-media.n2, .pv-media.n3, .pv-media.n4 { grid-template-columns: 1fr 1fr; }
.pv-media.n2 img, .pv-media.n3 img, .pv-media.n4 img { aspect-ratio: 1; }
.pv-media.empty { display: grid; place-items: center; aspect-ratio: 1; background: #f2f2f2; color: #888; font-size: 13px; }
.pv-more { display: grid; place-items: center; background: #0008; color: #fff; font-size: 20px; }
.pv-actions { padding: 10px 14px; color: #666; font-size: 13px; border-top: 1px solid #eee; }
.pv-ig .pv-media img, .pv-ig .pv-media video { aspect-ratio: 1; }
.pv-ig .pv-actions { border: 0; font-size: 18px; letter-spacing: 6px; }
.pv-x { border-radius: 16px; }
.pv-x .pv-media { margin: 0 14px 12px; border-radius: 14px; overflow: hidden; }
.pv-youtube .pv-media img, .pv-youtube .pv-media video, .pv-youtube .pv-media.empty { aspect-ratio: 16 / 9; }
.pv-title { padding: 12px 14px 0; font-weight: 600; font-size: 16px; }
.pv-tiktok { background: #111; color: #fff; border-color: #111; max-width: 300px; justify-self: center; width: 100%; }
.pv-tiktok .pv-media video, .pv-tiktok .pv-media img, .pv-tiktok .pv-media.empty { aspect-ratio: 9 / 16; max-height: 460px; }
.pv-tiktok .pv-head .muted { color: #bbb; }

@media (max-width: 900px) {
  .composer-grid { grid-template-columns: 1fr; }
  .composer-preview { border-left: 0; border-top: 1px solid var(--border); }
  .s-row { grid-template-columns: auto minmax(0, 1fr); }
  .s-row-side { grid-column: 1 / -1; justify-items: start; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .s-legend { display: none; }
  .s-acc-grid, .s-brands, .s-setup { grid-template-columns: 1fr; }
  .s-cal .cal-day { min-height: 76px; }
  .s-chip b, .s-chip .ellipsis { display: none; }
}

/* ---------- inbox ---------- */
.inbox-page { max-width: 1400px; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding-bottom: 20px; }
.inbox-page .page-head { margin-bottom: 14px; }
.ib { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px 1fr; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ib-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.ib-filters { display: flex; gap: 4px; padding: 10px 10px 6px; }
.ib-filters button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; padding: 7px 4px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.ib-filters button:hover { background: var(--hover); color: var(--text); }
.ib-filters button.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.ib-filters button span { font-size: 11px; opacity: .8; }
.ib-search { display: flex; align-items: center; gap: 8px; margin: 2px 10px 8px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); }
.ib-search input { border: 0; background: none; outline: none; padding: 8px 0; width: 100%; color: var(--text); font: inherit; font-size: 13px; }
.ib-items { flex: 1; overflow-y: auto; padding: 0 6px 8px; }
.ib-item { display: flex; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ib-item:hover { background: var(--hover); }
.ib-item.active { background: var(--accent-weak); }
.ib-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ib-item-top { display: flex; align-items: baseline; gap: 8px; }
.ib-item-top b { font-weight: 500; font-size: 14px; }
.ib-item.unread .ib-item-top b { font-weight: 700; }
.ib-time { margin-left: auto; font-size: 11.5px; color: var(--muted); flex: none; }
.ib-item.unread .ib-time { color: var(--accent); font-weight: 600; }
.ib-prev { font-size: 13px; color: var(--muted); }
.ib-item.unread .ib-prev { color: var(--text); }
.ib-item-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.ib-item-meta .spacer { flex: 1; }
.ib-item-meta .avatar { width: 18px; height: 18px; font-size: 8px; }
.ib-unread { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; }
.ib-tag { padding: 1px 6px; border-radius: 99px; background: var(--hover); font-size: 10.5px; }
.ib-av { position: relative; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.ib-av > span:first-child { line-height: 1; }
.ib-av .pf { position: absolute; right: -3px; bottom: -3px; box-shadow: 0 0 0 2px var(--surface); }
.ib-empty, .ib-none { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 40px 24px; color: var(--muted); height: 100%; }
.ib-empty .ic, .ib-none .ic { width: 34px; height: 34px; opacity: .6; }
.ib-empty h3 { margin: 4px 0 0; color: var(--text); font-size: 16px; }
.ib-empty p { margin: 0; max-width: 280px; }
.ib-errors { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); font-size: 13px; display: grid; gap: 4px; }
.ib-errors .pf { vertical-align: -3px; margin-right: 4px; }

.ib-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ib-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ib-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ib-who b { font-size: 15px; }
.ib-head > .spacer { display: none; }
.ib-head select { max-width: 180px; }
.ib-back { display: none; }
.ib-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.ib-day { text-align: center; margin: 12px 0 6px; }
.ib-day span { font-size: 11.5px; color: var(--muted); background: var(--hover); padding: 3px 10px; border-radius: 99px; }
.ib-msg { display: flex; flex-direction: column; max-width: min(72%, 560px); margin-top: 4px; }
.ib-msg.in { align-self: flex-start; align-items: flex-start; }
.ib-msg.out { align-self: flex-end; align-items: flex-end; }
.ib-bubble { padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-msg.in .ib-bubble { background: var(--hover); border-bottom-left-radius: 5px; }
.ib-msg.out .ib-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.ib-msg.out .ib-bubble a { color: #fff; }
.ib-meta { font-size: 11px; color: var(--muted); margin: 3px 4px 0; }
.ib-att { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.ib-att img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; }
a.ib-file { text-decoration: underline; }
.ib-note { align-self: center; width: min(86%, 600px); margin: 8px 0; padding: 9px 13px; border-radius: var(--radius-sm); background: color-mix(in srgb, #fdab3d 16%, transparent); border: 1px dashed color-mix(in srgb, #fdab3d 60%, transparent); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ib-note-by { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.ib-note-by .ic { width: 13px; height: 13px; }
.ib-compose { border-top: 1px solid var(--border); padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.ib-compose.note { background: color-mix(in srgb, #fdab3d 7%, transparent); }
.ib-modes { display: flex; gap: 4px; }
.ib-modes button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; cursor: pointer; }
.ib-modes button.active { background: var(--accent-weak); color: var(--accent); }
.ib-compose.note .ib-modes button.active { background: color-mix(in srgb, #fdab3d 25%, transparent); color: var(--text); }
.ib-input { width: 100%; resize: vertical; min-height: 64px; max-height: 40vh; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
.ib-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ib-send-row { display: flex; align-items: center; gap: 10px; }
.ib-send-row .spacer { flex: 1; }
.ib-warn { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; padding: 8px 10px; border-radius: var(--radius-sm); background: color-mix(in srgb, #fdab3d 14%, transparent); }
.ib-warn .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.ib-readonly { border-top: 1px solid var(--border); padding: 14px 16px; text-align: center; }

@media (max-width: 860px) {
  .inbox-page { padding: 16px 12px 12px; }
  .inbox-page .page-head .muted { display: none; }
  .ib { grid-template-columns: 1fr; }
  .ib-list { border-right: 0; }
  .inbox-page:not(.has-sel) .ib-thread { display: none; }
  .inbox-page.has-sel .ib-list { display: none; }
  .ib-back { display: inline-grid; }
  .ib-msg { max-width: 85%; }
  .ib-head select { max-width: 130px; }
  .ib-msgs { padding: 12px; }
}

/* ---------- quick replies ---------- */
.ib-tabs { margin-bottom: 14px; }
.ib-count-chip { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--hover); color: var(--muted); font-size: 11px; font-weight: 600; }
.ib-subnav { margin: -2px 0 4px; }
.ib-subnav .s-tree-acc { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.ib-subnav .s-tree-acc.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.qr-page { height: auto; }
.qr-tip { margin: -4px 0 14px; display: block; line-height: 1.6; }
.qr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.qr-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.qr-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qr-card-head .spacer { flex: 1; }
.qr-key { color: var(--accent); font-size: 14px; }
.qr-scope { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.qr-text { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.qr-empty { min-height: 260px; }
.qr-short { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.qr-short span { padding: 0 2px 0 12px; color: var(--muted); font-weight: 600; }
.qr-short input { border: 0 !important; background: none; outline: none; flex: 1; box-shadow: none !important; }
.qr-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -6px; }
.qr-vars .chip { cursor: pointer; border: 1px solid var(--border); background: var(--hover); color: var(--text); font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.qr-vars .chip:hover { border-color: var(--accent); }
.ib-compose { position: relative; }
.ib-modes { align-items: center; }
.ib-modes .spacer { flex: 1; }
.ib-qr-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 99px; cursor: pointer; }
.ib-qr-btn:hover, .ib-qr-btn.active { border-color: var(--accent); color: var(--accent); }
.ib-qr-btn .ic { width: 14px; height: 14px; }
.qr-pop { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 20; display: flex; flex-direction: column; overflow: hidden; }
.qr-pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.qr-pop-head .ic { width: 15px; height: 15px; color: var(--accent); }
.qr-pop-search { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; padding: 5px 9px; margin-left: auto; max-width: 220px; }
.qr-pop-list { max-height: 260px; overflow-y: auto; padding: 4px; }
.qr-opt { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; background: none; color: var(--text); font: inherit; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; min-width: 0; }
.qr-opt b { font-size: 13px; color: var(--accent); }
.qr-opt span { font-size: 12.5px; color: var(--muted); }
.qr-opt:hover, .qr-opt.active { background: var(--accent-weak); }
.qr-pop-empty { padding: 14px 12px; }
.qr-pop-manage { border: 0; border-top: 1px solid var(--border); background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 600; padding: 9px 12px; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.qr-pop-manage:hover { background: var(--hover); }
@media (max-width: 860px) {
  .qr-list { grid-template-columns: 1fr; }
  .ib-qr-btn { padding: 4px 8px; }
  .qr-pop { left: 8px; right: 8px; }
}

/* ---------- inbox: sources, sidebar brands, automations, channels ---------- */
.ib-sep { opacity: .5; }
.ib-bname { max-width: 90px; }
.ib-h-acc { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; color: var(--muted); vertical-align: middle; margin-left: 6px; }
.ib-src { display: inline-flex; align-items: center; gap: 4px; vertical-align: -3px; }
.ib-src .pf { width: 14px; height: 14px; }
.ib-src.auto .ic { width: 13px; height: 13px; }
.ib-msg.out.auto .ib-bubble { background: color-mix(in srgb, var(--accent) 78%, #6b7280); }
.ib-subject { font-weight: 700; margin-bottom: 4px; }
.ib-file { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 8px; background: color-mix(in srgb, currentColor 10%, transparent); font-size: 12.5px; }
.ib-file .ic { width: 13px; height: 13px; }
.ib-note.err { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.ib-mailto { display: flex; align-items: center; gap: 6px; }
.ib-mailto .ic { width: 14px; height: 14px; }
.ib-subnav .s-tree-acc { display: flex; align-items: center; gap: 8px; }
.ib-subnav .ib-unread { margin-left: auto; }
.ib-side-accs { margin-left: 14px; padding-left: 8px; border-left: 1px solid var(--border); }
.ib-side-none { display: block; padding: 4px 8px; }
.ib-side-gap { height: 6px; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--outline); transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }

.auto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.auto-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.auto-card.wide { grid-column: 1 / -1; }
.auto-card > label:not(.check) { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.auto-card p { margin: 0; }
.auto-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auto-head > div { display: flex; align-items: center; gap: 8px; }
.auto-head h2 { margin: 0; font-size: 16px; }
.auto-head .ic { width: 18px; height: 18px; color: var(--accent); }
.auto-days { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip input { position: absolute; opacity: 0; }
.day-chip span { display: inline-block; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.day-chip input:checked + span { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.day-chip input:focus-visible + span { outline: 2px solid var(--accent); }
.auto-hours { display: flex; gap: 10px; flex-wrap: wrap; }
.auto-hours label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.auto-hours label.grow { flex: 1; min-width: 180px; }
.auto-save { grid-column: 1 / -1; display: flex; justify-content: flex-end; position: sticky; bottom: 0; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 40%); }
.kb-list { display: grid; gap: 8px; }
.kb-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.kb-q { display: flex; align-items: center; gap: 8px; }
.kb-q .spacer { flex: 1; }
.kb-kw { display: flex; flex-wrap: wrap; gap: 4px; }
.kb-kw .chip { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--hover); border: 0; }
.kb-a { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kb-none { margin: 0; }
.kb-test { border-top: 1px dashed var(--border); padding-top: 12px; display: grid; gap: 8px; }
.kb-test label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.kb-test-out { display: block; }
.kb-test-out .ic { width: 14px; height: 14px; color: #00a35c; vertical-align: -2px; }
.kb-test-answer { margin-top: 6px; padding: 8px 12px; border-radius: 12px; background: var(--accent); color: #fff; white-space: pre-wrap; max-width: 520px; }

.ch-list { display: grid; gap: 14px; }
.ch-brand { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.ch-accs { display: grid; gap: 6px; }
.ch-acc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.ch-who { display: flex; flex-direction: column; min-width: 0; }
.ch-err { color: var(--danger); }
.ch-add .pf { margin-right: -2px; }
.ch-foot { margin-top: 14px; }
.mail-dlg { width: min(560px, 92vw); }
.mail-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mail-row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-top: 8px; }
.mail-row label, .mail-row3 label, .mail-adv > label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.mail-adv summary { cursor: pointer; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.mail-note { margin: -6px 0 0; }
@media (max-width: 860px) {
  .auto-grid { grid-template-columns: 1fr; }
  .mail-row, .mail-row3 { grid-template-columns: 1fr; }
  .ib-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .ib-tabs .tab { white-space: nowrap; }
}

/* ---------- website chat widget editor ---------- */
.w-page { max-width: 1320px; }
.w-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.w-form { display: flex; flex-direction: column; gap: 14px; }
.w-form.readonly input, .w-form.readonly textarea, .w-form.readonly select { pointer-events: none; opacity: .75; }
.w-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.w-sec h3 { margin: 0; font-size: 15px; }
.w-sec p { margin: 0; }
.w-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.w-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.w-color { display: flex; gap: 6px; }
.w-color input[type=color] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.w-color input[type=text] { flex: 1; min-width: 0; font-family: ui-monospace, monospace; }
.w-icons { display: flex; gap: 8px; flex-wrap: wrap; }
.w-icon { width: 46px; height: 46px; border-radius: 50%; border: 3px solid transparent; display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.w-icon.active { border-color: var(--text); }
.w-on { font-size: 14px; font-weight: 600; }
.w-code { display: flex; gap: 8px; align-items: flex-start; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.w-code code { flex: 1; font-size: 12.5px; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }
.w-guides { display: grid; gap: 6px; }
.w-guides details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.w-guides summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.w-guides p { margin: 8px 0 2px; font-size: 13px; line-height: 1.55; }
.w-qs { display: grid; gap: 6px; }
.w-q { display: flex; gap: 6px; align-items: center; }
.w-q input { flex: 1; }
.w-preview-wrap { position: sticky; top: 16px; }
.w-pv-label { margin-bottom: 6px; }
.w-preview { position: relative; height: 640px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: linear-gradient(180deg, #f6f5fb, #ebe8f6); }
.w-site { padding: 26px; display: grid; gap: 12px; }
.w-site i { display: block; height: 14px; border-radius: 7px; background: rgba(40,30,90,.08); }
.w-site i:first-child { height: 26px; width: 55%; background: rgba(40,30,90,.12); }
.w-site i.short { width: 40%; }
.w-mount { position: absolute; inset: 0; }
@media (max-width: 1100px) {
  .w-layout { grid-template-columns: 1fr; }
  .w-preview-wrap { position: static; }
}
@media (max-width: 860px) { .w-preview { height: 600px; } }

/* ---------- motion: button presses, tab and page changes, dialogs and menus ---------- */
.btn, .icon-btn, .tab, .nav-link, .board-link, .s-tree-acc, .s-tree-name, .ib-item, .ib-filters button, .ib-modes button,
.ib-qr-btn, .qr-opt, .chip, .day-chip span, .w-icon, .suite-card {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease, opacity .15s ease;
}
.btn:active:not(:disabled), .icon-btn:active:not(:disabled), .ib-qr-btn:active, .w-icon:active, .day-chip span:active { transform: scale(.96); }
.nav-link:active, .board-link:active, .s-tree-acc:active, .ib-item:active, .tab:active, .ib-filters button:active, .ib-modes button:active { transform: scale(.98); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.tab { position: relative; }
.tab::after { content: ''; position: absolute; left: 50%; right: 50%; bottom: -2px; height: 2px; background: var(--accent); border-radius: 2px; transition: left .22s ease, right .22s ease; }
.tab.active { border-bottom-color: transparent; }
.tab.active::after { left: 0; right: 0; }
.tab .ic { transition: transform .2s ease; }
.tab.active .ic { transform: scale(1.08); }

@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tab-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pill-in { from { transform: scale(.94); } to { transform: none; } }
@keyframes tree-in { from { opacity: 0; transform: translateY(-4px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.page-enter { animation: page-in .28s ease both; }
.tab-enter { animation: tab-in .22s ease both; }
.tree-enter { animation: tree-in .24s ease both; }
#dlg[open] { animation: pop-in .2s ease; }
#dlg[open]::backdrop { animation: fade-in .2s ease; }
.menu { animation: pop-in .14s ease; transform-origin: top left; }
.s-acc.flash { animation: pill-in .3s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Projects dropdown in the sidebar ---------- */
.proj-link { display: flex; }
.proj-count { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 500; }
.proj-caret { display: inline-grid; place-items: center; margin-left: 6px; color: var(--muted); }
.proj-count:empty + .proj-caret { margin-left: auto; }
.proj-caret .ic { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform .2s ease; }
.proj-link.open .proj-caret .ic { transform: none; }
.proj-tree { margin: 0 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--border); }
.proj-tree .cat { padding: 8px 10px 3px; }
.proj-tree .board-link { padding-left: 10px; }
