/* ##########################################################################
   DESIGN SYSTEM — verbatim copy of public/css/app.css
   ########################################################################## */
/* ==========================================================================
   Liaison — design system
   Flat, clean, no gradients. IBM Plex. Light + dark. RTL via logical props.
   ========================================================================== */

:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #EFF1F4;
  --border: #E3E6EB;
  --border-strong: #DDE1E8;
  --text: #16181D;
  --text-2: #5B6270;
  --text-3: #8A9099;
  --text-4: #A6ACB5;
  --accent: #1B5FD9;
  --accent-hover: #1751BE;
  --accent-soft: #EAF1FD;
  --accent-border: #D3E2FA;
  --on-accent: #FFFFFF;
  --green: #0B7A46;
  --green-soft: #E7F6EE;
  --green-border: #BFE7D2;
  --amber: #8A6210;
  --amber-soft: #FFF6E0;
  --amber-border: #F1DDA8;
  --red: #C42121;
  --red-soft: #FDECEC;
  --red-border: #F6C9C9;
  --ink: #16181D;
  --on-ink: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 28px -12px rgba(16, 24, 40, .22);
  --shadow-lg: 0 24px 60px -20px rgba(16, 24, 40, .35);
  --ring: 0 0 0 3px rgba(27, 95, 217, .18);
  --bubble-mine: #1B5FD9;
  --bubble-mine-text: #FFFFFF;
  --bubble-theirs: #FFFFFF;
  --backdrop: rgba(16, 18, 24, .42);

  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 8px;
  --radius: 11px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --gutter: clamp(14px, 3.2vw, 28px);
  --topbar-h: 112px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0E1014;
  --surface: #161920;
  --surface-2: #1B1F27;
  --surface-3: #222731;
  --border: #252A34;
  --border-strong: #2F3541;
  --text: #ECEEF2;
  --text-2: #A7AEBA;
  --text-3: #7D8491;
  --text-4: #5E6571;
  --accent: #4D8DFF;
  --accent-hover: #6A9FFF;
  --accent-soft: #15213A;
  --accent-border: #22365C;
  --on-accent: #FFFFFF;
  --green: #3CC487;
  --green-soft: #0F2A1F;
  --green-border: #1B4A35;
  --amber: #E5B54A;
  --amber-soft: #2A2210;
  --amber-border: #4A3C17;
  --red: #FF6B6B;
  --red-soft: #321717;
  --red-border: #5A2626;
  --ink: #ECEEF2;
  --on-ink: #0E1014;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(77, 141, 255, .25);
  --bubble-mine: #2A63CF;
  --bubble-mine-text: #FFFFFF;
  --bubble-theirs: #1B1F27;
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.icon { flex: none; display: block; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Motion: quick fades ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-2px); } }
@keyframes fadePlain { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes panelIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn .2s var(--ease) both; }
.fade-out { animation: fadeOut .15s ease both; pointer-events: none; }
.page { animation: fadeIn .22s var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }
.container-narrow { max-width: 860px; }
.main { flex: 1; padding-block: clamp(18px, 3.4vw, 32px) 80px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 14px); }
.stack-lg { --gap: clamp(20px, 3vw, 30px); }
.stack-sm { --gap: 8px; }
.row { display: flex; align-items: center; gap: var(--gap, 10px); flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }
.grid { display: grid; gap: clamp(12px, 1.6vw, 18px); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 300px)), 1fr)); }
.grid-2 { display: grid; gap: clamp(12px, 1.6vw, 18px); grid-template-columns: 1fr; }
@media (min-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .sticky-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
}
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.center { text-align: center; }

/* ---------- Typography ---------- */
.h1 { font: 600 clamp(24px, 3.4vw, 34px)/1.15 var(--font); letter-spacing: -.026em; text-wrap: balance; }
.h2 { font: 600 clamp(18px, 2.2vw, 22px)/1.25 var(--font); letter-spacing: -.018em; }
.h3 { font: 600 16px/1.3 var(--font); letter-spacing: -.01em; }
.h4 { font: 600 14px/1.35 var(--font); }
.lead { font-size: clamp(13.5px, 1.5vw, 15px); line-height: 1.55; color: var(--text-2); text-wrap: pretty; max-width: 68ch; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.eyebrow { font: 600 10.5px/1.2 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
[dir="rtl"] .eyebrow { letter-spacing: 0; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.prose { color: var(--text-2); font-size: 14px; line-height: 1.6; text-wrap: pretty; }
.prose p + p { margin-top: 8px; }
.prose ul { padding-inline-start: 18px; margin-block: 6px; }
.prose li { margin-block: 3px; }
.prose-lg { font-size: clamp(15px, 1.8vw, 17px); color: var(--text); }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-row { display: flex; align-items: center; gap: 10px; min-height: 62px; padding-block: 9px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); min-height: 44px; }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-name { font: 700 17px/1 var(--font); letter-spacing: -.015em; }
.brand-sub { font: 500 11px/1 var(--font); color: var(--text-3); padding: 4px 7px; border: 1px solid var(--border); border-radius: 6px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: flex; align-items: center; gap: 7px; min-height: 46px; padding: 0 12px; color: var(--text-2); font: 500 13.5px/1 var(--font); border-bottom: 2.5px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; background: none; border-top: 0; border-inline: 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab .badge { margin-inline-start: 2px; }

/* Language segmented control + icon buttons */
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; gap: 2px; }
.seg button, .seg a { border: 0; background: none; padding: 0 10px; min-height: 34px; min-width: 36px; border-radius: 7px; font: 600 11.5px/1 var(--font); color: var(--text-2); display: grid; place-items: center; transition: background .15s, color .15s; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
[data-theme="dark"] .seg .on { background: var(--surface-3); }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); transition: background .15s, color .15s, border-color .15s; flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--text-4); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.plain:hover { background: var(--surface-3); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 8px; }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }
[data-theme="dark"] .theme-icon-light { display: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); display: grid; place-items: center; font: 600 12px/1 var(--font); flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 15px; }
.avatar.ink { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* Context bar (dark strip like the reference) */
.ctxbar { background: var(--ink); color: var(--on-ink); }
.ctxbar .container { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; padding-block: 7px; }
.ctxbar .eyebrow { color: color-mix(in srgb, var(--on-ink) 55%, transparent); }
.ctxbar-title { font-weight: 600; font-size: 13.5px; }
.ctxbar .btn { min-height: 32px; font-size: 12px; background: transparent; color: var(--on-ink); border-color: color-mix(in srgb, var(--on-ink) 28%, transparent); }
.ctxbar .btn:hover { background: color-mix(in srgb, var(--on-ink) 12%, transparent); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(16px, 2.2vw, 22px); box-shadow: var(--shadow-sm); }
.card-sm { border-radius: var(--radius-md); padding: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.card-link { display: flex; flex-direction: column; gap: 12px; color: inherit; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { color: inherit; border-color: var(--accent); box-shadow: 0 6px 22px -10px rgba(27, 95, 217, .38); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .h3 { flex: 1; min-width: 0; }
.tile-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); display: grid; place-items: center; }
.tile-icon.green { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.tile-icon.amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.tile-icon.red { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.tile-icon.gray { background: var(--surface-3); border-color: var(--border); color: var(--text-2); }
.tile-icon.sm { width: 34px; height: 34px; border-radius: 9px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 4px 0; }
.list-rows > * + * { border-top: 1px solid var(--border); }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px clamp(14px, 2vw, 18px); color: inherit; min-height: 60px; }
a.row-item:hover { background: var(--surface-2); color: inherit; }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-value { font: 600 clamp(22px, 3vw, 28px)/1 var(--font); letter-spacing: -.02em; }
.stat-label { font-size: 12.5px; color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent; font: 600 13.5px/1 var(--font); white-space: nowrap; transition: background .15s, border-color .15s, color .15s, opacity .15s; text-decoration: none; user-select: none; }
.btn:disabled, .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-4); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.btn-soft:hover { border-color: var(--accent); color: var(--accent); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { opacity: .9; color: var(--on-ink); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-border); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { opacity: .92; color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: block; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }

.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: 600 12.5px/1.2 var(--font); display: inline-flex; align-items: center; gap: 5px; min-height: 30px; }
.link-btn:hover { color: var(--accent-hover); }
.link-btn.muted { color: var(--text-3); }
.link-btn.muted:hover { color: var(--text); }

/* Comment trigger */
.cbtn { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: 600 12px/1 var(--font); transition: border-color .15s, color .15s, background .15s; }
.cbtn:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.cbtn .count:empty, .cbtn .count[data-n="0"] { display: none; }
.cbtn.has { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }

/* ---------- Badges & pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; min-height: 24px; border-radius: 999px; font: 600 11.5px/1 var(--font); white-space: nowrap; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-blue { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.pill-green { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.pill-amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.pill-red { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.pill-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pill-live .dot { animation: pulse 1.4s ease infinite; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font: 700 10.5px/1 var(--font); }
.code-chip { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); font: 600 15px/1 var(--mono); letter-spacing: .08em; color: var(--text); }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s var(--ease); }
.progress.green > span { background: var(--green); }
.progress-lg { height: 12px; }
.ring { position: relative; width: var(--size, 76px); height: var(--size, 76px); flex: none; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--accent); transition: stroke-dashoffset .5s var(--ease); }
.ring.green .value { stroke: var(--green); }
.ring span { font: 600 17px/1 var(--font); letter-spacing: -.02em; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.label { font: 600 12.5px/1.2 var(--font); color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-3); }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.error { font-size: 12.5px; color: var(--red); font-weight: 500; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 0 13px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s; -webkit-appearance: none; appearance: none; }
.textarea { padding: 11px 13px; min-height: 96px; line-height: 1.55; resize: vertical; }
.textarea.lg { min-height: 180px; }
.select { padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A9099' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
[dir="rtl"] .select { background-position: left 12px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); }
.input.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input-code { font: 600 20px/1 var(--mono); letter-spacing: .14em; text-align: center; text-transform: uppercase; min-height: 56px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) {
  .input, .select, .textarea { font-size: 16px; } /* no iOS zoom */
}

/* Segmented choice (prompt vs form) */
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 520px) { .choice { grid-template-columns: 1fr; } }

/* File drop zone (HTML import) */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 26px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .tile-icon { pointer-events: none; }
.dropzone.has-file { border-style: solid; border-color: var(--green-border); background: var(--green-soft); }
.dropzone [data-drop-name] { font-weight: 600; color: var(--text); word-break: break-all; }
.source-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Alerts / flash ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; }
.alert-info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }
.alert-info .icon { color: var(--accent); }
.alert-warn { background: var(--amber-soft); border-color: var(--amber-border); }
.alert-warn .icon { color: var(--amber); }
.alert-error { background: var(--red-soft); border-color: var(--red-border); }
.alert-error .icon { color: var(--red); }
.alert-success { background: var(--green-soft); border-color: var(--green-border); }
.alert-success .icon { color: var(--green); }

.toast-wrap { position: fixed; z-index: 90; inset-inline: 0; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding-inline: 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font: 500 13.5px/1.3 var(--font); box-shadow: var(--shadow-lg); animation: sheetIn .2s var(--ease) both; max-width: 520px; }
.toast.error { background: var(--red); color: #fff; }

/* ---------- Empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: clamp(28px, 5vw, 48px) 16px; color: var(--text-2); }
.empty .tile-icon { width: 52px; height: 52px; border-radius: 14px; }
.empty-inline { padding: 14px; border-radius: var(--radius-md); border: 1px dashed var(--border-strong); color: var(--text-3); font-size: 13px; text-align: center; }

/* ---------- Page header ---------- */
.page-head { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head .stack { --gap: 8px; max-width: 720px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font: 500 13px/1 var(--font); min-height: 32px; }
.back:hover { color: var(--text); }

/* Section tabs inside a page */
.ptabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow-x: auto; scrollbar-width: none; position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20; box-shadow: var(--shadow-sm); }
.ptabs::-webkit-scrollbar { display: none; }
.ptab { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 9px; border: 0; background: none; color: var(--text-2); font: 600 13px/1 var(--font); white-space: nowrap; transition: background .15s, color .15s; }
.ptab:hover { color: var(--text); }
.ptab.active { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 520px) { .ptab { padding: 0 10px; font-size: 12.5px; gap: 5px; } .step-main { gap: 10px; } }
.tab-panel { animation: fadeIn .2s var(--ease) both; }

/* ---------- Overview questions (client) ---------- */
.qgrid { display: grid; gap: clamp(10px, 1.4vw, 16px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.qcard { display: flex; flex-direction: column; gap: 10px; }
.qcard-head { display: flex; align-items: center; gap: 10px; }
.qnum { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font: 600 12px/1 var(--mono); flex: none; }
.qtitle { font: 600 15px/1.3 var(--font); flex: 1; min-width: 0; }
.qcard .prose { font-size: 14px; }
.mini-steps { display: flex; flex-direction: column; gap: 6px; }
.mini-step { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
.mini-step .icon { margin-top: 1px; }

/* Hero (project) */
.hero { display: flex; gap: clamp(14px, 3vw, 24px); align-items: center; flex-wrap: wrap; }
.hero-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Plan ---------- */
.plan { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.step { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: border-color .15s; }
.step.is-done { background: var(--surface-2); }
.step.is-in_progress { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-border), var(--shadow-sm); }
.step.is-blocked { border-color: var(--red-border); }
.step-main { display: flex; gap: 12px; padding: clamp(14px, 2vw, 18px); }
.step-num { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font: 600 13px/1 var(--mono); background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.step-num::before { content: counter(step); }
.is-done .step-num { background: var(--green); border-color: var(--green); color: #fff; }
.is-done .step-num::before { content: '✓'; font-family: var(--font); }
.is-in_progress .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.is-blocked .step-num { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.step-title { font: 600 15.5px/1.35 var(--font); letter-spacing: -.01em; }
.is-done .step-title { color: var(--text-2); }
.step-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.step-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tech { border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); padding: 10px 12px; }
.tech .eyebrow { margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.step-todos { border-top: 1px solid var(--border); padding: 10px clamp(14px, 2vw, 18px) 14px; display: flex; flex-direction: column; gap: 10px; }
.step-edit { border-top: 1px solid var(--border); padding: clamp(14px, 2vw, 18px); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
details.disclosure > summary { list-style: none; cursor: pointer; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] .rot { transform: rotate(180deg); }
.rot { transition: transform .15s; }

/* ---------- To-dos ---------- */
.todo-list { display: flex; flex-direction: column; gap: 2px; }
.todo-list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.todo { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; border-radius: 9px; transition: background .15s; }
.todo:hover { background: var(--surface-2); }
.todo-check { position: relative; flex: none; width: 22px; height: 22px; margin-top: 1px; }
.todo-check input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; width: 38px; height: 38px; margin: 0; }
.todo-check span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--surface); transition: background .15s, border-color .15s; color: transparent; }
.todo-check input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.todo-check input:focus-visible + span { box-shadow: var(--ring); }
.todo-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.45; padding-top: 2px; word-break: break-word; }
.todo.done .todo-text { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.todo-actions { display: flex; gap: 2px; align-items: center; flex: none; }
.todo-add { display: flex; gap: 6px; margin-top: 4px; }
.todo-add .input { min-height: 38px; font-size: 13.5px; }
.todo-progress { font: 600 11.5px/1 var(--mono); color: var(--text-3); }

/* ---------- Actions (needs & decisions) ---------- */
.action { display: flex; flex-direction: column; gap: 10px; }
.action.is-done { opacity: .85; }
.options { display: grid; gap: 8px; }
.option { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; min-height: 48px; font-size: 13.5px; }
.option:hover { border-color: var(--accent); }
.option input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option.chosen { border-color: var(--green); background: var(--green-soft); }

/* ---------- Activity ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding: 9px 0; font-size: 13px; line-height: 1.45; }
.tl-item + .tl-item { border-top: 1px dashed var(--border); }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); margin-top: 6px; flex: none; }
.tl-dot.client { background: var(--accent); }

/* ---------- Bottom sheet / side panel ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: var(--backdrop); animation: fadePlain .18s ease both; }
.sheet { position: fixed; z-index: 71; inset-inline: 0; bottom: 0; max-height: 88dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); animation: sheetIn .22s var(--ease) both; padding-bottom: env(safe-area-inset-bottom); }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px; border-bottom: 1px solid var(--border); }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px 16px; overscroll-behavior: contain; }
.sheet-foot { border-top: 1px solid var(--border); padding: 10px 12px; background: var(--surface); }
@media (min-width: 900px) {
  .sheet { inset-inline: auto 0; inset-block: 0; width: 440px; max-height: none; border-radius: 0; animation-name: panelIn; border-inline-start: 1px solid var(--border); }
  [dir="rtl"] .sheet { inset-inline: auto 0; }
  .sheet-grip { display: none; }
}

/* Modal */
.modal { position: fixed; z-index: 71; inset: 0; display: grid; place-items: end center; padding: 0; pointer-events: none; }
.modal-card { pointer-events: auto; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheetIn .2s var(--ease) both; box-shadow: var(--shadow-lg); }
@media (min-width: 640px) { .modal { place-items: center; padding: 20px; } .modal-card { border-radius: 18px; } }

/* ---------- Comments ---------- */
.comments { display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; animation: fadeIn .2s var(--ease) both; }
.comment .avatar { width: 32px; height: 32px; font-size: 11px; }
.comment-body { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 9px 12px; }
[dir="rtl"] .comment-body { border-radius: 14px 4px 14px 14px; }
.comment.mine .comment-body { background: var(--accent-soft); border-color: var(--accent-border); }
.comment-meta { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; flex-wrap: wrap; }
.comment-meta strong { color: var(--text); font-weight: 600; font-size: 12.5px; }
.comment-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.translated-note { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); }
.translated-note button { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 11px; }

/* ---------- Composer & voice recorder (WhatsApp-like) ---------- */
.composer { display: flex; align-items: flex-end; gap: 8px; position: relative; }
.composer-box { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 4px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 22px; padding: 3px 4px 3px 14px; transition: border-color .15s, box-shadow .15s; }
[dir="rtl"] .composer-box { padding: 3px 14px 3px 4px; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; padding: 9px 0; max-height: 140px; min-height: 38px; line-height: 1.4; font-size: 15px; outline: none; }
.composer .icon-btn { border-radius: 50%; border: 0; background: transparent; width: 38px; height: 38px; }
.composer .icon-btn:hover { background: var(--surface-3); }
.send-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; transition: background .15s, transform .12s; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(.94); }
.send-btn.recording { background: var(--red); transform: scale(1.12); }
.send-btn .i-send { display: none; }
.composer.has-text .send-btn .i-send { display: block; }
.composer.has-text .send-btn .i-mic { display: none; }
.recorder { position: absolute; inset: 0; inset-inline-end: 54px; display: none; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px; padding: 0 8px 0 14px; z-index: 2; animation: fadePlain .15s ease both; }
.composer.is-recording .recorder { display: flex; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s ease infinite; flex: none; }
.rec-time { font: 600 13.5px/1 var(--mono); min-width: 40px; }
.rec-wave { flex: 1; min-width: 0; height: 26px; display: flex; align-items: center; gap: 2px; overflow: hidden; justify-content: flex-end; }
.rec-wave i { display: block; width: 3px; border-radius: 2px; background: var(--text-3); flex: none; }
.rec-hint { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.rec-hint.cancel { color: var(--red); }
.recorder .rec-locked { display: none; gap: 4px; }
.composer.is-locked .rec-locked { display: flex; }
.composer.is-locked .rec-hint { display: none; }
.composer.is-locked .send-btn .i-mic { display: none; }
.composer.is-locked .send-btn .i-send { display: block; }
.composer.is-locked .send-btn { background: var(--accent); transform: none; }
.rec-lock { position: absolute; inset-inline-end: 4px; bottom: 58px; width: 38px; padding: 10px 0; border-radius: 19px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); display: none; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); }
.composer.is-recording:not(.is-locked) .rec-lock { display: flex; animation: fadeIn .2s ease both; }

/* Audio player */
.audio { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 300px; padding: 2px 0; }
.audio-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.audio-track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.audio-bar { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.audio-bar::before { content: ''; position: absolute; inset-inline: 0; height: 4px; border-radius: 4px; background: color-mix(in srgb, currentColor 22%, transparent); }
.audio-bar span { position: absolute; inset-inline-start: 0; height: 4px; border-radius: 4px; background: currentColor; width: 0; }
.audio-bar b { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: currentColor; inset-inline-start: 0; margin-inline-start: -6px; }
.audio-time { font: 500 11px/1 var(--mono); opacity: .75; }
.bubble.mine .audio-btn { background: #fff; color: var(--bubble-mine); }

/* ---------- Chat ---------- */
.chat-shell { display: grid; grid-template-columns: 1fr; height: calc(100dvh - var(--topbar-h)); }
@media (min-width: 900px) { .chat-shell.with-list { grid-template-columns: 320px minmax(0, 1fr); } }
.chat-list { border-inline-end: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.chat-list-item { display: flex; gap: 11px; align-items: center; padding: 12px 16px; color: inherit; border-bottom: 1px solid var(--border); min-height: 70px; }
.chat-list-item:hover { background: var(--surface-2); color: inherit; }
.chat-list-item.active { background: var(--accent-soft); }
.chat-room { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 62px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px clamp(12px, 3vw, 28px); display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.chat-foot { padding: 10px clamp(10px, 3vw, 28px) calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.chat-day { align-self: center; margin: 10px 0 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.bubble-row { display: flex; animation: fadeIn .18s var(--ease) both; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 16px; background: var(--bubble-theirs); border: 1px solid var(--border); box-shadow: var(--shadow-sm); font-size: 14.5px; line-height: 1.45; word-break: break-word; }
.bubble.mine { background: var(--bubble-mine); color: var(--bubble-mine-text); border-color: transparent; border-end-end-radius: 5px; }
.bubble:not(.mine) { border-end-start-radius: 5px; }
.bubble-text { white-space: pre-wrap; }
.bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 3px; font-size: 10.5px; opacity: .7; }
.bubble.mine .bubble-meta .seen { color: #A7F3D0; opacity: 1; }
.bubble .translated-note { color: inherit; opacity: .75; margin-top: 4px; }
.bubble.mine .translated-note button { color: #fff; text-decoration: underline; }
.bubble-file { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: color-mix(in srgb, currentColor 8%, transparent); color: inherit; min-width: 200px; }
.bubble-file:hover { color: inherit; }
.bubble-img { border-radius: 10px; max-height: 280px; width: auto; margin-bottom: 4px; }
.chat-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-16px); }
.upload-preview { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }

/* ---------- Slideshow ---------- */
.deck { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.deck-top { display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--border); min-height: 60px; }
.deck-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: clamp(14px, 3vw, 36px) var(--gutter); overflow-y: auto; touch-action: pan-y; }
.slide { width: 100%; max-width: 920px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-md); padding: clamp(22px, 5vw, 56px); display: none; flex-direction: column; gap: 18px; min-height: min(560px, 100%); }
.slide.active { display: flex; animation: fadeIn .22s var(--ease) both; }
.slide-title { font: 600 clamp(24px, 4.4vw, 42px)/1.12 var(--font); letter-spacing: -.03em; text-wrap: balance; }
.slide-body { font-size: clamp(15px, 2vw, 19px); line-height: 1.6; color: var(--text-2); text-wrap: pretty; }
.slide-body ul { padding-inline-start: 22px; }
.slide-foot { margin-top: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 8px; }
.deck-nav { display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.dots { flex: 1; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; min-width: 0; }
.dots button { width: 8px; height: 8px; padding: 0; border-radius: 4px; border: 0; background: var(--border-strong); transition: width .2s var(--ease), background .2s; }
.dots button.on { width: 22px; background: var(--accent); }
.deck-count { font: 600 12.5px/1 var(--mono); color: var(--text-3); }
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); font: 600 11px/1 var(--mono); color: var(--text-3); }
@media (max-width: 640px) { .hide-sm { display: none !important; } .deck-nav .btn { padding: 0 12px; } }
@media (min-width: 641px) { .show-sm { display: none !important; } }

/* ---------- Auth / landing ---------- */
.auth { flex: 1; display: grid; place-items: center; padding: clamp(24px, 6vw, 64px) var(--gutter); }
.auth-card { width: 100%; max-width: 440px; }
.feature-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.feature { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); }

/* Generating */
.gen { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: clamp(30px, 6vw, 60px) 16px; }
.gen .spinner { width: 28px; height: 28px; border-width: 3px; color: var(--accent); }
.skeleton { height: 12px; border-radius: 6px; background: var(--surface-3); animation: pulse 1.4s ease infinite; }

/* Pagination (Laravel default markup simplified) */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

/* Footer */
.footer { padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom)); text-align: center; color: var(--text-3); font-size: 12px; }

@media print {
  .topbar, .ptabs, .cbtn, .btn, .footer { display: none !important; }
  body { background: #fff; }
}

/* ---------- Client to-do lists (outside projects) ---------- */
.task-filters { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.task-filters::-webkit-scrollbar { display: none; }
.task-filters button { white-space: nowrap; gap: 6px; display: inline-flex; align-items: center; }
.task-filter-count { font: 600 10.5px/1 var(--mono); color: var(--text-3); }
.task-filters .on .task-filter-count { color: var(--accent); }
.task-list-head { display: flex; align-items: center; gap: 10px; padding: 14px clamp(14px, 2vw, 18px); border-bottom: 1px solid var(--border); }
.task-list-edit { padding: 10px clamp(14px, 2vw, 18px); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tasks { list-style: none; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 0 clamp(10px, 2vw, 14px); border-bottom: 1px solid var(--border); animation: fadeIn .18s var(--ease) both; }
.task:last-child { border-bottom: 0; }
.task-check { flex: none; padding-top: 13px; }
.task-check button { width: 24px; height: 24px; border-radius: 50%; border: 1.7px solid var(--border-strong); background: var(--surface); color: #fff; display: grid; place-items: center; padding: 0; transition: background .15s, border-color .15s; position: relative; }
.task-check button::after { content: ''; position: absolute; inset: -10px; } /* 44px touch target */
.task-check button:hover { border-color: var(--green); }
.is-completed .task-check button { background: var(--green); border-color: var(--green); }
.is-cancelled .task-check button { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-3); }
.task-details { flex: 1; min-width: 0; }
.task-details > summary { list-style: none; cursor: pointer; }
.task-details > summary::-webkit-details-marker { display: none; }
.task-details[open] .task-chevron { transform: rotate(180deg); }
.task-chevron { transition: transform .15s; color: var(--text-4); margin-top: 2px; }
.task-row { display: flex; align-items: flex-start; gap: 8px; padding: 12px 0; min-height: 52px; }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.task-title { font: 500 14.5px/1.4 var(--font); word-break: break-word; }
.is-completed .task-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.is-cancelled .task-title { color: var(--text-3); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-meta:empty { display: none; }
.task-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font: 500 11.5px/1 var(--font); color: var(--text-2); }
.task-chip.overdue { background: var(--red-soft); border-color: var(--red-border); color: var(--red); font-weight: 600; }
.task-body { display: flex; flex-direction: column; gap: 12px; padding: 0 0 16px; animation: fadeIn .18s var(--ease) both; }
.task-status-seg { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.task-status-seg .on.is-in_progress { color: var(--accent); }
.task-status-seg .on.is-completed { color: var(--green); }
.task-status-seg .on.is-cancelled { color: var(--text-2); }
.task-notes { white-space: pre-wrap; }
.task-timeline { display: flex; flex-direction: column; gap: 12px; }
.task-att { display: flex; gap: 10px; }
.task-att .avatar { width: 28px; height: 28px; font-size: 10.5px; }
.task-att .comment-meta { margin-bottom: 5px; }
.task-file { max-width: 360px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); }
.task-img { max-height: 220px; width: auto; border-radius: 10px; border: 1px solid var(--border); }
.task-foot { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.task-edit { padding: 14px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border); }
.task-add { display: flex; gap: 8px; padding: 12px clamp(14px, 2vw, 18px); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.task-add .input { min-height: 40px; flex: 1 1 200px; background: var(--surface); }
.task-add .task-add-due { flex: 0 1 210px; font-size: 13px; color: var(--text-2); }
@media (max-width: 520px) {
  .task-add > .input:not(.task-add-due) { flex-basis: 100%; }
  .task-add .task-add-due { flex: 1 1 0; min-width: 0; }
  .task-row { padding: 11px 0; }
}

