/* Taskloom — app styles. Colors live in tokens so themes swap instantly. */

/* ---------- Tokens ---------- */
:root {
  --accent: #4F46E5;
  --on-accent: #FFFFFF;
  --bg: #F7F7F8; --surface: #FFFFFF; --surface-2: #F2F2F5; --hover: #ECECF1; --border: #E3E3E8;
  --text: #18181B; --text-2: #4A4A54; --text-3: #64646F;
  --accent-text: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --danger: #C81E1E; --warn: #B45309; --success: #15803D;
  --shadow: 0 1px 2px rgba(16,16,24,.05);
  --shadow-lg: 0 12px 32px rgba(16,16,24,.16);
  --radius: 10px;
  --row-h: 44px; --pad: 12px; --gap: 10px;
  --sidebar-w: 256px;
  color-scheme: light;
  font-size: 14px;
}
[data-scheme="dark"] {
  --bg: #0E0E11; --surface: #16161B; --surface-2: #1D1D24; --hover: #25252D; --border: #2B2B34;
  --text: #EDEDF0; --text-2: #BBBBC5; --text-3: #93939F;
  --accent-text: color-mix(in srgb, var(--accent) 62%, #FFFFFF);
  --accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface));
  --danger: #F87171; --warn: #FBBF24; --success: #4ADE80;
  --shadow: none; --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}
[data-theme="paper"] { --bg:#F5F1EA; --surface:#FFFDF8; --surface-2:#EFE9DF; --hover:#E9E2D6; --border:#E2DACB; --text:#221E18; --text-2:#4F4840; --text-3:#6B6357; }
[data-theme="midnight"] { --bg:#F3F5FA; --surface:#FFFFFF; --surface-2:#EBEFF7; --hover:#E3E8F3; --border:#DCE2EE; --text:#141B2D; --text-2:#46506A; --text-3:#5F6984; }
[data-theme="forest"] { --bg:#F2F5F1; --surface:#FFFFFF; --surface-2:#E9EFE7; --hover:#E1E9DE; --border:#D9E2D5; --text:#16201A; --text-2:#45514A; --text-3:#5E6B63; }
[data-theme="paper"][data-scheme="dark"] { --bg:#14120E; --surface:#1C1915; --surface-2:#24201B; --hover:#2B2620; --border:#352F27; --text:#EFE9DF; --text-2:#C8BFB1; --text-3:#9C9385; }
[data-theme="midnight"][data-scheme="dark"] { --bg:#0A0F1E; --surface:#111830; --surface-2:#18213C; --hover:#1F2947; --border:#26314F; --text:#E8ECF7; --text-2:#B4BDD6; --text-3:#8C97B5; }
[data-theme="forest"][data-scheme="dark"] { --bg:#0C1310; --surface:#131C17; --surface-2:#1A251F; --hover:#213027; --border:#2A3A30; --text:#E6EFE9; --text-2:#B6C4BB; --text-3:#8FA096; }
[data-density="compact"] { --row-h: 36px; --pad: 8px; --gap: 6px; }
[data-text="sm"] { font-size: 13px; }
[data-text="lg"] { font-size: 16px; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.big { width: 40px; height: 40px; color: var(--text-3); }
.muted { color: var(--text-3); }
.small { font-size: .86rem; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-size: .9em; }
.spacer { flex: 1; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.tone-danger { color: var(--danger) !important; }
.tone-accent { color: var(--accent-text) !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: .93rem; font-weight: 500; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger-ghost { color: var(--danger); }
.btn-block { width: 100%; height: 40px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; }
.link-btn { border: 0; background: none; color: var(--accent-text); padding: 0; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; font-size: .93rem; }
.field > span { font-weight: 600; }
.field input, .field select, .field textarea, .inline-form select {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
.field small { font-size: .82rem; }
.check { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  padding: 14px 10px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main:focus { outline: none; }
.project, .task-page, .settings, .mywork { flex: 1; }
.project, .task-page { display: flex; flex-direction: column; }
.topbar-mobile, .scrim, .nav-close { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.brand-name { font-weight: 600; }
.brand-ws { font-size: .86rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--text-3); font-size: .93rem; text-align: left;
}
.search-trigger span { flex: 1; }
.search-trigger:hover { background: var(--hover); }
kbd { font-family: 'Geist Mono', monospace; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); min-height: 28px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); font-size: 1rem; text-decoration: none; border: 0; background: none; width: 100%; text-align: left;
}
.nav-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.nav-link > span:not(.nav-count):not(.dot-sq):not(.nav-badge) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.sub { min-height: 32px; font-size: .93rem; }
.nav-link.sub .ic { width: 14px; height: 14px; }
.nav-count { font-size: .86rem; font-weight: 600; color: var(--text-3); }
.nav-link.is-active .nav-count { color: inherit; }
.nav-empty { font-size: .93rem; color: var(--text-3); padding: 0 10px; margin: 0; }
.muted-link { color: var(--text-3); }
.dot-sq { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.space > summary { list-style: none; cursor: pointer; }
.space > summary::-webkit-details-marker { display: none; }
.space-name { font-weight: 500; color: var(--text); }
.space-actions { display: none; gap: 2px; }
.space-row:hover .space-actions, .space-row:focus-within .space-actions { display: inline-flex; }
.chev { width: 14px; height: 14px; color: var(--text-3); transition: transform .15s; }
details:not([open]) > summary .chev { transform: rotate(-90deg); }
.space-projects { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 6px 18px; }
.nav-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.me { display: flex; align-items: center; gap: 8px; padding: 4px 0 2px 8px; }
.me-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: .86rem; color: var(--text-3); }
.me form { margin: 0; }
[data-scheme="dark"] .when-light, [data-scheme="light"] .when-dark { display: none; }
.avatar { border-radius: 50%; color: #fff; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 1; }
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }

/* ---------- Flash & toast ---------- */
.flashes { padding: 12px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: .93rem; }
.flash-msg { flex: 1; min-width: 0; }
.flash > .icon-btn { margin-left: auto; }
.flash-success { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); background: color-mix(in srgb, var(--success) 9%, var(--surface)); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .93rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Page head & toolbar ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: .93rem; color: var(--text-3); min-width: 0; }
.crumb a { color: var(--text-2); }
.page-title { font-size: 1.3rem; font-weight: 600; letter-spacing: -.01em; }
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: inline-block; }
.progress.sm { width: 110px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tabs { display: flex; gap: 4px; }
.tab { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 7px; font-size: .93rem; color: var(--text-2); text-decoration: none; }
.tab:hover { background: var(--hover); text-decoration: none; }
.tab.is-active { background: var(--surface-2); color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--accent); }
.search-inline { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-3); min-width: 200px; }
.search-inline input { border: 0; outline: none; background: transparent; width: 100%; color: var(--text); font-size: .93rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .93rem; text-decoration: none; }
.chip:hover { background: var(--hover); text-decoration: none; }
.chip.is-on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 500; }
.chip .ic { width: 14px; height: 14px; }
.empty-hint { padding: 0 24px 24px; }

/* ---------- Tags, meta ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--tag, #8B5CF6) 16%, var(--surface)); color: var(--text-2); white-space: nowrap; }
.tag button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.meta { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: .86rem; white-space: nowrap; }
.meta .ic { width: 13px; height: 13px; }
.due-over { color: var(--danger) !important; }
.due-today { color: var(--accent-text) !important; font-weight: 500; }
.p-urgent { color: var(--danger) !important; }
.p-high { color: var(--warn) !important; }
.p-normal, .p-low, .p-none { color: var(--text-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.count { font-size: .86rem; color: var(--text-3); }

/* ---------- Board ---------- */
.board-scroll { flex: 1; overflow-x: auto; padding: 20px 24px 32px; -webkit-overflow-scrolling: touch; }
.board { display: flex; gap: 14px; align-items: flex-start; width: max-content; min-height: 100%; }
.column { width: 292px; flex: none; background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.column-head h2 { font-size: .93rem; font-weight: 600; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 12px; }
.card {
  display: flex; flex-direction: column; gap: var(--gap); padding: var(--pad); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); text-decoration: none; }
.card-title { font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.card.is-done .card-title { color: var(--text-3); text-decoration: line-through; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sortable-ghost { opacity: .35; }
.sortable-chosen .card, .card.sortable-chosen { box-shadow: var(--shadow-lg); }
.add-row { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); font-size: .93rem; text-align: left; }
.add-row:hover { background: var(--hover); color: var(--text); }
.quick-add input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); color: var(--text); outline: none; }

/* ---------- List ---------- */
.list-wrap { flex: 1; padding: 20px 24px 32px; }
.table { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow-x: auto; }
.thead, .row { display: grid; grid-template-columns: minmax(280px, 1fr) 110px 100px 100px 180px; align-items: center; min-width: 780px; padding: 0 16px; }
.thead { height: 38px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.thead .cell-main { padding-left: 26px; }
.group > summary { list-style: none; cursor: pointer; }
.group > summary::-webkit-details-marker { display: none; }
.group-head { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-top: 1px solid var(--border); background: var(--surface-2); min-width: 780px; }
.group-head h2 { font-size: .93rem; font-weight: 600; }
.row { min-height: var(--row-h); border-top: 1px solid var(--border); }
.row:hover { background: var(--hover); }
.cell { min-width: 0; font-size: .93rem; }
.cell-main { display: flex; align-items: center; gap: 10px; padding-right: 12px; }
.row-title { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-done .row-title { color: var(--text-3); text-decoration: line-through; }
.row-project { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-due { color: var(--text-2); }
.cell-prio { display: flex; align-items: center; gap: 5px; }
.cell-prio .ic { width: 13px; height: 13px; }
.cell-tags { display: flex; gap: 6px; overflow: hidden; }
.row-add { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 40px; border-top: 1px solid var(--border); color: var(--text-3); min-width: 780px; }
.row-add input { flex: 1; border: 0; outline: none; background: transparent; color: var(--text); height: 100%; }
.row.leaving { opacity: 0; transition: opacity .25s; }

/* ---------- My Work ---------- */
.mywork { padding: 32px 36px 48px; display: flex; flex-direction: column; gap: 22px; max-width: 1180px; width: 100%; }
.hello-title { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: .86rem; color: var(--text-3); }
.stat-num { font-size: 1.8rem; font-weight: 600; }
.mw-group { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.mw-head { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; }
.mw-head h2 { font-size: 1rem; font-weight: 600; }
.mw-group .row { grid-template-columns: minmax(0, 1fr) 90px 100px 90px; min-width: 0; }
.mw-group .cell-tags { display: none; }
.mw-group .cell-main { flex-wrap: wrap; row-gap: 2px; padding: 6px 12px 6px 0; }
.mw-group .row-project { flex-basis: 100%; padding-left: 26px; }
.empty-card { border: 1px dashed var(--border); border-radius: 14px; background: var(--surface); padding: 36px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.empty-card h1, .empty-card h2 { font-size: 1.15rem; }

/* ---------- Task page ---------- */
.task-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.task-body { flex: 1; display: flex; flex-wrap: wrap; align-items: stretch; }
.task-main { flex: 999 1 560px; min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 48px; display: flex; flex-direction: column; gap: 26px; max-width: 980px; }
.task-title { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; border: 0; background: transparent; resize: none; width: 100%; padding: 4px 6px; margin-left: -6px; border-radius: 8px; overflow: hidden; color: var(--text); }
.task-title:hover:not(:disabled), .task-title:focus { background: var(--surface); outline: 1px solid var(--border); }
.props { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 32px; }
.prop { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.prop-wide { grid-column: 1 / -1; }
.prop-label { width: 110px; flex: none; display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: .93rem; }
.select-pill { position: relative; display: inline-flex; align-items: center; border-radius: 999px; background: color-mix(in srgb, var(--dot) 16%, var(--surface)); }
.select-pill::before { content: ""; position: absolute; left: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); pointer-events: none; }
.select-pill select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 5px 14px 5px 24px; font-size: .9rem; font-weight: 500; cursor: pointer; border-radius: 999px; color: var(--text); }
.plain-select, .date-wrap input { border: 1px solid transparent; background: transparent; padding: 5px 8px; border-radius: 8px; color: var(--text); cursor: pointer; }
.plain-select:hover, .date-wrap input:hover { border-color: var(--border); background: var(--surface); }
.picker { position: relative; }
.picker > summary { list-style: none; }
.picker > summary::-webkit-details-marker { display: none; }
.picker-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 8px; margin-left: -8px; border-radius: 8px; cursor: pointer; }
.picker-btn:hover { background: var(--hover); }
.picker-menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: -8px; min-width: 240px; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: .93rem; }
.picker-item:hover { background: var(--hover); }
.picker-item input { accent-color: var(--accent); }
.tag-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
.tag-editor [data-tag-list] { display: contents; }
.tag-editor input { border: 0; background: transparent; outline: none; padding: 4px; min-width: 120px; color: var(--text); font-size: .93rem; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 12px; }
.section-title { font-size: 1rem; font-weight: 600; }
.desc { width: 100%; min-height: 110px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 12px 14px; line-height: 1.6; color: var(--text-2); resize: vertical; }
.desc:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.subtasks { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.subtask, .subtask-add { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--border); }
.subtask-add { border-bottom: 0; color: var(--text-3); }
.subtask-title, .subtask-add input { flex: 1; border: 0; background: transparent; outline: none; padding: 6px 0; color: var(--text); font-size: .95rem; }
.subtask.is-done .subtask-title { color: var(--text-3); text-decoration: line-through; }
.subtask [data-del-sub] { opacity: 0; color: var(--text-3); }
.subtask:hover [data-del-sub], .subtask:focus-within [data-del-sub] { opacity: 1; }
.task-side { flex: 1 1 320px; max-width: 100%; border-left: 1px solid var(--border); background: var(--surface); padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: .93rem; color: var(--text-2); }
.activity li { display: flex; gap: 10px; }
.activity b { font-weight: 600; color: var(--text); }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin-top: 7px; flex: none; }

/* ---------- Settings ---------- */
.settings { display: flex; flex-wrap: wrap; align-items: flex-start; flex: 1; }
.settings-nav { flex: 0 1 220px; padding: 24px 12px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav .nav-heading { padding-top: 14px; }
.settings-body { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.settings-main { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.form-narrow { max-width: 520px; gap: 4px; }
.settings-title { font-size: 1.7rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 6px; }
.set-section { display: flex; flex-direction: column; gap: 12px; }
.set-section h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.opt-grid.themes { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.opt { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; }
.opt:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.opt[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); border-color: transparent; }
.opt-prev { height: 76px; border-radius: 8px; overflow: hidden; display: flex; border: 1px solid var(--border); }
.opt-prev > span { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 10px; }
.opt-prev i { display: block; height: 6px; width: 60%; border-radius: 3px; }
.opt-prev b { display: block; height: 12px; width: 40%; border-radius: 4px; background: var(--accent); margin-top: 4px; }
.opt-label { font-weight: 600; font-size: .93rem; }
.opt-hint { font-size: .86rem; color: var(--text-3); margin-top: -6px; }
.theme-prev { height: 56px; border-radius: 8px; border: 1px solid; display: flex; gap: 6px; padding: 8px; }
.theme-prev > span { border-radius: 4px; }
.theme-prev > span:first-child { width: 30%; }
.theme-prev > span:last-child { flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.theme-prev i { display: block; height: 4px; width: 70%; border-radius: 2px; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; background: var(--sw); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.swatch .ic { opacity: 0; stroke-width: 2.5; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sw); }
.swatch[aria-pressed="true"] .ic { opacity: 1; }
.custom-color { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: .93rem; cursor: pointer; }
.custom-color input { width: 26px; height: 26px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: .93rem; font-weight: 500; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.preview { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 16px; }
.preview .nav-heading { padding-left: 0; }
.preview-box { border: 1px solid var(--border); border-radius: 14px; background: var(--bg); padding: 14px; display: flex; flex-direction: column; gap: var(--gap); }
.preview-box .card:hover { border-color: var(--border); }
.preview-actions { display: flex; gap: 8px; }
.preview-actions .btn { flex: 1; }
.member-add { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.member-list { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.member:last-child { border-bottom: 0; }
.member.is-off { opacity: .6; }
.member-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.member-name { font-weight: 500; }
.inline-form { margin: 0; }
.inline-form select { height: 34px; width: auto; }
.badge { font-size: .75rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-3); }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.menu-pop form { margin: 0; }

/* ---------- Dialogs ---------- */
.dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); padding: 22px; width: min(460px, calc(100% - 32px)); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(10,10,14,.45); }
.dialog h2 { font-size: 1.15rem; margin-bottom: 6px; }
.dialog p { margin: 0 0 14px; }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-pick span { display: block; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.swatch-pick input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-2); }
.swatch-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }
.dialog-search { padding: 0; width: min(620px, calc(100% - 24px)); margin-top: 12vh; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 54px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.search-box input { flex: 1; border: 0; outline: none; background: transparent; font-size: 1.05rem; color: var(--text); }
.search-results { max-height: 50vh; overflow-y: auto; padding: 6px; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a.is-sel { background: var(--hover); }
.search-results .res-type { font-size: .78rem; color: var(--text-3); width: 54px; flex: none; }
.search-results .res-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.search-results .res-sub { font-size: .86rem; color: var(--text-3); white-space: nowrap; }
.search-hint { padding: 10px 16px; border-top: 1px solid var(--border); font-size: .82rem; }

/* ---------- Auth ---------- */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow); }
.auth-card .brand { padding: 0; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card form { display: flex; flex-direction: column; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); width: min(300px, 86vw); padding-top: max(14px, env(safe-area-inset-top)); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(10,10,14,.4); }
  .nav-close { display: inline-flex; }
  .space-actions { display: inline-flex; }
  .topbar-mobile { display: flex; align-items: center; gap: 6px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .topbar-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.sm, .icon-btn.xs { width: 36px; height: 36px; }
  .page-head, .toolbar, .task-bar { padding-left: 16px; padding-right: 16px; }
  .page-head .page-title { font-size: 1.15rem; }
  .search-inline { min-width: 0; flex: 1 1 160px; }
  .board-scroll { padding: 14px 16px 24px; scroll-snap-type: x mandatory; }
  .column { width: min(300px, 82vw); scroll-snap-align: start; }
  .list-wrap { padding: 14px 0 24px; }
  .table { border-radius: 0; border-left: 0; border-right: 0; }
  .mywork { padding: 20px 16px 40px; }
  .hello-title { font-size: 1.5rem; }
  .mw-group .row { grid-template-columns: minmax(0, 1fr) 76px; }
  .mw-group .cell-people, .mw-group .cell-prio { display: none; }
  .task-main { padding-top: 18px; }
  .task-title { font-size: 1.45rem; }
  .task-side { border-left: 0; border-top: 1px solid var(--border); }
  .hide-sm { display: none; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; padding: 12px 16px 0; gap: 6px; }
  .settings-nav .nav-heading { display: none; }
  .settings-nav .nav-link { width: auto; border: 1px solid var(--border); }
  .settings-body { padding: 20px 16px 40px; }
  .preview { position: static; }
  .btn { height: 40px; }
  .check { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ============ Phase 2: comments, files, links, inbox ============ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .86rem; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }

/* Files & links */
.dropzone { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1.5px dashed var(--border); border-radius: 10px; background: var(--surface); color: var(--text-3); transition: border-color .15s, background .15s; }
.dropzone input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: .93rem; height: 44px; }
.dropzone.is-over, .task-main.is-over .dropzone { border-color: var(--accent); background: var(--accent-soft); }
.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-item { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--text-2); }
.upload-item .progress { flex: 1; width: auto; }
.upload-item.is-error { color: var(--danger); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.att-grid:empty { display: none; }
.att { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.att.is-pending { opacity: .75; }
.att-media { display: block; position: relative; height: 140px; background: var(--surface-2); overflow: hidden; border: 0; padding: 0; width: 100%; cursor: pointer; color: inherit; }
.att-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-media video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.att-audio { height: auto; padding: 12px; cursor: default; }
.att-audio audio { width: 100%; }
.att-fileicon { display: flex; align-items: center; justify-content: center; color: var(--fc, #64748B); }
.att-fileicon span { font-weight: 700; font-size: 1.05rem; letter-spacing: .04em; padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--fc, #64748B) 14%, var(--surface)); }
.att-fileicon .ic.big { color: var(--fc); width: 36px; height: 36px; }
.att-gthumb img { object-position: top center; }
.att-private { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-3); font-size: .82rem; padding: 0 20px; text-align: center; }
.att-private .ic { width: 22px; height: 22px; }
.att-gthumb.is-private img, .att-gthumb.is-private .att-overlay { display: none; }
.att-gthumb.is-private .att-private { display: flex; }
.att-overlay { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; background: rgba(15,15,20,.75); color: #fff; font-size: .78rem; font-weight: 500; padding: 4px 9px; border-radius: 999px; opacity: 0; transition: opacity .15s; }
.att-gthumb:hover .att-overlay, .att-gthumb:focus-visible .att-overlay { opacity: 1; }
.att-video { background: #111; }
.att-play { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255,255,255,.92); color: #111; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.att-play .ic { width: 20px; height: 20px; margin-left: 3px; }
.att-dur { position: absolute; right: 8px; bottom: 8px; font-family: 'Geist Mono', monospace; font-size: 11px; color: #fff; background: rgba(0,0,0,.7); padding: 2px 6px; border-radius: 4px; }
.att-media iframe { width: 100%; height: 100%; border: 0; display: block; }
.att-info { display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 12px; }
.att-badge { width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); margin-top: 1px; }
.att-badge .ic { width: 16px; height: 16px; }
.att-g { width: 22px; height: 22px; border-radius: 5px; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.att-g .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.att-favicon { width: 16px; height: 16px; border-radius: 3px; }
.att-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-title { color: var(--text); font-weight: 500; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { font-size: .8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.att-actions { display: inline-flex; gap: 2px; flex: none; color: var(--text-3); }
.att-inline { flex-direction: row; align-items: stretch; max-width: 420px; }
.att-inline .att-media { width: 112px; height: auto; min-height: 70px; flex: none; }
.att-inline.att-k-file:not(:has(img)):not(:has(video)) .att-media { width: 64px; }
.att-inline .att-media.att-audio { width: 100%; }
.att-inline .att-play { width: 32px; height: 32px; margin: -16px 0 0 -16px; }
.att-inline .att-play .ic { width: 14px; height: 14px; }
.att-inline .att-overlay, .att-inline .att-dur { display: none; }
.att-inline .att-info { flex: 1; min-width: 0; align-items: center; }
.att-inline .att-badge { display: none; }
.att-inline .att-private span { display: none; }
.att-inline.is-playing { flex-direction: column; max-width: 100%; }
.att-inline.is-playing .att-media { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.comment-files summary { cursor: pointer; padding: 4px 0 10px; }

/* Comments */
.side-tabs { display: flex; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.side-tab { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; font-size: .93rem; color: var(--text-2); }
.side-tab:hover { background: var(--hover); }
.side-tab.is-active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.side-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.task-side { gap: 12px; }
.comments-panel { gap: 12px; }
.comments { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.comment { display: flex; gap: 10px; }
.comment.is-new { animation: tl-flash 1.6s ease; }
@keyframes tl-flash { from { background: var(--accent-soft); } to { background: transparent; } }
.comment:target { background: var(--accent-soft); border-radius: 10px; box-shadow: 0 0 0 6px var(--accent-soft); }
.comment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.comment-head { display: flex; align-items: center; gap: 6px; font-size: .93rem; }
.comment-tools { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0; color: var(--text-3); transition: opacity .1s; }
.comment:hover .comment-tools, .comment:focus-within .comment-tools { opacity: 1; }
.comment-body { font-size: .95rem; line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
.comment-body a { word-break: break-all; }
.mention { color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.comment-atts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.comment-edit { display: flex; flex-direction: column; gap: 6px; }
.comment-edit textarea { width: 100%; min-height: 70px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--text); resize: vertical; }
.comment-edit div { display: flex; gap: 6px; justify-content: flex-end; }
.composer { position: sticky; bottom: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.composer textarea { border: 0; outline: none; background: transparent; resize: none; font-size: .95rem; color: var(--text); min-height: 44px; max-height: 240px; padding: 4px 2px; }
.composer-bar { display: flex; align-items: center; gap: 4px; color: var(--text-3); }
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: .82rem; color: var(--text-2); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.file-chip button { border: 0; background: none; color: inherit; width: 22px; height: 22px; border-radius: 50%; padding: 0; cursor: pointer; }
.file-chip button:hover { background: var(--hover); }
.mention-menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; }
.mention-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: .93rem; color: var(--text); }
.mention-menu button.is-sel, .mention-menu button:hover { background: var(--hover); }
.comments-empty { margin: 4px 0; }

/* Embed dialog */
.dialog-embed { width: min(1100px, calc(100% - 24px)); height: min(86vh, 900px); padding: 0; display: none; }
.dialog-embed[open] { display: flex; flex-direction: column; }
.embed-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.embed-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.embed-frame { flex: 1; background: var(--surface-2); }
.embed-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Inbox */
.inbox { flex: 1; }
.inbox-list { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 8px; max-width: 860px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
.notif:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); text-decoration: none; }
.notif.is-unread { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.notif-line { font-size: .95rem; color: var(--text-2); }
.notif-line b { color: var(--text); font-weight: 600; }
.notif-body { font-size: .9rem; color: var(--text-2); border-left: 3px solid var(--border); padding-left: 10px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-meta { display: flex; align-items: center; gap: 6px; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }

/* Settings toggles */
.toggle-list { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 2px 16px; margin: 6px 0 14px; }
.toggle-row { display: flex; align-items: center; gap: 14px; min-height: 58px; border-bottom: 1px solid var(--border); cursor: pointer; }
.toggle-list .toggle-row:last-child { border-bottom: 0; }
.toggle-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toggle-row small { font-size: .82rem; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.email-settings { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.email-settings .toggle-row { border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; background: var(--surface); margin-bottom: 8px; }

/* Live refresh bar */
.refresh-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 55; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .93rem; max-width: calc(100% - 24px); }

@media (max-width: 900px) {
  .att-grid { grid-template-columns: 1fr; }
  .att-media { height: 170px; }
  .comment-tools { opacity: 1; }
  .inbox-list { padding: 14px 16px 32px; }
  .composer { bottom: env(safe-area-inset-bottom); }
}

/* ============ Phase 3 ============ */
.space-checks { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.space-checks legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.space-check { display: inline-flex; align-items: center; gap: 8px; font-size: .93rem; min-height: 30px; cursor: pointer; }
.space-check input { accent-color: var(--accent); }
.guest-access { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); }
.guest-access .ic { width: 13px; height: 13px; }
.comment.is-internal .comment-main { background: color-mix(in srgb, var(--warn) 8%, transparent); border-radius: 10px; padding: 6px 10px; margin: -6px -10px; }
.internal-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; color: var(--warn); }
.internal-badge .ic { width: 12px; height: 12px; }
.internal-toggle { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: 999px; font-size: .82rem; color: var(--text-3); cursor: pointer; user-select: none; }
.internal-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.internal-toggle .ic { width: 13px; height: 13px; }
.internal-toggle:has(input:checked) { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); color: var(--warn); font-weight: 600; }
.internal-toggle:has(input:focus-visible) { outline: 2px solid var(--accent); }
.composer:has([data-internal]:checked) { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }

/* Calendar */
.calendar-page { flex: 1; display: flex; flex-direction: column; }
.cal-filter select { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 10px; max-width: 240px; }
.cal-wrap { flex: 1; padding: 16px 24px 32px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-month { font-size: 1.15rem; font-weight: 600; min-width: 150px; text-align: center; }
.cal-body { display: flex; gap: 16px; align-items: flex-start; min-width: 0; }
.cal-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-dow { background: var(--surface-2); padding: 8px 10px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.cal-day { background: var(--surface); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.is-weekend { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.cal-day.is-out { background: var(--bg); }
.cal-day.is-out .cal-num { color: var(--text-3); opacity: .6; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.cal-num { font-size: .86rem; font-weight: 500; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.cal-day.is-today .cal-num { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-add { opacity: 0; color: var(--text-3); }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-tasks { display: flex; flex-direction: column; gap: 3px; min-height: 24px; flex: 1; }
.cal-chip { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: .8rem; line-height: 1.3; text-decoration: none; min-width: 0; border: 1px solid transparent; cursor: pointer; }
.cal-chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); text-decoration: none; }
.cal-chip .cal-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cal-chip .cal-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip .cal-rep { width: 11px; height: 11px; color: var(--text-3); }
.cal-chip.is-done .cal-title { text-decoration: line-through; color: var(--text-3); }
.cal-chip.is-urgent { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.cal-day.is-past:not(.is-today) .cal-chip:not(.is-done) .cal-title { color: var(--danger); }
.cal-quick input { width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--text); font-size: .8rem; outline: none; }
.cal-tray { width: 240px; flex: none; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 16px; max-height: calc(100vh - 140px); overflow-y: auto; }
.cal-tray h3 { font-size: .93rem; font-weight: 600; display: flex; gap: 6px; align-items: baseline; }
.tray-list { min-height: 60px; }
.cal-agenda { display: none; flex-direction: column; gap: 14px; }
.agenda-day h3 { font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.agenda-day.is-today h3 { color: var(--accent-text); }
.agenda-dow { color: var(--text-3); font-weight: 500; }
.agenda-list { display: flex; flex-direction: column; gap: 6px; }
.agenda-list .cal-chip { padding: 10px 12px; font-size: .93rem; background: var(--surface); border-color: var(--border); }

/* Templates */
.template-banner { display: flex; gap: 12px; align-items: flex-start; margin: 14px 24px 0; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); font-size: .93rem; color: var(--text-2); }
.template-banner .ic { color: var(--accent-text); margin-top: 2px; }
.template-banner b { color: var(--text); }
.tpl-save { border: 1px solid var(--border); border-radius: 10px; margin: 4px 0 12px; }
.tpl-save > summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; font-weight: 500; list-style: none; }
.tpl-save > summary::-webkit-details-marker { display: none; }
.tpl-save-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.tpl-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; flex: none; }

@media (max-width: 1100px) {
  .cal-tray { display: none; }
}
@media (max-width: 760px) {
  .cal-wrap { padding: 12px 16px 28px; }
  .cal-body { display: none; }
  .cal-agenda { display: flex; }
  .template-banner { margin: 12px 16px 0; }
}
.task-page[data-readonly] select:disabled, .task-page[data-readonly] input:disabled, .task-page[data-readonly] textarea:disabled { cursor: default; opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); background: transparent; border-color: transparent; appearance: none; -webkit-appearance: none; }
.task-page[data-readonly] .picker-btn { cursor: default; }
.task-page[data-readonly] .picker-btn:hover { background: transparent; }
.task-page[data-readonly] .desc:disabled { border-color: var(--border); background: var(--surface); }
.composer-bar:has(.internal-toggle) .hide-sm { display: none; }
