/* ─────────────────────────────────────────────────────────────
   Wave design system — plain CSS, no build step.
   Tokens → base → layout → components → pages → responsive
   ───────────────────────────────────────────────────────────── */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e5e8ee;
  --border-strong: #d3d8e1;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --faint: #98a2b3;

  --accent: #0f8b8d;
  --accent-hover: #0c7375;
  --accent-soft: #e4f4f4;
  --accent-ring: rgba(15, 139, 141, 0.28);

  --good: #16a34a;
  --good-soft: #e8f7ee;
  --warn: #d97706;
  --warn-soft: #fff4e5;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #e9f0fe;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.07), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
  --shadow-lg: 0 12px 40px -12px rgba(16, 24, 40, 0.25);

  --sidebar-w: 248px;
  --gutter: 28px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0 0 0.6em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding-inline-start: 1.2em; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 6px; }
[hidden] { display: none !important; }
.rtl { direction: rtl; text-align: start; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.dot { color: var(--faint); margin: 0 6px; }
.attn { color: var(--warn); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 20px; align-items: start; margin-top: 20px; }
.two-col-wide { grid-template-columns: 1.4fr 0.8fr; }
.sticky { position: sticky; top: 20px; }

/* ── brand ─────────────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #1fb2b5); color: #fff; box-shadow: var(--shadow-sm); }
.brand-lg { font-size: 22px; }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 12px; }

/* ── app layout ────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; background: var(--surface); border-inline-end: 1px solid var(--border); }
.sidebar-business { margin: 18px 4px 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14px; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-active { background: var(--accent-soft); color: var(--accent); }
.nav-active:hover { background: var(--accent-soft); color: var(--accent); }
.nav-count { margin-inline-start: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 20px; }
.nav-count-soft { background: var(--accent); }
.nav-count:empty, .nav-count-empty:empty { display: none; }
.notice-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.sidebar-user { display: flex; flex-direction: column; }
.sidebar-user-name { font-weight: 600; font-size: 14px; }
.sidebar-user-email { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-align: start; }
.link-btn:hover { text-decoration: underline; }
.topbar { display: none; }
.main { padding: 28px var(--gutter) 60px; max-width: 1180px; width: 100%; }
.main-wide { max-width: none; }

/* ── page header ───────────────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }

/* ── buttons ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; transition: background 0.15s, box-shadow 0.15s, transform 0.05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn[disabled], .btn.is-loading { opacity: 0.6; cursor: default; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(15, 139, 141, 0.3); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--good); border-color: var(--good); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--surface); border-color: #f3b4b4; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── cards ─────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-flush .card-head { padding: 18px 22px 0; }
.card-title { font-size: 16px; font-weight: 700; }
.card-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-actions { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* ── status / badges ───────────────────────────────────────── */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-working { background: var(--good-soft); color: #15803d; }
.status-working .status-dot { animation: pulse 1.4s ease-in-out infinite; }
.status-waiting { background: var(--warn-soft); color: #b45309; }
.status-idle { background: var(--surface-2); color: var(--text-2); }
.status-paused { background: var(--surface-2); color: var(--faint); }
.status-attention { background: var(--bad-soft); color: #b91c1c; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }
.badge-good { background: var(--good-soft); color: #15803d; }
.badge-warn { background: var(--warn-soft); color: #b45309; }
.badge-bad { background: var(--bad-soft); color: #b91c1c; }
.badge-info { background: var(--info-soft); color: #1d4ed8; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.pill { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }

/* ── avatar ────────────────────────────────────────────────── */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: linear-gradient(135deg, #e7f6f6, #d7eeee); color: var(--accent); font-weight: 700; overflow: hidden; }
.avatar-sm { width: 32px; height: 32px; font-size: 16px; }
.avatar-md { width: 40px; height: 40px; font-size: 20px; }
.avatar-lg { width: 52px; height: 52px; font-size: 27px; }
.avatar-xl { width: 68px; height: 68px; font-size: 36px; }
.avatar-initials { font-size: 0.5em; }
.avatar-emoji { line-height: 1; }

/* ── forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.input, .textarea, select.input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font: inherit; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.input:focus, .textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input[disabled] { background: var(--surface-2); color: var(--muted); }
.input-lg { font-size: 18px; font-weight: 600; }
.textarea { resize: vertical; min-height: 44px; line-height: 1.5; }
.textarea-lg { font-size: 17px; padding: 14px 16px; min-height: 120px; }
.form-error { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: #b91c1c; font-size: 13.5px; }
.form-error ul { margin: 4px 0 0; }

.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.toggle:hover { background: var(--surface-2); }
.toggle-disabled { opacity: 0.55; cursor: not-allowed; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { flex: none; position: relative; width: 38px; height: 22px; margin-top: 2px; border-radius: 999px; background: var(--border-strong); transition: background 0.15s; }
.toggle-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--accent-ring); }
.toggle-text { display: flex; flex-direction: column; }
.toggle-label { font-weight: 600; font-size: 14px; }
.toggle-desc { font-size: 12.5px; color: var(--muted); }

.radio-card { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.radio-card:hover { background: var(--surface-2); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 3px; accent-color: var(--accent); }
.radio-card > span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.radio-card .muted { font-size: 12.5px; }

.avatar-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.avatar-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.avatar-option span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; background: var(--surface-2); font-size: 22px; cursor: pointer; }
.avatar-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }

/* ── tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 18px 0 22px; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab-active { color: var(--accent); border-color: var(--accent); }
.tab-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 11px; line-height: 18px; text-align: center; }
.tab-active .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ── notices, empty states, kpis ───────────────────────────── */
.notice { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.notice-info { background: var(--info-soft); border-color: #cddcfd; color: #1e3a8a; }
.notice-good { background: var(--good-soft); border-color: #bfe8cc; color: #14532d; }
.notice-warn { background: var(--warn-soft); border-color: #fbd9a5; color: #7c2d12; }
.notice a, .notice .link-btn { color: inherit; font-weight: 600; text-decoration: underline; }

.empty { text-align: center; padding: 36px 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto; }
.empty-action { margin-top: 18px; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-hint { font-size: 11.5px; color: var(--faint); }
.kpi-warn .kpi-value { color: var(--warn); }
.kpi-muted .kpi-value { color: var(--faint); }

/* ── employee cards ────────────────────────────────────────── */
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.emp-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: inherit; box-shadow: var(--shadow-sm); transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
.emp-card:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--border-strong); }
.emp-card-top { display: flex; align-items: center; gap: 12px; }
.emp-card-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.emp-card-name { font-size: 17px; font-weight: 700; }
.emp-card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-card-status { display: flex; align-items: center; gap: 10px; min-width: 0; }
.emp-card-line { color: var(--text-2); font-size: 13.5px; min-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.emp-card-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }
.emp-card-stats strong { color: var(--text); }

/* ── employee header ───────────────────────────────────────── */
.emp-head { margin-bottom: 4px; }
.emp-head-row { display: flex; align-items: center; gap: 16px; }
.emp-head-id { flex: 1; min-width: 0; }
.emp-head-sub { display: flex; align-items: center; color: var(--muted); margin-top: 4px; font-size: 14px; }
.emp-head-actions { display: flex; gap: 8px; }

/* ── demo panel ────────────────────────────────────────────── */
.demo-panel { margin-top: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.demo-panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.demo-panel-head > div { flex: 1; }
.demo-form { display: flex; flex-direction: column; gap: 14px; }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.scenario { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: inherit; text-align: start; cursor: pointer; }
.scenario:hover, .scenario-active { border-color: var(--accent); background: var(--accent-soft); }
.scenario-label { font-weight: 600; font-size: 13px; }
.scenario-text { font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.demo-fields { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; }
.app-icon { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.app-icon-wa { background: #e7f8ec; color: #1f9d55; }
.app-icon-soon { color: var(--faint); }
.app-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.app-row-muted { opacity: 0.8; }

/* ── activity ──────────────────────────────────────────────── */
.activity { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.act-date { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); padding: 10px 0 6px; }
.act { display: grid; grid-template-columns: 62px 26px 1fr; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act-compact { padding: 6px 0; }
.act-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.act-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); }
.act-icon svg { width: 15px; height: 15px; }
.act-good .act-icon { background: var(--good-soft); color: #15803d; }
.act-warn .act-icon { background: var(--warn-soft); color: #b45309; }
.act-wait .act-icon { background: var(--info-soft); color: #1d4ed8; }
.act-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-msg { font-size: 14px; }
.act-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-link { font-size: 12px; }

/* ── approvals ─────────────────────────────────────────────── */
.approval { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.approval-message { border-inline-start: 3px solid var(--info); }
.approval-escalation { border-inline-start: 3px solid var(--warn); }
.approval-head { display: flex; align-items: center; gap: 10px; }
.approval-title { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.approval-title .muted { font-size: 12.5px; }
.approval-draft { padding: 12px 14px; border-radius: 12px; background: #f0fdf4; border: 1px solid #d1fae5; white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; }
.approval-reason { font-size: 14px; color: var(--text-2); }
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.approval-edit { display: flex; flex-direction: column; gap: 10px; }

/* ── conversations ─────────────────────────────────────────── */
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: inherit; }
.conv-item:hover { background: var(--surface-2); text-decoration: none; }
.conv-active { background: var(--accent-soft); }
.conv-active:hover { background: var(--accent-soft); }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conv-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.conv-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; max-height: calc(100vh - 120px); overflow-y: auto; }
.conv-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 60vh; }
.conv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.conv-head h2 { font-size: 16px; }
.conv-thread { flex: 1; padding: 18px; overflow-y: auto; max-height: 55vh; background: #f8fafb; background-image: radial-gradient(#e6ebef 0.8px, transparent 0.8px); background-size: 18px 18px; }
.conv-approvals { padding: 12px 18px 0; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); }
.conv-composers { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); }
.composer { display: flex; flex-direction: column; gap: 6px; }
.composer-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.composer-row { display: flex; gap: 8px; }
.composer-row .input { flex: 1; }
.conv-activity .card { max-height: calc(100vh - 120px); overflow-y: auto; }

.thread { display: flex; flex-direction: column; gap: 8px; }
.bubble-row { display: flex; }
.bubble-row-out { justify-content: flex-end; }
.bubble { max-width: 78%; padding: 9px 12px 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 14.5px; line-height: 1.5; }
.bubble-in { border-start-start-radius: 4px; }
.bubble-out { background: #dcf8e6; border-start-end-radius: 4px; }
.bubble-draft { background: #fff7e6; border: 1px dashed #f0c36b; }
.bubble-muted { opacity: 0.6; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble-meta { display: flex; gap: 8px; justify-content: flex-end; font-size: 11px; color: var(--muted); margin-top: 3px; }
.bubble-status { font-weight: 600; color: #b45309; }

/* ── tables & lists ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-compact th, .table-compact td { padding: 8px 10px; }
.check-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { position: relative; padding-inline-start: 24px; }
.check-list li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--accent); font-weight: 700; }
.check-list.small { font-size: 13px; }
.steps-list { display: flex; flex-direction: column; gap: 8px; padding-inline-start: 1.3em; font-size: 14px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.memory-list, .knowledge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.memory, .knowledge { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.memory:last-child, .knowledge:last-child { border-bottom: 0; }
.knowledge p { color: var(--text-2); font-size: 13.5px; white-space: pre-wrap; }
.knowledge-editing { background: var(--accent-soft); margin: 0 -22px; padding: 12px 22px; }

/* ── hire flow ─────────────────────────────────────────────── */
.hire-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.hire-aside h3 { font-size: 15px; margin-bottom: 10px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.review-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr); gap: 20px; align-items: start; }
.review-main { display: flex; flex-direction: column; gap: 16px; }
.review-side { display: flex; flex-direction: column; gap: 16px; }
.review-identity { display: flex; gap: 18px; align-items: flex-start; }
.review-identity-fields { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.understanding { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: #0b5c5e; }
.understanding-label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; opacity: 0.8; }

/* ── apps page ─────────────────────────────────────────────── */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.app-card .app-row { padding: 0; }
.app-card-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.app-card-soon { opacity: 0.7; }

/* ── auth ──────────────────────────────────────────────────── */
.auth-body { background: radial-gradient(1200px 500px at 50% -100px, #dff3f3, transparent), var(--bg); }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 440px; padding: 28px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .muted { margin-bottom: 18px; }
.auth-card form { margin-bottom: 16px; }
.error-card { text-align: center; padding: 40px; }
.error-code { font-size: 48px; font-weight: 800; color: var(--faint); }
.error-card h1 { font-size: 20px; margin: 8px 0 20px; }

/* ── marketing ─────────────────────────────────────────────── */
.marketing-body { background: var(--surface); }
.mk-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 6vw; }
.mk-nav { display: flex; align-items: center; gap: 18px; }
.mk-link { color: var(--text-2); font-weight: 600; }
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; padding: 48px 6vw 64px; }
.eyebrow { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em; margin-bottom: 18px; }
.hero h1 { font-size: clamp(34px, 4.6vw, 54px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.08; margin-bottom: 18px; }
.hero .accent { color: var(--accent); }
.lead { font-size: 18px; color: var(--text-2); max-width: 560px; margin-bottom: 26px; }
.hero-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-card { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 18px; box-shadow: var(--shadow-lg); }
.hero-card-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; font-weight: 600; }
.hero-emp { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 8px; }
.hero-emp-text { flex: 1; display: flex; flex-direction: column; font-size: 13.5px; }
.hero-emp-line { color: var(--text-2); font-size: 12.5px; }
.steps { padding: 40px 6vw; background: var(--bg); }
.steps h2, .cta-band h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; text-align: center; margin-bottom: 28px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 12px; }
.step h3 { font-size: 17px; margin-bottom: 6px; }
.step p { color: var(--text-2); }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding: 56px 6vw; }
.pillar h3 { font-size: 18px; margin-bottom: 8px; }
.pillar p { color: var(--text-2); }
.cta-band { text-align: center; padding: 56px 6vw 72px; background: linear-gradient(180deg, var(--bg), #e4f4f4); }
.cta-band h2 { margin-bottom: 20px; }
.mk-footer { padding: 24px 6vw; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* ── toasts ────────────────────────────────────────────────── */
.toasts { position: fixed; inset-inline-end: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { padding: 10px 14px; border-radius: 10px; background: #101828; color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in 0.2s ease-out; }
.toast-bad { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .conv-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .conv-side { display: none; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
  .topbar-nav { display: flex; gap: 4px; }
  .topbar-link { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
  .topbar-active { background: var(--accent-soft); color: var(--accent); }
  .main { padding: 18px 16px 48px; }
  .two-col, .two-col-wide, .hire-layout, .review-layout { grid-template-columns: 1fr; }
  .conv-layout { grid-template-columns: 1fr; }
  .conv-activity .card { max-height: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .steps-grid, .pillars { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .emp-head-row { flex-wrap: wrap; }
  .emp-head-actions { width: 100%; }
  .demo-fields { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .knowledge-editing { margin: 0 -16px; padding: 12px 16px; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .approval-actions .btn { flex: 1; }
  .btn-lg { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   v0.2 — RTL, language switch, tasks, content, apps, skills
   ═══════════════════════════════════════════════════════════════ */

/* ── RTL / Arabic ──────────────────────────────────────────── */
[dir="rtl"] body, .rtl-body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "IBM Plex Sans Arabic", "Cairo", -apple-system, BlinkMacSystemFont, Arial, "Segoe UI Emoji", "Apple Color Emoji", sans-serif; letter-spacing: 0; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { letter-spacing: 0; }
[dir="rtl"] .toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(-16px); }
[dir="rtl"] .back-arrow { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .act-time, [dir="rtl"] .bubble-meta { font-variant-numeric: tabular-nums; }
[dir="rtl"] .table th { letter-spacing: 0; text-transform: none; }
[dir="rtl"] .act-date, [dir="rtl"] .understanding-label, [dir="rtl"] .field-label, [dir="rtl"] .eyebrow { letter-spacing: 0; text-transform: none; }
[dir="rtl"] code, [dir="rtl"] .mono, [dir="rtl"] [dir="ltr"] { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .toast { text-align: start; }
[dir="rtl"] .brand-name { letter-spacing: 0; }
.lang-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.lang-switch:hover { color: var(--accent); text-decoration: none; }
.sidebar-lang { padding: 6px 12px; border-radius: 8px; margin-bottom: 8px; }
.sidebar-lang:hover { background: var(--surface-2); }
.topbar-lang { width: auto; padding: 0 8px; gap: 4px; font-size: 12px; }
.auth-lang { display: flex; justify-content: center; }
.mk-nav .lang-switch { color: var(--text-2); }

/* ── provider tiles ────────────────────────────────────────── */
.app-icon-whatsapp { background: #e7f8ec; color: #1f9d55; }
.app-icon-instagram { background: #fdeaf2; color: #c1275f; }
.app-icon-snapchat { background: #fff9d6; color: #8a7a00; }
.app-icon-youtube { background: #fde8e8; color: #c62828; }
.app-icon-task { background: var(--accent-soft); color: var(--accent); }
.app-row-select { cursor: pointer; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.app-row-select:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.app-row-select input { accent-color: var(--accent); }
.app-connected { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-top: 12px; }
.app-card-setup_required .app-icon, .app-card-expired .app-icon, .app-card-error .app-icon { box-shadow: inset 0 0 0 2px var(--warn-soft); }
.setup-panel { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); border: 1px solid #fde3bf; margin-top: 12px; font-size: 13.5px; }
.setup-panel code { background: rgba(255, 255, 255, 0.7); word-break: break-all; }
.cap-details { margin-top: 12px; }
.cap-details summary { cursor: pointer; }
.cap-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.cap { display: flex; gap: 8px; align-items: flex-start; }
.cap-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 1px; }
.cap-mark svg { width: 12px; height: 12px; }
.cap-on .cap-mark { background: var(--good-soft); color: #15803d; }
.cap-off { color: var(--muted); }
.cap-off .cap-mark { background: var(--surface-2); color: var(--faint); }
.app-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.row.wrap { flex-wrap: wrap; }

/* ── task composer & task detail ───────────────────────────── */
.task-panel .demo-form { gap: 12px; }
.task-panel .examples { margin-top: 0; }
.task-panel .field { max-width: 200px; }
.input-sm { padding: 6px 10px; font-size: 13px; }
.task-summary { font-size: 15px; line-height: 1.6; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: #0b4f51; white-space: pre-wrap; }
.h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 8px; }
[dir="rtl"] .h4 { text-transform: none; letter-spacing: 0; }
.table-wrap { overflow-x: auto; }

/* ── content queue ─────────────────────────────────────────── */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.content-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.content-card.is-highlighted, .approval.is-highlighted { box-shadow: 0 0 0 3px var(--accent-ring); }
.content-card-compact { padding: 10px 12px; }
.content-head { display: flex; align-items: center; gap: 10px; }
.content-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-media { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.content-body { font-size: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.content-body-compact { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.content-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; border-top: 1px solid var(--border); }
.attach-form { width: 100%; }
.media-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.media-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.media-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.media-item strong { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[type="file"].input { padding: 8px; }

/* ── approvals v0.2 ────────────────────────────────────────── */
.approval-action { border-inline-start: 3px solid var(--warn); }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); border: 1px solid #fde3bf; }

/* ── skills ────────────────────────────────────────────────── */
.skill-row { display: flex; flex-direction: column; gap: 4px; }
.skill-row .toggle { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.skill-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 12px 8px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 10px 10px; background: var(--surface-2); font-size: 12.5px; }
.skill-apps { display: inline-flex; align-items: center; gap: 6px; }
.skill-apps .app-icon { width: 22px; height: 22px; border-radius: 6px; }
.skill-apps .app-icon svg { width: 13px; height: 13px; }
.skill-generated .toggle { border-color: #cdebeb; background: #f3fbfb; }
.toggle-static { cursor: default; background: var(--surface-2); }
.skill-lock { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; margin-top: 2px; }
.skill-lock svg { width: 13px; height: 13px; }
.more-skills summary { cursor: pointer; padding: 6px 0; }
.more-skills .stack-sm { margin-top: 8px; }
.perm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.perm { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.perm:last-child { border-bottom: 0; }
.perm-name { display: inline-flex; align-items: center; gap: 8px; }
.perm-name .app-icon { width: 22px; height: 22px; border-radius: 6px; }
.perm-name .app-icon svg { width: 13px; height: 13px; }

/* ── misc ──────────────────────────────────────────────────── */
.emp-head-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.emp-card-stats .attn strong { color: var(--warn); }
@media (max-width: 720px) {
  .content-grid { grid-template-columns: 1fr; }
  .task-panel .field { max-width: none; }
  .bulk-bar { flex-direction: column; align-items: stretch; }
}

/* ── v0.3: settings, notifications, recurring tasks ───────── */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.h-sm { font-size: 13.5px; margin: 8px 0 6px; color: var(--muted); font-weight: 600; }
.plain-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.plain-list > li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.plain-list > li:last-child { border-bottom: 0; }
.row-tight { gap: 6px; }
.key-reveal { display: block; padding: 10px 12px; margin: 8px 0; border-radius: 10px; background: var(--surface); border: 1px dashed var(--border-strong); font-size: 13px; word-break: break-all; user-select: all; }
.warn-text { color: var(--warn); font-weight: 600; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif-unread { background: #f3fbfb; }
.notif-unread strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-inline-end: 8px; vertical-align: middle; }
.notif-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--muted); flex: none; }
.notif p { margin: 2px 0 4px; }
.sched { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.sched:last-child { border-bottom: 0; }
.sched-paused { opacity: 0.65; }
.sched-form { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-3 .field { margin: 0; }
.schedule-form { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 0; }
@media (max-width: 720px) {
  .stats, .grid-3 { grid-template-columns: 1fr; }
  .notif { padding: 12px 14px; }
}

/* ── v0.4: launch ──────────────────────────────────────────── */
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; }
.check-row input { margin-top: 3px; }
.legal-links a { color: inherit; }
.mk-footer { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.auth-lang { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 20px 60px; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { font-size: 17px; margin: 26px 0 8px; }
.legal p, .legal li { line-height: 1.7; font-size: 15px; }
.legal .muted { margin-bottom: 20px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
