/* ONE OS — "שקט ויוקרתי": warm paper surfaces, deep ink, one strong blue, generous space. RTL-first with logical properties. */
:root {
  --bg: #F5F4F0; --surface: #FFFFFF; --surface-2: #F0EFEA; --line: #E4E2DB; --line-strong: #CFCCC2;
  --ink: #15171E; --ink-2: #4A4D57; --ink-3: #7B7E87;
  --primary: #2445C8; --primary-ink: #FFFFFF; --primary-soft: #E7ECFC;
  --ok: #1D7F55; --ok-soft: #E2F3EA; --warn: #A9650A; --warn-soft: #FBF0DC; --bad: #B83434; --bad-soft: #FBE5E3; --info-soft: #EAF2F8;
  --shadow: 0 1px 2px rgba(20,22,30,.05), 0 6px 24px rgba(20,22,30,.06);
  --shadow-lg: 0 18px 60px rgba(20,22,30,.18);
  --r: 14px; --r-sm: 9px; --nav-w: 248px;
  --font: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #111318; --surface: #191C23; --surface-2: #20242D; --line: #2A2E38; --line-strong: #3A3F4B;
  --ink: #EEF0F4; --ink-2: #B7BBC6; --ink-3: #868B97; --primary: #7D97FF; --primary-ink: #0D1020; --primary-soft: #222B4A;
  --ok: #4FC48C; --ok-soft: #173326; --warn: #F0B456; --warn-soft: #3A2C14; --bad: #FF8A80; --bad-soft: #3B1C1C; --info-soft: #1B2833;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #111318; --surface: #191C23; --surface-2: #20242D; --line: #2A2E38; --line-strong: #3A3F4B;
  --ink: #EEF0F4; --ink-2: #B7BBC6; --ink-3: #868B97; --primary: #7D97FF; --primary-ink: #0D1020; --primary-soft: #222B4A;
  --ok: #4FC48C; --ok-soft: #173326; --warn: #F0B456; --warn-soft: #3A2C14; --bad: #FF8A80; --bad-soft: #3B1C1C; --info-soft: #1B2833;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
bdi { unicode-bidi: isolate; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 28px; height: 28px; }

/* ---------------- shell */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.ws-switch { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; text-align: start; margin-bottom: 10px; }
.ws-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.ws-switch .grow { min-width: 0; }
.ws-switch b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switch small { color: var(--ink-3); font-size: 13px; }
.nav-sec { font-size: 12.5px; color: var(--ink-3); font-weight: 600; padding: 14px 10px 4px; letter-spacing: .3px; }
.nav a.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav a.item:hover { background: var(--surface-2); color: var(--ink); }
.nav a.item.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav a.item .count { margin-inline-start: auto; font-size: 12.5px; background: var(--surface-2); color: var(--ink-2); border-radius: 99px; padding: 0 8px; min-width: 24px; text-align: center; }
.nav a.item.on .count { background: var(--surface); }
.nav .spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); margin-top: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; padding: 10px 42px 10px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.search .ico { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.page { padding: 8px 32px 64px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 18px 0 22px; }
.page-head h1 { font-size: 30px; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -.3px; }
.page-head p { margin: 6px 0 0; color: var(--ink-3); }
.mobile-bar, .bottom-nav, .mobile-only { display: none; }

/* ---------------- primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none !important; color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 18px; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .err { color: var(--bad); font-size: 13.5px; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.input.bad { border-color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: 14.5px; font-weight: 500; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { opacity: .7; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 99px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); }
.seg button.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.prio { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.prio.urgent { background: var(--bad); } .prio.high { background: var(--warn); } .prio.normal { background: var(--primary); } .prio.low { background: var(--line-strong); }

/* ---------------- stats & lists */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; text-decoration: none !important; color: inherit; transition: transform .12s; }
.stat:hover { transform: translateY(-2px); }
.stat .label { color: var(--ink-3); font-size: 14.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .num { font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat.hero { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stat.hero .label { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.stat.alert .num { color: var(--bad); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.trow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; min-height: 56px; }
.trow:hover { background: var(--surface-2); }
.trow .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .title.done { text-decoration: line-through; color: var(--ink-3); }
.trow .meta { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 14px; flex-wrap: wrap; }
.tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); background: transparent; display: grid; place-items: center; cursor: pointer; flex: none; color: transparent; }
.tick:hover { border-color: var(--ok); color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tick .ico { width: 14px; height: 14px; stroke-width: 3; }
.quick-add { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.quick-add input { flex: 1; border: 0; background: transparent; padding: 8px 6px; font-size: 16px; }
.quick-add input:focus { outline: none; }
.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty .ico { width: 40px; height: 40px; color: var(--line-strong); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 18px; margin: 14px 16px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.error-box { padding: 18px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------------- board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 10px; min-height: 240px; display: flex; flex-direction: column; gap: 10px; }
.col.drop { outline: 2px dashed var(--primary); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; font-weight: 700; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: grab; box-shadow: var(--shadow); }
.kcard:active { cursor: grabbing; }
.kcard .t { font-weight: 600; margin-bottom: 8px; }

/* ---------------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.cal .dow { padding: 8px; font-size: 13.5px; color: var(--ink-3); font-weight: 600; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal .day { min-height: 108px; padding: 6px; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.cal .day.other { background: var(--surface-2); color: var(--ink-3); }
.cal .day.today .dn { background: var(--primary); color: var(--primary-ink); }
.cal .dn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13.5px; font-weight: 600; }
.cal .ev { display: block; width: 100%; text-align: start; margin-top: 4px; font-size: 13px; padding: 3px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); border: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.done { background: var(--surface-2); color: var(--ink-3); text-decoration: line-through; }
.cal .ev.late { background: var(--bad-soft); color: var(--bad); }

/* ---------------- drawer / modal / toast / menu */
.overlay { position: fixed; inset: 0; background: rgba(15,17,24,.42); z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100vw); background: var(--surface); z-index: 51; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-body .stack > * + * { margin-top: 16px; }
.title-input { width: 100%; font-size: 22px; font-weight: 700; border: 0; background: transparent; padding: 4px 0; }
.title-input:focus { outline: none; border-bottom: 2px solid var(--primary); }
.modal { position: fixed; z-index: 52; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 24px; animation: fade .15s; }
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 22px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 14px; align-items: center; animation: fade .2s; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
.toast button { background: transparent; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.menu { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 260px; max-height: 70vh; overflow-y: auto; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: start; color: var(--ink); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 16px 14px; font-size: 14.5px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.comment { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.pcard { padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; text-decoration: none !important; color: inherit; }
.pcard .name { font-weight: 700; font-size: 18px; display: flex; gap: 10px; align-items: center; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: start; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 13.5px; color: var(--ink-3); font-weight: 600; }
.code { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; word-break: break-all; direction: ltr; text-align: left; font-size: 14px; }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--info-soft); color: var(--ink-2); font-size: 15px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: var(--ink); color: var(--bg); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 44px; line-height: 1.15; margin: 0 0 18px; font-weight: 800; letter-spacing: -.5px; }
.auth-side p { font-size: 18px; color: color-mix(in srgb, var(--bg) 72%, transparent); max-width: 460px; }
.auth-side ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth-side li { display: flex; gap: 12px; align-items: center; font-size: 17px; }
.auth-side li .ico { color: #9FB2FF; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: min(400px, 100%); }
.auth-form h2 { font-size: 28px; margin: 0 0 6px; }

/* ---------------- responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; z-index: 55; inset-inline-start: 0; top: 0; width: 290px; transform: translateX(110%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .nav.open { transform: none; }
  .topbar { padding: 10px 16px; }
  .topbar .search { display: none; }
  .mobile-bar { display: flex; }
  .mobile-only { display: initial; }
  .page { padding: 4px 16px 110px; }
  .page-head h1 { font-size: 25px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--ink-3); padding: 6px 8px; border-radius: 10px; text-decoration: none; min-width: 58px; }
  .bottom-nav a.on { color: var(--primary); font-weight: 700; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 32px 22px; }
  .auth-side h1 { font-size: 30px; }
  .auth-side ul { display: none; }
  .drawer { width: 100vw; }
  .cal .day { min-height: 70px; padding: 3px; }
  .cal .ev { font-size: 11.5px; padding: 2px 4px; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 14px; }
  .table.responsive td::before { content: attr(data-label); color: var(--ink-3); font-size: 13.5px; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; } .stat { padding: 14px; } .stat .num { font-size: 28px; } .hide-sm { display: none !important; } }
