/* HQ: Apple-quiet, RTL-first. Logical properties only, no left/right. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.08);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --sep: rgba(60, 60, 67, 0.12);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --todo: #8e8e93;
  --doing: #0071e3;
  --waiting: #f29d38;
  --done: #34c759;
  --glass: rgba(251, 251, 253, 0.78);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --me-avatar: #1d1d1f;
  --warn-soft: rgba(242, 157, 56, 0.14);
  --done-soft: rgba(52, 199, 89, 0.13);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Hebrew", "Heebo", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

/* Theme: light by default; data-theme='dark' forces dark, 'auto' follows the device. */
:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.16);
    --text: #f5f5f7;
    --text-2: #98989d;
    --text-3: #636366;
    --sep: rgba(84, 84, 88, 0.5);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --todo: #8e8e93;
    --doing: #0a84ff;
    --waiting: #ff9f0a;
    --done: #30d158;
    --glass: rgba(28, 28, 30, 0.72);
    --me-avatar: #636366;
    --warn-soft: rgba(255, 159, 10, 0.18);
    --done-soft: rgba(48, 209, 88, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.16);
    --text: #f5f5f7;
    --text-2: #98989d;
    --text-3: #636366;
    --sep: rgba(84, 84, 88, 0.5);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --todo: #8e8e93;
    --doing: #0a84ff;
    --waiting: #ff9f0a;
    --done: #30d158;
    --glass: rgba(28, 28, 30, 0.72);
    --me-avatar: #636366;
    --warn-soft: rgba(255, 159, 10, 0.18);
    --done-soft: rgba(48, 209, 88, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 var(--font);
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  inset-block-start: 0;
  height: 100dvh;
  padding: 22px 12px 16px;
  border-inline-end: 1px solid var(--sep);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 18px;
  font-weight: 600;
  font-size: 17px;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(145deg, #1d1d1f, #48484a);
  display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--fill-2); }
.nav-item.on { background: var(--fill); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.nav-item .count { margin-inline-start: auto; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.nav-label {
  padding: 18px 10px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.nav-item .dot { margin-inline: 4px 5px; }
.sidebar-foot { margin-block-start: auto; padding: 12px 10px 0; color: var(--text-3); font-size: 12px; }
.sidebar-foot a { color: inherit; }

.main { min-width: 0; padding: 40px 32px 120px; }
.page { max-width: 720px; margin-inline: auto; }

/* ------------------------------------------------------------ headings */

.eyebrow { color: var(--text-2); font-size: 14px; margin: 0 0 2px; }
.large-title { font-size: 34px; line-height: 1.15; font-weight: 700; margin: 0 0 22px; letter-spacing: -0.01em; }
.section-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 26px 6px 8px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.section-head .n { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.section-head .grow { flex: 1; }
.section-head button { color: var(--accent); font-size: 13px; font-weight: 500; }

/* ------------------------------------------------------------ quick add */

.quick-add {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 14px;
}
.quick-add svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.quick-add input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  padding: 12px 0;
  font-size: 16px;
}
.quick-add input::placeholder { color: var(--text-3); }
.quick-add .chip-btn { flex: none; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--fill-2);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.chip-btn:hover { background: var(--fill); }

/* ------------------------------------------------------------ lists */

.group {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.35s var(--ease);
}
.row + .row::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 52px 0;
  border-block-start: 1px solid var(--sep);
}
.row:hover { background: var(--surface-2); }
.row:active { background: var(--fill-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 15.5px; line-height: 1.4; overflow-wrap: anywhere; transition: color 0.3s; }
.row-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  margin-block-start: 3px;
  font-size: 12.5px; color: var(--text-2);
}
.row-meta .m { display: inline-flex; align-items: center; gap: 5px; }
.row-meta .m svg { width: 13px; height: 13px; }
.row.is-done .row-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.row.leaving { opacity: 0; }
.row .star { color: #ff9f0a; }

/* check circle (Reminders style) */
.check {
  flex: none;
  width: 22px; height: 22px;
  margin-block-start: 1px;
  border-radius: 50%;
  border: 1.6px solid var(--text-3);
  display: grid; place-items: center;
  transition: background 0.25s var(--ease), border-color 0.25s, transform 0.2s var(--ease);
}
.check svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(0.4); transition: all 0.3s var(--ease); }
.check:hover { border-color: var(--done); }
.check:active { transform: scale(0.88); }
.check.doing { border-color: var(--doing); background: radial-gradient(circle, var(--doing) 0 38%, transparent 40%); }
.check.waiting { border-color: var(--waiting); border-style: dashed; }
.check.done { background: var(--done); border-color: var(--done); }
.check.done svg { opacity: 1; transform: scale(1); }

.empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--text-2);
  font-size: 14.5px;
}
.empty strong { display: block; color: var(--text); font-size: 16px; font-weight: 600; margin-block-end: 4px; }

.more-btn {
  display: block; width: 100%;
  padding: 11px 16px;
  text-align: start;
  color: var(--accent);
  font-size: 14px;
  border-block-start: 1px solid var(--sep);
}

/* ------------------------------------------------------------ toolbar / filters */

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block-end: 6px; }
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s;
}
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--sep);
  transition: all 0.15s;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--fill);
  border-radius: 10px;
  padding: 0 12px;
  margin-block-end: 8px;
}
.search svg { width: 17px; height: 17px; color: var(--text-2); flex: none; }
.search input { flex: 1; border: 0; outline: 0; background: none; padding: 10px 0; font-size: 15px; }

/* status pill */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.todo { color: var(--todo); }
.pill.doing { color: var(--doing); }
.pill.waiting { color: var(--waiting); }
.pill.done { color: var(--done); }

/* ------------------------------------------------------------ progress */

.progress {
  display: flex; align-items: center; gap: 12px;
  margin: -6px 0 22px;
  color: var(--text-2); font-size: 13px;
}
.progress-bar { flex: 0 0 120px; height: 5px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--done); border-radius: inherit; transition: width 0.6s var(--ease); }

/* ------------------------------------------------------------ sheet */

.scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  z-index: 40;
}
.scrim.open { opacity: 1; }
.sheet {
  position: fixed;
  inset-block: 10px;
  inset-inline-end: 10px;
  width: min(460px, calc(100vw - 20px));
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(calc(-100% - 20px));
  transition: transform 0.42s var(--ease);
}
[dir="ltr"] .sheet { transform: translateX(calc(100% + 20px)); }
.sheet.open { transform: none; }
.sheet-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 6px 18px;
}
.sheet-head .grow { flex: 1; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fill-2);
  color: var(--text-2);
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 20px 28px; }

.title-input {
  width: 100%;
  border: 0; outline: 0; background: none;
  font-size: 22px; font-weight: 600; line-height: 1.3;
  resize: none;
  padding: 4px 0 10px;
  overflow: hidden;
}
.field-label { font-size: 12px; font-weight: 600; color: var(--text-3); margin: 18px 0 7px; }
.status-seg { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; gap: 3px; border-radius: 11px; background: var(--fill); }
.status-seg button {
  padding: 8px 4px; border-radius: 8px; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
}
.status-seg button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); opacity: 0.85; }
.status-seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.props { background: var(--surface-2); border: 1px solid var(--sep); border-radius: 12px; }
.prop {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  min-height: 44px;
}
.prop + .prop { border-block-start: 1px solid var(--sep); }
.prop-k { color: var(--text-2); font-size: 14px; flex: 0 0 76px; }
.prop-v { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.prop select, .prop input[type="date"] {
  appearance: none; -webkit-appearance: none;
  border: 0; outline: 0; background: none;
  font-size: 14.5px;
  padding: 2px 0;
  width: 100%;
  cursor: pointer;
}
.toggle {
  position: relative; width: 44px; height: 26px; border-radius: 13px;
  background: var(--fill); transition: background 0.25s;
  flex: none;
}
.toggle::after {
  content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: inset-inline-start 0.25s var(--ease);
}
.toggle.on { background: var(--done); }
.toggle.on::after { inset-inline-start: 20px; }

.notes {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--sep);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px 14px;
  font-size: 14.5px; line-height: 1.6;
  resize: vertical;
  outline: 0;
}
.notes:focus { border-color: var(--accent); }

.subs { border: 1px solid var(--sep); border-radius: 12px; overflow: hidden; }
.sub { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 14.5px; }
.sub + .sub { border-block-start: 1px solid var(--sep); }
.sub .check { width: 19px; height: 19px; margin: 0; }
.sub .check svg { width: 10px; height: 10px; }
.sub.is-done span { color: var(--text-3); text-decoration: line-through; }
.sub input { flex: 1; border: 0; outline: 0; background: none; font-size: 14.5px; padding: 2px 0; }

.kanban-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 13.5px;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-2); }
.timeline li .who { color: var(--text); font-weight: 500; }
.timeline li .when { margin-inline-start: auto; color: var(--text-3); white-space: nowrap; font-size: 12px; }
.timeline .note-text { display: block; color: var(--text); white-space: pre-wrap; margin-block-start: 2px; font-size: 13.5px; }

.note-box { display: flex; gap: 8px; margin-block-start: 8px; }
.note-box input {
  flex: 1; border: 1px solid var(--sep); border-radius: 10px;
  background: var(--surface-2); padding: 9px 12px; outline: 0; font-size: 14px;
}
.btn {
  padding: 9px 16px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500;
}
.btn.ghost { background: var(--fill-2); color: var(--text); }
.btn.danger-text { background: none; color: var(--text-2); }
.btn:disabled { opacity: 0.4; cursor: default; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-block-start: 22px; }
.source-link { color: var(--text-3); font-size: 12px; margin-block-start: 14px; display: block; }
.source-link a { color: inherit; }

/* ------------------------------------------------------------ agents */

.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.agent {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  text-align: start;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.agent:hover { transform: translateY(-2px); }
.agent-top { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 16px;
  position: relative; flex: none;
}
.avatar .live {
  position: absolute; inset-block-end: -1px; inset-inline-end: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2.5px solid var(--surface);
  background: var(--text-3);
}
.avatar .live.on { background: var(--done); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); } 50% { box-shadow: 0 0 0 5px rgba(52, 199, 89, 0); } }
.agent-name { font-weight: 600; font-size: 15.5px; }
.agent-role { color: var(--text-2); font-size: 12.5px; }
.agent-now { font-size: 13px; color: var(--text-2); line-height: 1.45; min-height: 38px; }
.agent-now b { color: var(--text); font-weight: 500; }
.agent-stats { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); border-block-start: 1px solid var(--sep); padding-block-start: 10px; }
.agent-stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ feed */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 11px; align-items: flex-start; padding: 11px 16px; font-size: 13.5px; cursor: pointer; }
.feed li + li { border-block-start: 1px solid var(--sep); }
.feed li:hover { background: var(--surface-2); }
.feed .mini { width: 26px; height: 26px; font-size: 11.5px; }
.feed .what { flex: 1; min-width: 0; color: var(--text-2); }
.feed .what b { color: var(--text); font-weight: 500; }
.feed .when { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed;
  inset-inline-start: 50%;
  inset-block-end: max(24px, env(safe-area-inset-bottom));
  transform: translate(50%, 20px);
  background: rgba(29, 29, 31, 0.94);
  color: #fff;
  border-radius: 999px;
  padding: 10px 10px 10px 18px;
  display: flex; align-items: center; gap: 14px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s var(--ease);
  z-index: 60;
  white-space: nowrap;
}
[dir="ltr"] .toast { transform: translate(-50%, 20px); }
.toast.show { opacity: 1; transform: translate(50%, 0); pointer-events: auto; }
[dir="ltr"] .toast.show { transform: translate(-50%, 0); }
.toast button { color: #64d2ff; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.toast button:hover { background: rgba(255, 255, 255, 0.1); }

/* ------------------------------------------------------------ login */

.login {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px;
  text-align: center;
}
.login-card { max-width: 360px; }
.login .brand-mark { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; margin: 0 auto 22px; }
.login h1 { font-size: 28px; margin: 0 0 8px; font-weight: 700; }
.login p { color: var(--text-2); margin: 0 0 26px; line-height: 1.6; }
.login .btn { display: inline-block; text-decoration: none; padding: 12px 22px; font-size: 15px; border-radius: 12px; }

/* ------------------------------------------------------------ tab bar (mobile) */

.tabbar { display: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: max(18px, env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
  .large-title { font-size: 30px; margin-block-end: 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; inset-inline: 0; inset-block-end: 0;
    padding: 7px 8px max(8px, env(safe-area-inset-bottom));
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-block-start: 1px solid var(--sep);
    z-index: 30;
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10.5px; color: var(--text-3); text-decoration: none; padding: 3px 0;
  }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--accent); }
  .sheet {
    inset-inline: 0; inset-block: auto 0;
    width: 100%;
    height: 92dvh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  [dir="ltr"] .sheet { transform: translateY(100%); }
  .sheet.open { transform: none; }
  .agents-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .agent { padding: 13px; }
  .row { padding: 12px 14px; }
  .row + .row::before { inset-inline-start: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}

/* ------------------------------------------------------------ fixed palettes
   CSP forbids inline style attributes, so every color the UI needs is a class. */

.b-chaos { --b: #6e56cf; }
.b-prompti { --b: #0a9396; }
.b-ai4smb { --b: #db2777; }
.b-personal { --b: #64748b; }
.dot[class*="b-"] { background: var(--b); }

.a-daria { --a: #5e5ce6; }
.a-esti { --a: #af52de; }
.a-noam { --a: #0a84ff; }
.a-rotem { --a: #ff375f; }
.a-omer { --a: #ff9f0a; }
.a-ran { --a: #30b0c7; }
.a-bob { --a: #34c759; }
.a-mor { --a: #a2845e; }
.a-me { --a: var(--me-avatar); }
.avatar { background: var(--a, #8e8e93); }
.avatar.mini { width: 26px; height: 26px; font-size: 11.5px; }

.st-todo { --c: var(--todo); }
.st-doing { --c: var(--doing); }
.st-waiting { --c: var(--waiting); }
.st-done { --c: var(--done); }

.spacer { height: 14px; }
.field-label .n { color: var(--text-3); font-weight: 500; margin-inline-start: 4px; }
.grow { flex: 1; }
.sheet .agent-top { margin-block: 6px 4px; }
.sheet .agent-top .avatar { width: 52px; height: 52px; font-size: 20px; }
.sheet .agent-name { font-size: 20px; }
.row .chip-btn { align-self: center; }

/* ------------------------------------------------------------ Space M brand */

.wordmark {
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 13.5px;
}
.brand img { border-radius: 7px; flex: none; }
.login img.logo { display: block; margin: 0 auto 26px; border-radius: 18px; box-shadow: var(--shadow-lg); }
.login h1.wordmark { font-size: 26px; letter-spacing: 0.34em; padding-inline-start: 0.34em; margin: 0 0 12px; }

/* ------------------------------------------------------------ selection + delete */

.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.text-btn { color: var(--accent); font-size: 15px; font-weight: 500; padding: 6px 2px; margin-block-end: 26px; flex: none; }
.text-btn:hover { opacity: 0.75; }

.row-del {
  flex: none; align-self: center;
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.row-del svg { width: 17px; height: 17px; }
.row-del:hover { background: rgba(255, 59, 48, 0.1); color: #ff3b30; }
.row-del:focus-visible { opacity: 1; }
@media (hover: hover) { .row:hover .row-del { opacity: 1; } }
@media (hover: none) { .row-del { display: none; } }

.check.sel { border-color: var(--text-3); }
.check.sel.on { background: var(--accent); border-color: var(--accent); }
.check.sel.on svg { opacity: 1; transform: scale(1); }
.check.ghost { border-style: dashed; opacity: 0.5; }
.row.selecting { user-select: none; -webkit-user-select: none; }
.row.picked, .row.picked:hover { background: var(--accent-soft); }
.row[data-deleted] { cursor: default; }
.row[data-deleted] .row-title { color: var(--text-2); }
.row .chip-btn[data-restore] { color: var(--accent); }

.selbar {
  position: fixed;
  inset-inline-start: 50%;
  inset-block-end: max(22px, env(safe-area-inset-bottom));
  transform: translate(50%, 160%);
  display: flex; align-items: center; gap: 4px;
  padding: 7px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--sep);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 35;
  max-width: calc(100vw - 16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.38s var(--ease), opacity 0.25s, visibility 0s linear 0.38s;
}
.selbar.show { opacity: 1; visibility: visible; pointer-events: auto; transition: transform 0.38s var(--ease), opacity 0.2s; }
[dir="ltr"] .selbar { transform: translate(-50%, 160%); }
.selbar.show { transform: translate(50%, 0); }
[dir="ltr"] .selbar.show { transform: translate(-50%, 0); }
.selbar button { padding: 8px 12px; border-radius: 10px; font-size: 14px; white-space: nowrap; }
.selbar .ghost { color: var(--accent); }
.selbar .ghost:hover { background: var(--fill-2); }
.selbar .selcount { padding: 0 8px; font-size: 14px; font-weight: 600; white-space: nowrap; min-width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
.selbar .selact { background: var(--fill); font-weight: 600; }
.selbar .selact:hover { background: var(--fill-2); }
.selbar .selact.danger { color: #ff3b30; }
.selbar button:disabled { opacity: 0.35; cursor: default; }
.btn.danger-text { display: inline-flex; align-items: center; gap: 6px; }
.btn.danger-text svg { width: 16px; height: 16px; }
.btn.danger-text:hover { color: #ff3b30; }
@media (max-width: 760px) {
  .selbar { inset-block-end: calc(68px + env(safe-area-inset-bottom)); gap: 2px; padding: 6px; }
  /* keep "undo" well clear of the tab bar, where a thumb would hit a tab instead */
  .toast { inset-block-end: calc(84px + env(safe-area-inset-bottom)); }
  .selbar button { padding: 8px 9px; font-size: 13.5px; }
  .selbar .selcount { min-width: 0; padding: 0 4px; }
  .text-btn { margin-block-end: 20px; }
}

/* ============================================================ Space M 2: home, money, clients, focus */

.tabbar { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 760px) { .tabbar { grid-template-columns: repeat(5, 1fr); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head-text { min-width: 0; }
.head-actions { display: flex; align-items: center; gap: 8px; margin-block-end: 26px; flex: none; }
.head-actions .text-btn { margin: 0; }
.mobile-only { display: none; }
@media (max-width: 760px) {
  .mobile-only { display: grid; }
  .head-actions { margin-block-end: 20px; }
}
.icon-btn.mobile-only svg { width: 18px; height: 18px; }
a.icon-btn { text-decoration: none; }

.theme-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; margin-block-end: 10px; padding: 4px 0; }
.theme-btn svg { width: 15px; height: 15px; }
.sidebar-foot { display: flex; flex-direction: column; align-items: flex-start; }

.hint-line { color: var(--text-3); font-size: 12.5px; margin: 8px 6px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.inline-link { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.inline-link svg { width: 14px; height: 14px; }
.all-done { padding: 12px 16px; color: var(--done); font-size: 14px; font-weight: 500; border-block-start: 1px solid var(--sep); background: var(--done-soft); }
.num { font-variant-numeric: tabular-nums; }

/* tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block-start: 22px; }
.tile {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 16px; display: flex; flex-direction: column; gap: 1px; color: inherit; text-decoration: none;
}
a.tile:active { transform: scale(0.98); }
.tile small { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.tile b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.tile i { font-style: normal; color: var(--text-3); font-size: 12px; }

/* "what's waiting" pulse strip */
.pulse { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 10px; padding: 2px; }
.pulse::-webkit-scrollbar { display: none; }
.pulse-item {
  flex: 1 0 140px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 13px; display: flex; flex-direction: column; color: inherit; text-decoration: none;
}
.pulse-item b { font-size: 21px; font-weight: 700; line-height: 1.2; }
.pulse-item span { font-size: 12px; color: var(--text-2); }
.pulse-item i { font-style: normal; font-size: 11.5px; color: var(--text-3); }

/* static rows (not tasks) */
.row.static { cursor: default; align-items: center; }
.row.static:hover { background: none; }
a.row.static { cursor: pointer; color: inherit; text-decoration: none; }
a.row.static:hover { background: var(--surface-2); }
.row.static > svg { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.row-meta .m.link { color: var(--accent); text-decoration: none; }
.row-meta .m.accent { color: var(--accent); }
.ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; font-size: 14px; }
.ico svg { width: 17px; height: 17px; }
.bg-accent { background: var(--accent); }
.bg-ok { background: var(--done); }
.bg-warn { background: var(--waiting); }
.bg-grey { background: var(--text-3); }
.bg-mor { background: #a2845e; }
.bg-b { background: var(--b); }
.row + .row.static::before, .row.static + .row::before { inset-inline-start: 58px; }

/* team strip */
.team { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.team::-webkit-scrollbar { display: none; }
.mate {
  flex: 0 0 128px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; text-align: start; min-height: 92px;
}
.mate.ghost { opacity: 0.4; }
.mate .avatar { margin-block-end: 2px; }
.mate .avatar .live { width: 10px; height: 10px; border-width: 2px; }
.mate b { font-size: 13.5px; }
.mate span:last-child { font-size: 12px; color: var(--text-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* week rings */
.rings { display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 6px; }
.ring-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); text-decoration: none; }
.ring-item b { color: var(--text); font-size: 13px; }
svg.ring { width: 52px; height: 52px; transform: rotate(-90deg); }
svg.ring .trk { fill: none; stroke: var(--fill); stroke-width: 6; }
svg.ring .val { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease); }
.st-chaos { stroke: #6e56cf; } .st-prompti { stroke: #0a9396; } .st-ai4smb { stroke: #db2777; } .st-personal { stroke: #64748b; }

.review-link {
  display: flex; align-items: center; gap: 12px; margin-block-start: 22px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 16px; color: inherit; text-decoration: none; font-size: 13px;
}
.review-link > svg:first-child { width: 22px; height: 22px; color: var(--accent); flex: none; }
.review-link > svg:last-child { width: 14px; height: 14px; color: var(--text-3); margin-inline-start: auto; }
.review-link span { color: var(--text-2); }
.review-link b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }
.review-link.hot { background: var(--accent); }
.review-link.hot, .review-link.hot span, .review-link.hot b, .review-link.hot svg { color: #fff !important; }

/* money */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.big { padding: 18px; display: flex; flex-direction: column; }
.card.big small { color: var(--text-2); font-size: 13px; font-weight: 500; }
.card.big b { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.card.big .sub { color: var(--text-3); font-size: 13px; }
.bar { height: 8px; border-radius: 4px; background: var(--fill); display: flex; gap: 2px; overflow: hidden; margin-block-start: 14px; }
.bar i { display: block; height: 100%; width: 0; transition: width 0.8s var(--ease); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-block-start: 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.seg-0 { background: #6e56cf; } .seg-1 { background: #0a9396; } .seg-2 { background: #db2777; }
.seg-3 { background: #f29d38; } .seg-4 { background: #30b0c7; } .seg-5 { background: #8e8e93; }
.fin-row .row-main { min-width: 0; }
.fin-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.amt { font-weight: 600; font-size: 15.5px; white-space: nowrap; }
.amt.soft { color: var(--text-2); font-weight: 500; font-size: 14px; }
.pill-soft { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.pill-soft.ok { background: var(--done-soft); color: var(--done); }
.pill-soft.warn { background: var(--warn-soft); color: var(--waiting); }
.pill-soft.accent { background: var(--accent-soft); color: var(--accent); }
.warn-text { color: var(--waiting) !important; font-size: 12px; }
.chip-btn.accent { background: var(--accent-soft); color: var(--accent); font-weight: 600; text-decoration: none; }
.tmpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tp { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 13px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tp b { font-size: 14.5px; }
.tp small { color: var(--text-2); font-size: 12.5px; flex: 1; }

/* panels (sheet that is not a task) */
.panel-title { font-size: 22px; font-weight: 700; margin: 2px 0 2px; }
.panel-sub { color: var(--text-2); font-size: 14px; margin: 0 0 14px; }
.panel-actions { display: flex; gap: 8px; margin-block-start: 18px; flex-wrap: wrap; }
.field {
  width: 100%; border: 1px solid var(--sep); border-radius: 10px; background: var(--surface-2);
  padding: 10px 12px; outline: 0; font-size: 15px;
}
.field:focus { border-color: var(--accent); }
.notes.tall { min-height: 260px; }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; }
.check-line { display: flex; gap: 8px; align-items: flex-start; margin-block-start: 16px; font-size: 14px; color: var(--text-2); }
.check-line input { margin-block-start: 4px; }
.pick-row { width: 100%; text-align: start; }
.btn.full { width: 100%; margin-block-start: 10px; }

/* clients */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card.client { padding: 14px; display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; transition: transform 0.2s var(--ease); }
.card.client:hover { transform: translateY(-2px); }
.card.client .hd { display: flex; align-items: center; gap: 10px; }
.card.client .hd b { display: block; font-size: 16px; }
.card.client .hd small { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--fill-2); border-radius: 10px; }
.stats div { padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.stats div + div { border-inline-start: 1px solid var(--sep); }
.stats b { font-size: 15px; }
.stats span { font-size: 11.5px; color: var(--text-2); }
.big-stats { margin-block-start: 12px; background: var(--surface); box-shadow: var(--shadow); }
.big-stats b { font-size: 18px; }
.client-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.client-foot span { display: inline-flex; align-items: center; gap: 5px; }
.client-foot svg { width: 13px; height: 13px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); text-decoration: none; font-size: 15px; margin-block-end: 10px; }
.back-link svg { width: 16px; height: 16px; }
.camp-sum { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 16px 10px; }
.camp-sum div { display: flex; flex-direction: column; }
.camp-sum b { font-size: 20px; font-weight: 700; }
.camp-sum span { font-size: 12px; color: var(--text-2); }
.link-form { display: flex; gap: 8px; padding: 10px 12px; border-block-start: 1px solid var(--sep); flex-wrap: wrap; }
.link-form input { flex: 1 1 140px; border: 1px solid var(--sep); border-radius: 9px; background: var(--surface-2); padding: 8px 10px; outline: 0; font-size: 14px; min-width: 0; }
.row-main.link { color: inherit; text-decoration: none; }
.row-del.show { opacity: 1; display: grid; }

/* focus */
body.focus-mode .tabbar, body.focus-mode .sidebar { display: none; }
body.focus-mode .shell { grid-template-columns: 1fr; }
.focus { min-height: calc(100dvh - 140px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; text-align: center; padding: 10px 8px 30px; }
.focus .lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-3); }
.focus h2 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 700; max-width: 22ch; text-wrap: balance; }
.focus .meta { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 14px; }
.timer { position: relative; width: min(240px, 66vw); aspect-ratio: 1; max-width: 100%; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .trk { fill: none; stroke: var(--fill); stroke-width: 8; }
.timer .val { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer .t { position: absolute; inset: 0; display: grid; place-items: center; font-size: 50px; font-weight: 300; direction: ltr; letter-spacing: -0.02em; }
.fbtns { display: flex; flex-direction: column; gap: 10px; width: min(340px, 100%); }
.fbtns .btn { padding: 14px; font-size: 16px; font-weight: 600; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fbtns .btn svg { width: 16px; height: 16px; }
.fbtns .done-btn { background: var(--done-soft); color: var(--done); }
.fbtns-row { display: flex; justify-content: space-between; }
.fbtns-row .text-btn { margin: 0; font-size: 14.5px; text-decoration: none; color: var(--text-2); }

/* weekly review */
.card.wk { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.big3 { display: flex; align-items: baseline; gap: 10px; }
.big3 b { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.big3 span { color: var(--text-2); font-size: 14px; }
.bars7 { display: flex; align-items: flex-end; gap: 8px; height: 70px; }
.bars7 div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bars7 i { display: block; width: 100%; height: 4%; border-radius: 4px; background: var(--accent); transition: height 0.8s var(--ease); }
.bars7 i.zero { background: var(--fill); }
.bars7 span { font-size: 11px; color: var(--text-3); }
.hl { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.hl li { display: flex; gap: 8px; align-items: center; }

/* swipe */
.sw { position: relative; overflow: hidden; }
.sw + .row::before, .row + .sw::before { content: ""; position: absolute; inset-block-start: 0; inset-inline: 52px 0; border-block-start: 1px solid var(--sep); z-index: 1; }
.sw .row { background: var(--surface); transition: transform 0.26s var(--ease); z-index: 1; }
.sw-acts { position: absolute; inset-block: 0; inset-inline-start: 0; display: flex; direction: ltr; }
.sw-acts button { width: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #fff; font-size: 11.5px; font-weight: 600; }
.sw-acts svg { width: 20px; height: 20px; }
.sw.leaving { opacity: 0; transition: opacity 0.25s; }

.doc-picks { border: 1px solid var(--sep); border-radius: 12px; overflow: hidden; }
.doc-pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 14px; cursor: pointer; }
.doc-pick + .doc-pick { border-block-start: 1px solid var(--sep); }
.doc-pick .m { color: var(--text-3); font-size: 12.5px; }
.doc-pick b { margin-inline-start: auto; font-weight: 600; }
.doc-pick input { accent-color: var(--accent); width: 17px; height: 17px; }
.fin-row::before { inset-inline-start: 16px !important; }
