:root, [data-theme="dark"] {
  --bg: #0c1016;
  --bg2: #10151d;
  --surface: #151b25;
  --surface2: #1b2330;
  --surface3: #222c3b;
  --border: #253043;
  --track: #232d3d;
  --text: #e7ebf2;
  --text2: #b8c1d1;
  --muted: #7f8aa0;
  --teal: #5fd0bd;
  --violet: #9585ff;
  --rose: #f2849a;
  --amber: #f3bd5c;
  --green: #6fd39a;
  --blue: #6aa8ff;
  --red: #ff7a7a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --glow-v: rgba(149,133,255,.16);
  --glow-t: rgba(95,208,189,.14);
  --glow-r: rgba(242,132,154,.14);
}
[data-theme="light"] {
  --bg: #f4f1ec;
  --bg2: #efebe4;
  --surface: #fbf9f6;
  --surface2: #f3efe9;
  --surface3: #ebe5dc;
  --border: #e0d8cc;
  --track: #e8e1d6;
  --text: #24272e;
  --text2: #454b57;
  --muted: #7d8290;
  --teal: #1f9d89;
  --violet: #6a5ae0;
  --rose: #d45472;
  --amber: #c98a12;
  --green: #2f9e62;
  --blue: #3b7be0;
  --red: #d64545;
  --shadow: 0 8px 24px rgba(60,50,30,.08);
  --glow-v: rgba(106,90,224,.08);
  --glow-t: rgba(31,157,137,.08);
  --glow-r: rgba(212,84,114,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", "Arial Hebrew", Arial, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--violet); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.sidebar {
  background: var(--bg2);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: url("logo.svg") center / 112% no-repeat;
  display: grid; place-items: center; color: transparent; font-size: 0 !important;
  box-shadow: 0 6px 18px rgba(124,58,237,.35);
}
.brand-name { font-weight: 650; font-size: 18px; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: -3px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: none; border: 0; cursor: pointer;
  color: var(--text2); text-align: start; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-btn svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn.active { background: var(--surface2); color: var(--text); box-shadow: inset 3px 0 0 var(--violet); }
.sidebar .spacer { flex: 1; }
.sos-btn {
  margin-top: 10px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px; border-radius: 12px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #e86a85, #f29a6b);
  color: #fff; font-weight: 650; font-size: 15px;
  box-shadow: 0 8px 22px rgba(232,106,133,.28);
  transition: transform .15s;
}
.sos-btn:hover { transform: translateY(-1px); }
.sos-btn svg { width: 18px; height: 18px; }
.side-foot { font-size: 11.5px; color: var(--muted); padding: 12px 8px 0; text-align: center; }

.main { overflow-y: auto; height: 100vh; }
.page { max-width: 1240px; margin: 0 auto; padding: 30px 36px 60px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 27px; font-weight: 650; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- primitives ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 15.5px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.card h3 .h-ic { width: 18px; height: 18px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { text-align: center; }
.muted { color: var(--muted); }
.text2 { color: var(--text2); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.b { font-weight: 620; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 99px;
}
.pill.violet { background: var(--glow-v); color: var(--violet); }
.pill.teal { background: var(--glow-t); color: var(--teal); }
.pill.rose { background: var(--glow-r); color: var(--rose); }
.pill.amber { background: rgba(243,189,92,.13); color: var(--amber); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; border: 1px solid transparent;
  background: var(--violet); color: #fff; font-weight: 600; cursor: pointer;
  transition: filter .15s, background .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn.teal { background: var(--teal); color: #0b1a17; }
.btn.rose { background: var(--rose); }
.btn.ghost { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface3); }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(255,122,122,.35); }
.btn.sm { padding: 7px 13px; font-size: 13.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface2); color: var(--text); }

input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=datetime-local], textarea, select {
  width: 100%;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--glow-v); }
textarea { resize: vertical; min-height: 80px; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(.6); cursor: pointer; }
[data-theme="light"] input[type=date]::-webkit-calendar-picker-indicator, [data-theme="light"] input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: none; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 550; }
input[type=range] { width: 100%; accent-color: var(--violet); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 13px; border-radius: 99px; cursor: pointer; font-size: 13.5px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
  transition: all .15s; user-select: none;
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--glow-v); border-color: var(--violet); color: var(--text); }
.chip.her.on { background: var(--glow-r); border-color: var(--rose); }
.chip.me.on { background: var(--glow-t); border-color: var(--teal); }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--text2); font-size: 13.5px; }
.seg button.on { background: var(--surface3); color: var(--text); font-weight: 600; }

.toggle { display: inline-block; vertical-align: middle; position: relative; width: 42px; height: 24px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--surface3); border-radius: 99px; cursor: pointer; transition: .2s; }
.toggle span::after { content: ""; position: absolute; width: 18px; height: 18px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + span { background: var(--teal); }
.toggle input:checked + span::after { transform: translateX(18px); }

/* ---------- dashboard ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; }
.hello h1 { margin: 0; font-size: 28px; font-weight: 650; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.counter { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 18px; }
.counter::before { content: ""; position: absolute; inset: -40% -20% auto; height: 70%; background: radial-gradient(ellipse at center, var(--glow), transparent 65%); pointer-events: none; }
.counter.violet { --glow: var(--glow-v); }
.counter.teal { --glow: var(--glow-t); }
.counter.rose { --glow: var(--glow-r); }
.counter-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.ring-wrap { position: relative; width: 186px; height: 186px; margin: 4px 0; }
.ring-wrap svg { display: block; }
.ring-fg { transition: stroke-dashoffset 1s ease; filter: drop-shadow(0 0 6px var(--ring-glow, transparent)); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .big { font-size: 50px; font-weight: 700; line-height: 1; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.ring-center .unit { color: var(--muted); font-size: 13px; margin-top: 4px; }
.ticker { display: flex; gap: 8px; }
.ticker .tk { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 0; width: 56px; text-align: center; }
.ticker .tk b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ticker .tk i { font-style: normal; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.counter .foot { font-size: 13px; color: var(--muted); text-align: center; }
.counter .actions { display: flex; gap: 8px; margin-top: 4px; }
.week-dots { display: flex; gap: 6px; justify-content: center; }
.week-dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--track); }
.week-dots span.used { background: var(--teal); }
.week-dots span.over { background: var(--amber); }

.banner {
  display: flex; align-items: center; gap: 16px;
  border-radius: 16px; padding: 16px 20px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--glow-v), var(--glow-t));
  border: 1px solid var(--border);
}
.banner .b-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); display: grid; place-items: center; flex: none; color: var(--violet); }
.banner .b-ic svg { width: 22px; }
.banner .grow { flex: 1; }

.tip-card .tip-cat { font-size: 12px; color: var(--violet); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.tip-card .tip-title { font-size: 17px; font-weight: 620; margin: 6px 0 8px; }
.tip-card .tip-body { color: var(--text2); font-size: 14.5px; }

.moods { display: flex; gap: 8px; }
.moods button { flex: 1; font-size: 24px; padding: 8px 0; border-radius: 12px; border: 1px solid var(--border); background: var(--surface2); cursor: pointer; filter: grayscale(.8); opacity: .65; transition: .15s; }
.moods button:hover { opacity: 1; }
.moods button.on { filter: none; opacity: 1; border-color: var(--violet); background: var(--glow-v); transform: scale(1.04); }

.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.why-list li { background: var(--surface2); border-radius: 11px; padding: 10px 14px; border-inline-start: 3px solid var(--teal); color: var(--text2); }

.badges { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.badge { flex: none; width: 84px; text-align: center; }
.badge .medal { width: 62px; height: 62px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; background: var(--surface2); border: 2px dashed var(--border); color: var(--muted); }
.badge.got .medal { border: 0; color: #fff; background: linear-gradient(135deg, var(--violet), var(--teal)); box-shadow: 0 6px 16px var(--glow-v); }
.badge .bl { font-size: 11.5px; color: var(--muted); }
.badge.got .bl { color: var(--text2); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; }
.stat .v { font-size: 28px; font-weight: 680; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 500; }

.qa { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.qa button {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: start; transition: .15s;
}
.qa button:hover { border-color: var(--muted); transform: translateY(-1px); }
.qa .q-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.qa .q-ic svg { width: 19px; }
.qa b { display: block; font-size: 14px; font-weight: 600; }
.qa small { color: var(--muted); font-size: 12px; }

/* ---------- timeline / journal ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border); align-items: start; }
.tl-item:last-child { border-bottom: 0; }
.tl-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.tl-ic svg { width: 19px; }
.tl-title { font-weight: 600; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.tl-note { color: var(--text2); font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface2); color: var(--text2); margin: 4px 4px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 6px; }

/* ---------- charts ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .gridline { stroke: var(--border); stroke-dasharray: 3 4; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 34px; gap: 10px; align-items: center; margin-bottom: 9px; font-size: 13.5px; }
.hbar .track { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; }
.hbar .n { text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h2 { margin: 0; font-size: 20px; font-weight: 640; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; padding-bottom: 4px; }
.day {
  min-height: 86px; border-radius: 12px; padding: 7px 8px;
  background: var(--surface2); border: 1px solid var(--border); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; transition: .15s; position: relative; overflow: hidden;
}
.day:hover { border-color: var(--muted); }
.day.other { opacity: .35; }
.day.future { opacity: .45; cursor: default; }
.day.today { box-shadow: inset 0 0 0 2px var(--violet); }
.day .dn { font-size: 13px; font-weight: 600; color: var(--text2); }
.day.sex { background: linear-gradient(160deg, var(--glow-r), var(--surface2)); border-color: rgba(242,132,154,.45); }
.day.nosex { background: linear-gradient(160deg, rgba(243,189,92,.10), var(--surface2)); }
.day .dl { font-size: 11px; line-height: 1.3; color: var(--text2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.day .heart { position: absolute; inset-inline-end: 7px; top: 6px; color: var(--rose); }
.day .heart svg { width: 15px; }
.day .dots { display: flex; gap: 3px; margin-top: auto; }
.day .dots i { width: 6px; height: 6px; border-radius: 50%; }
.cal-legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-inline-end: 6px; vertical-align: -1px; }

/* ---------- learn ---------- */
.learn { display: grid; grid-template-columns: 290px 1fr; gap: 20px; align-items: start; }
.toc { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; }
.toc button { text-align: start; background: none; border: 1px solid transparent; border-radius: 11px; padding: 10px 12px; cursor: pointer; color: var(--text2); display: flex; gap: 10px; align-items: flex-start; }
.toc button:hover { background: var(--surface); }
.toc button.on { background: var(--surface); border-color: var(--border); color: var(--text); }
.toc .tn { width: 24px; height: 24px; border-radius: 7px; background: var(--surface2); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; color: var(--muted); }
.toc button.on .tn { background: var(--violet); color: #fff; }
.toc .tt { font-size: 14px; font-weight: 560; line-height: 1.35; }
.toc .ts { font-size: 11.5px; color: var(--muted); }
.article { max-width: 780px; }
.article .kicker { color: var(--violet); font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .8px; }
.article h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 8px; letter-spacing: -.3px; }
.article .lede { font-size: 17px; color: var(--text2); margin: 0 0 22px; }
.article h2 { font-size: 19.5px; margin: 30px 0 10px; }
.article h3 { font-size: 16px; margin: 22px 0 8px; }
.article p, .article li { color: var(--text2); font-size: 15.5px; line-height: 1.72; }
.article ul, .article ol { padding-inline-start: 22px; }
.article li { margin-bottom: 6px; }
.article strong { color: var(--text); }
.article a { color: var(--teal); }
.callout { border-radius: 14px; padding: 14px 18px; margin: 18px 0; border: 1px solid var(--border); background: var(--surface2); }
.callout.good { border-color: rgba(111,211,154,.35); background: rgba(111,211,154,.07); }
.callout.warn { border-color: rgba(243,189,92,.4); background: rgba(243,189,92,.07); }
.callout.info { border-color: rgba(149,133,255,.35); background: var(--glow-v); }
.callout p { margin: 0; }
.callout b.ct { display: block; margin-bottom: 4px; color: var(--text); }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-block: 12px; padding-inline: 54px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.steps li::before { content: counter(s); position: absolute; inset-inline-start: 14px; top: 12px; width: 26px; height: 26px; border-radius: 8px; background: var(--violet); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14.5px; }
.table th, .table td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: top; }
.table th { color: var(--text); font-weight: 620; background: var(--surface2); }
.src { font-size: 13px; color: var(--muted); }
.src li { font-size: 13px !important; line-height: 1.5 !important; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; z-index: 50; display: none; }
#modal.open { display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,8,12,.62); backdrop-filter: blur(4px); animation: fadeIn .2s; }
.modal-card {
  position: relative; width: min(620px, 92vw); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .22s ease;
}
.modal-card h2 { margin: 0 0 6px; font-size: 21px; }
.modal-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface3); border: 1px solid var(--border); color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); animation: pop .2s; max-width: 380px; font-size: 14px; }

/* ---------- SOS ---------- */
#sos { position: fixed; inset: 0; z-index: 70; display: none; }
#sos.open { display: block; }
.sos-wrap {
  position: absolute; inset: 0; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 30%, #1a2140 0%, #0b0f17 70%);
  color: #e9ecf5; animation: fadeIn .3s;
}
[data-theme="light"] .sos-wrap { background: radial-gradient(ellipse at 50% 30%, #e7e3fb 0%, #f4f1ec 70%); color: var(--text); }
.sos-inner { max-width: 1100px; margin: 0 auto; padding: 34px 40px 50px; }
.sos-top { display: flex; justify-content: space-between; align-items: center; }
.sos-top h1 { margin: 0; font-size: 24px; font-weight: 640; }
.sos-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; margin-top: 26px; }
.breath-zone { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 18px; padding-top: 20px; position: sticky; top: 20px; align-self: start; }
.breath {
  width: 260px; height: 260px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(95,208,189,.45), rgba(149,133,255,.18) 60%, transparent 72%);
  transition: transform 4s ease-in-out;
  transform: scale(.72);
}
.breath.in { transform: scale(1.08); }
.breath.hold { transform: scale(1.08); }
.breath.out { transform: scale(.72); transition-duration: 6s; }
.breath-core { width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.18); display: grid; place-items: center; text-align: center; font-size: 18px; font-weight: 600; }
[data-theme="light"] .breath-core { background: rgba(255,255,255,.6); border-color: rgba(0,0,0,.08); }
.sos-timer { font-size: 54px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.sos-panel { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 20px 22px; margin-bottom: 16px; }
[data-theme="light"] .sos-panel { background: var(--surface); border-color: var(--border); }
.sos-panel h3 { margin: 0 0 10px; font-size: 15px; }
.sos-steps { margin: 0; padding-inline-start: 20px; }
.sos-steps li { margin-bottom: 7px; color: inherit; opacity: .9; }
.sos-steps li.done { opacity: .45; text-decoration: line-through; }
.wave { font-size: 13px; opacity: .75; }

/* ---------- setup / lock ---------- */
.setup { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(ellipse at 30% 0%, var(--glow-v), transparent 55%), radial-gradient(ellipse at 90% 100%, var(--glow-t), transparent 50%), var(--bg); overflow-y: auto; height: 100vh; }
.setup-card { width: min(720px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 36px 40px; box-shadow: var(--shadow); }
.setup-card h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.3px; }
.setup-card .lede { color: var(--text2); margin: 0 0 24px; font-size: 15.5px; }
.progress-dots { display: flex; gap: 6px; margin-bottom: 26px; }
.progress-dots span { height: 4px; flex: 1; border-radius: 4px; background: var(--track); }
.progress-dots span.on { background: var(--violet); }
.option {
  display: flex; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--surface2); cursor: pointer; margin-bottom: 10px; transition: .15s;
}
.option:hover { border-color: var(--muted); }
.option.on { border-color: var(--violet); background: var(--glow-v); }
.option .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); flex: none; margin-top: 2px; }
.option.on .radio { border: 6px solid var(--violet); }
.option b { display: block; }
.option small { color: var(--text2); font-size: 13.5px; }
.rec { font-size: 11px; background: var(--teal); color: #0b1a17; padding: 2px 8px; border-radius: 99px; font-weight: 700; margin-inline-start: 6px; vertical-align: 1px; }
.lock { height: 100vh; display: grid; place-items: center; background: var(--bg); }
.lock-card { text-align: center; width: 320px; }
.lock-card .brand-mark { width: 56px; height: 56px; margin: 0 auto 16px; font-size: 22px; border-radius: 16px; }
.pin-input { text-align: center; font-size: 26px; letter-spacing: 10px; }
.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

@media (max-width: 1180px) {
  .g4, .qa { grid-template-columns: repeat(2, 1fr); }
  .learn { grid-template-columns: 240px 1fr; }
}

/* ---------- auth & security ---------- */
.link-btn { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 4px 0; font-size: 13.5px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.form-err { display: none; color: var(--red); background: rgba(255,122,122,.08); border: 1px solid rgba(255,122,122,.3); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.code-input { text-align: center; font-size: 26px; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sec-list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 20px; }
.sec-list > div { display: flex; gap: 12px; align-items: flex-start; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; font-size: 14px; color: var(--text2); }
.sec-list svg { width: 18px; height: 18px; flex: none; color: var(--teal); margin-top: 2px; }
.rec-code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 22px; letter-spacing: 2px; text-align: center; padding: 18px; border-radius: 14px; background: var(--bg2); border: 1px dashed var(--violet); margin-bottom: 12px; user-select: all; word-break: break-all; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 560; text-align: end; word-break: break-all; }
.dev-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.lock-card .link-btn { font-size: 13px; }

/* ---------- RTL (Hebrew) ---------- */
[dir="rtl"] .toggle input:checked + span::after { transform: translateX(-18px); }
[dir="rtl"] .ic-flip svg, [dir="rtl"] svg.ic-flip { transform: scaleX(-1); }
[dir="rtl"] .ltr, .ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] input[type="number"], [dir="rtl"] input[type="datetime-local"], [dir="rtl"] input[type="date"], [dir="rtl"] .code-input { direction: ltr; text-align: end; }
[dir="rtl"] .rec-code, [dir="rtl"] .sos-timer { direction: ltr; }
[dir="rtl"] .chart svg { direction: ltr; }

/* ---------- habits / categories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.cat-pick { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 14px 12px; cursor: pointer; text-align: start; display: flex; flex-direction: column; gap: 6px; transition: .15s; color: var(--text2); }
.cat-pick:hover { border-color: var(--surface3); }
.cat-pick.on { border-color: var(--violet); background: var(--glow-v); color: var(--text); }
.cat-pick .ce { font-size: 24px; line-height: 1; }
.cat-pick b { font-size: 14px; color: var(--text); }
.cat-pick small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.habit-cfg { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface); }
.habit-cfg h4 { margin: 0 0 10px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.hab-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.hab-tab { border: 1px solid var(--border); background: var(--surface); color: var(--text2); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; }
.hab-tab.on { background: var(--surface3); color: var(--text); border-color: var(--surface3); font-weight: 600; }
.emo { font-size: 18px; line-height: 1; }
.saved-money { color: var(--green); font-weight: 600; }

/* ---------- assistant ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 2px 14px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; padding: 11px 15px; border-radius: 16px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; }
.msg.user { align-self: flex-end; background: var(--violet); color: #fff; border-end-end-radius: 5px; }
.msg.ai { align-self: flex-start; background: var(--surface2); color: var(--text); border-end-start-radius: 5px; }
.msg.ai b { color: var(--text); }
.msg.err { align-self: center; background: rgba(243,189,92,.1); color: var(--amber); font-size: 13px; }
.chat-in { display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 12px; }
.chat-in textarea { flex: 1; min-height: 46px; max-height: 160px; resize: none; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin: 0 2px; animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }
.starter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.starter button { border: 1px solid var(--border); background: var(--surface); color: var(--text2); border-radius: 12px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; text-align: start; }
.starter button:hover { border-color: var(--violet); color: var(--text); }

/* ---------- terms ---------- */
.terms-box { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; background: var(--bg2); font-size: 13.5px; line-height: 1.65; color: var(--text2); margin-bottom: 14px; }
.terms-box h3 { font-size: 14.5px; margin: 16px 0 6px; color: var(--text); }
.terms-box h3:first-child { margin-top: 0; }
.terms-box p, .terms-box li { margin: 0 0 8px; }
.terms-box ul { padding-inline-start: 20px; margin: 0 0 8px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; cursor: pointer; font-size: 14px; color: var(--text2); }
.check-row input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--violet); flex: none; }
.lang-switch { position: fixed; top: 14px; inset-inline-end: 16px; z-index: 30; }
.help-line { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.help-line:last-child { border-bottom: 0; }
.help-line b.ltr { color: var(--teal); white-space: nowrap; }

/* on-device coach */
.badge-local { font-size: 12px; color: var(--teal); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.coach-chips { align-self: flex-start; max-width: 90%; margin-top: 0; }
.coach-chips button { border-color: var(--violet); color: var(--text); }
/* Google / Apple sign-in */
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; }
.oauth-btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.oauth-btn.google:hover { background: #f4f6f8; }
.oauth-btn.apple { background: #000; color: #fff; border: 1px solid #333; }
.oauth-btn.apple:hover { background: #1a1a1a; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--text3, var(--text2)); font-size: 12.5px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.spin.big { width: 34px; height: 34px; border-width: 3px; border-color: var(--track); border-top-color: var(--violet); }

/* ---------- phones (website only: the desktop window is never this narrow) ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: 100dvh; }
  .main { height: auto; min-height: 0; grid-row: 1; }
  .sidebar { grid-row: 2; flex-direction: row; align-items: stretch; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-inline-end: 0; border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .brand, .sidebar .spacer, .side-foot { display: none; }
  .nav-btn { flex: 1 0 auto; flex-direction: column; gap: 3px; padding: 6px 8px; font-size: 10.5px; min-width: 58px; justify-content: center; align-items: center; text-align: center; }
  .nav-btn.active { box-shadow: inset 0 3px 0 var(--violet); }
  .sos-btn { position: fixed; inset-inline-end: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; margin: 0; padding: 12px 16px; border-radius: 999px; font-size: 14px; }
  .page { padding: 18px 14px 90px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head h1 { font-size: 23px; }
  .g2, .g3, .g4, .g-2-1, .g-1-2, .qa, .sos-grid, .learn { grid-template-columns: 1fr; }
  .qa { grid-template-columns: repeat(2, 1fr); }
  .hbar { grid-template-columns: 96px 1fr 30px; }
  .setup { padding: 12px; place-items: start center; }
  .setup-card { padding: 24px 18px; border-radius: 18px; }
  .setup-card h1 { font-size: 23px; }
  .lang-switch { position: static; margin-bottom: 8px; }
  .modal-card { width: 100% !important; max-height: 92dvh; border-radius: 18px; padding: 20px 16px; }
  .chat-wrap { height: calc(100dvh - 260px); min-height: 320px; }
  .msg { max-width: 92%; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cal { gap: 4px; }
  .table { display: block; overflow-x: auto; }
}

/* =========================================================
   Accessibility menu (a11y.js) — on every screen of the app and the website
   ========================================================= */
.a11y-skip { position: fixed; top: -60px; inset-inline-start: 12px; z-index: 200; background: #fff; color: #000; padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; transition: top .15s; }
.a11y-skip:focus { top: 12px; outline: 3px solid #ffbf00; }
#a11yBtn {
  position: fixed; z-index: 120; top: 50%; inset-inline-end: 0; transform: translateY(-50%);
  width: 46px; height: 50px; display: grid; place-items: center; cursor: pointer;
  background: #1f5bd8; color: #fff; border: 2px solid #fff; border-inline-end: 0;
  border-start-start-radius: 14px; border-end-start-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
#a11yBtn svg { width: 28px; height: 28px; }
#a11yBtn:hover { width: 52px; }
#a11yBtn:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
#a11yBtn.active::after { content: ''; position: absolute; top: 6px; inset-inline-start: 6px; width: 9px; height: 9px; border-radius: 50%; background: #ffbf00; }
#a11yPanel {
  position: fixed; z-index: 121; top: 50%; inset-inline-end: 56px; transform: translateY(-50%);
  width: min(380px, calc(100vw - 72px)); max-height: calc(100dvh - 24px); overflow-y: auto;
  background: #ffffff; color: #111; border: 2px solid #1f5bd8; border-radius: 18px; padding: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45); font-size: 15px; line-height: 1.4;
}
#a11yPanel[hidden] { display: none; }
#a11yPanel button { font: inherit; color: #111; cursor: pointer; }
#a11yPanel button:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
.a11y-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.a11y-head h2 { margin: 0; font-size: 20px; color: #111; }
.a11y-x { background: #eef1f6; border: 0; width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.a11y-size { display: flex; align-items: center; gap: 8px; background: #eef1f6; border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; }
.a11y-size span { flex: 1; font-weight: 650; }
.a11y-size button { background: #fff; border: 1.5px solid #1f5bd8; border-radius: 10px; min-width: 44px; height: 38px; font-weight: 700; }
.a11y-size button[disabled] { opacity: .35; cursor: default; }
.a11y-size output { min-width: 50px; text-align: center; font-weight: 700; }
.a11y-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.a11y-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 74px; padding: 8px; background: #f6f7fa; border: 1.5px solid #d4d9e3; border-radius: 12px; text-align: center; font-size: 13.5px; }
.a11y-grid button i { font-style: normal; font-size: 20px; font-weight: 700; line-height: 1; }
.a11y-grid button.on { background: #1f5bd8; border-color: #1f5bd8; color: #fff; }
.a11y-foot { display: flex; gap: 8px; margin-top: 10px; }
.a11y-foot button { flex: 1; background: #eef1f6; border: 1.5px solid #d4d9e3; border-radius: 12px; padding: 10px 8px; font-weight: 650; font-size: 13.5px; }
.a11y-hint { margin: 10px 0 0; font-size: 12px; color: #444; text-align: center; }
.a11y-stmt { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 16px; }
.a11y-stmt-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.a11y-stmt-card { position: relative; width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: #fff; color: #111; border-radius: 18px; padding: 24px 26px; line-height: 1.6; font-size: 15.5px; }
.a11y-stmt-card h2 { margin: 0 0 10px; font-size: 24px; color: #111; }
.a11y-stmt-card h3 { margin: 18px 0 6px; font-size: 17px; color: #111; }
.a11y-stmt-card ul { padding-inline-start: 20px; margin: 0; }
.a11y-stmt-card .muted { color: #555; font-size: 13px; }
.a11y-stmt-card:focus { outline: none; }
.a11y-stmt-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
@media (max-width: 760px) {
  #a11yBtn { top: auto; bottom: calc(200px + env(safe-area-inset-bottom)); transform: none; width: 42px; height: 46px; }
  #a11yPanel { inset-inline: 8px; top: auto; bottom: 8px; transform: none; width: auto; max-height: calc(100dvh - 16px); }
}

/* --- text size: scale the whole UI, keep full-height layouts fitting the window --- */
html.a11y-zoom #app, html.a11y-zoom #modal, html.a11y-zoom #sos, html.a11y-zoom #toasts { zoom: var(--az); }
html.a11y-zoom .shell, html.a11y-zoom .main, html.a11y-zoom .lock { height: calc(100vh / var(--az)); }
html.a11y-zoom .setup { min-height: calc(100vh / var(--az)); }
html.a11y-zoom .chat-wrap { height: calc(100vh / var(--az) - 150px); }

/* --- colour modes --- */
html.a11y-contrast { --bg: #000; --bg2: #000; --surface: #000; --surface2: #0a0a0a; --surface3: #141414; --border: #fff; --track: #444;
  --text: #fff; --text2: #fff; --muted: #e6e6e6; --teal: #00ffd5; --violet: #ffd400; --rose: #ff6b8b; --amber: #ffd400; --green: #5dff8f; --blue: #7ab8ff; --red: #ff5c5c;
  --glow-v: transparent; --glow-t: transparent; --glow-r: transparent; }
html.a11y-contrast .btn:not(.ghost), html.a11y-contrast .sos-btn { background: #ffd400 !important; color: #000 !important; border: 2px solid #fff !important; }
html.a11y-contrast .btn.ghost, html.a11y-contrast input, html.a11y-contrast textarea, html.a11y-contrast select, html.a11y-contrast .card { border: 1.5px solid #fff !important; }
html.a11y-light { --bg: #fff; --bg2: #fff; --surface: #fff; --surface2: #f2f2f2; --surface3: #e6e6e6; --border: #555; --track: #ccc;
  --text: #000; --text2: #111; --muted: #333; --teal: #006b5c; --violet: #3b22c7; --rose: #a3123a; --amber: #7a4d00; --green: #0b6b34; --blue: #0b4fb3; --red: #b00000;
  --glow-v: transparent; --glow-t: transparent; --glow-r: transparent; }
html.a11y-light .setup { background: #fff !important; }
html.a11y-mono #app, html.a11y-mono #modal, html.a11y-mono #sos { filter: grayscale(1); }
html.a11y-invert #app, html.a11y-invert #modal, html.a11y-invert #sos { filter: invert(1) hue-rotate(180deg); }
html.a11y-invert #app img { filter: invert(1) hue-rotate(180deg); }

/* --- content helpers --- */
html.a11y-links a, html.a11y-links .link-btn { text-decoration: underline !important; text-underline-offset: 3px; outline: 2px solid #ffd400; outline-offset: 1px; }
html.a11y-links #app button, html.a11y-links #modal button { outline: 2px dashed #ffd400; outline-offset: 2px; }
html.a11y-headings #app :is(h1, h2, h3, h4), html.a11y-headings #modal :is(h1, h2, h3) { outline: 2px solid #00b3ff; outline-offset: 3px; background: rgba(0,179,255,.12); }
html.a11y-font body, html.a11y-font #app *, html.a11y-font #modal *, html.a11y-font #sos * { font-family: Arial, "Arial Hebrew", Helvetica, sans-serif !important; font-weight: 600; }
html.a11y-spacing #app *, html.a11y-spacing #modal * { letter-spacing: .06em !important; word-spacing: .14em !important; line-height: 1.7 !important; }
html.a11y-anim *, html.a11y-anim *::before, html.a11y-anim *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.a11y-cursor, html.a11y-cursor * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 3l30 22-13 2 8 16-6 3-8-16-11 9z' fill='%23000' stroke='%23fff' stroke-width='3'/%3E%3C/svg%3E") 6 3, auto !important; }
html.a11y-focus *:focus, html.a11y-focus *:focus-visible { outline: 4px solid #ffbf00 !important; outline-offset: 3px !important; box-shadow: 0 0 0 7px #000 !important; }
/* keyboard focus is always visible (also without the menu) */
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 760px) {
  html.a11y-zoom .shell { height: calc(100dvh / var(--az)); }
  html.a11y-zoom .main { height: auto; }
  html.a11y-zoom .chat-wrap { height: calc(100dvh / var(--az) - 260px); }
}

/* ---------- public legal pages (soful.app/tos, soful.app/privacy) ---------- */
.legal-body { height: auto; min-height: 100%; overflow-y: auto; }
.legal-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px max(16px, calc((100vw - 900px) / 2)); background: var(--bg2); border-bottom: 1px solid var(--border); }
.legal-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 18px; }
.legal-nav, .legal-nav > span { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legal-nav > span[hidden] { display: none; }
.legal-nav a:not(.btn) { color: var(--text2); text-decoration: none; font-size: 14.5px; }
.legal-nav a[aria-current="page"] { color: var(--text); font-weight: 650; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--violet); }
.legal-nav a.btn { text-decoration: none; }
.legal-main { max-width: 900px; margin: 0 auto; padding: 32px 16px 40px; }
.legal-doc { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 30px 36px; line-height: 1.75; font-size: 15.5px; color: var(--text2); }
.legal-doc[hidden] { display: none; }
.legal-doc h2 { margin: 0 0 6px; font-size: 28px; color: var(--text); }
.legal-doc h3 { margin: 26px 0 8px; font-size: 18px; color: var(--text); }
.legal-doc p, .legal-doc li { margin: 0 0 10px; }
.legal-doc ul, .legal-doc ol { padding-inline-start: 22px; }
.legal-doc a, .legal-foot a { color: var(--teal); }
.legal-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 40px; }
.legal-foot span[hidden] { display: none; }
@media (max-width: 760px) { .legal-doc { padding: 20px 16px; font-size: 15px; } .legal-doc h2 { font-size: 23px; } .legal-top { padding: 10px 14px; } }
@media print { .legal-top, .legal-foot, #a11yBtn, #a11yPanel { display: none !important; } .legal-doc { border: 0; color: #000; background: #fff; } }

/* ---------- Diary & Notes ---------- */
.note-search { width: 100%; max-width: 420px; margin: 0 0 16px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.note-card { --nc: var(--border); position: relative; display: flex; flex-direction: column; gap: 8px; text-align: start; padding: 16px 16px 12px; min-height: 120px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-top: 4px solid var(--nc); border-radius: 16px; cursor: pointer; font: inherit; transition: transform .12s, box-shadow .12s; }
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.note-card[hidden] { display: none; }
.note-title { font-size: 16px; padding-inline-end: 22px; overflow-wrap: anywhere; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text2); font-size: 14px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.note-pin { position: absolute; top: 10px; inset-inline-end: 12px; font-size: 14px; }
.c-violet { --nc: var(--violet); } .c-teal { --nc: var(--teal); } .c-amber { --nc: var(--amber); } .c-rose { --nc: var(--rose); } .c-green { --nc: var(--green); } .c-blue { --nc: var(--blue); }
.note-card.c-violet, .note-card.c-teal, .note-card.c-amber, .note-card.c-rose, .note-card.c-green, .note-card.c-blue { background: color-mix(in srgb, var(--nc) 9%, var(--surface)); }
.note-title-in { width: 100%; font-size: 19px; font-weight: 650; border: 0 !important; box-shadow: none !important; background: transparent; padding: 4px 2px 10px; color: var(--text); }
.note-body-in { width: 100%; min-height: 220px; resize: vertical; line-height: 1.6; }
.note-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--nc, var(--surface2)); cursor: pointer; padding: 0; }
.note-sw:not([class*="c-"]) { background: linear-gradient(135deg, var(--surface2) 45%, var(--border) 50%, var(--surface2) 55%); }
.note-sw.on { outline: 3px solid var(--text); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ad-steps { margin: 0 0 14px; padding-inline-start: 22px; line-height: 1.65; }
.ad-steps li { margin-bottom: 8px; }
@media (max-width: 760px) { .notes-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .note-card { padding: 12px; min-height: 100px; } }

/* ---------- Eran AI ---------- */
.badge-ai { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 5px 11px; border-radius: 999px; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 4px 14px rgba(124,58,237,.35); white-space: nowrap; }
.msg .caret { display: inline-block; width: 7px; height: 1.05em; margin-inline-start: 2px; vertical-align: -2px; background: var(--violet); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg code { font-family: Consolas, "Courier New", monospace; font-size: .92em; background: var(--surface3); padding: 1px 5px; border-radius: 5px; }
.msg a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.ai-src { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ai-src span { color: var(--muted); }
.ai-src a { color: var(--teal); text-decoration: none; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-tier { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ---------- Soful Chat ---------- */
.main.main-chat { overflow: hidden; }
.chat-wrap { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; height: 100vh; min-height: 0; }
.chat-wrap > * { min-width: 0; }
.modal-card div.field > span:first-child { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 550; }
.modal-card div.field > small { display: block; margin-top: 6px; }
.chat-side { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--border); background: var(--surface); }
.ch-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px; }
.ch-me { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; border-radius: 12px; min-width: 0; text-align: start; font: inherit; }
.ch-me:hover { background: var(--surface2); }
.ch-me span { display: flex; flex-direction: column; min-width: 0; }
.ch-me b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-me small { font-size: 12px; color: var(--muted); text-align: start; }
.ch-icon-btn { position: relative; width: 40px; padding: 0; display: grid; place-items: center; }
.ch-icon-btn svg { width: 20px; height: 20px; }
.ch-icon-btn .nav-badge { position: absolute; top: -6px; inset-inline-end: -6px; }
.ch-search { padding: 0 14px 10px; }
.ch-search input { width: 100%; }
.ch-list { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.ch-priv { padding: 8px 14px 12px; margin: 0; border-top: 1px solid var(--border); }
.ch-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px; background: none; color: inherit; cursor: pointer; text-align: start; font: inherit; }
.ch-item:hover { background: var(--surface2); }
.ch-item.on { background: color-mix(in srgb, var(--violet) 16%, var(--surface2)); }
.ch-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ch-item-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ch-item-main b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-item-prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.ch-lock { font-size: 11px; opacity: .7; flex: none; }
.ch-unread { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--violet); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.ch-av { flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; line-height: 1; }
.ch-sec { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 14px 6px 6px; }
.ch-empty { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px 20px; height: 100%; align-content: center; gap: 6px; }
.ch-empty.small { height: auto; padding: 30px 12px; }
.ch-loading { display: flex; justify-content: center; gap: 6px; padding: 30px; }
.ch-loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: chDot 1s infinite ease-in-out; }
.ch-loading span:nth-child(2) { animation-delay: .15s; } .ch-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes chDot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: none; } }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.ch-pane-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.ch-back { display: none; }
.ch-head-main { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; background: none; border: 0; color: inherit; cursor: pointer; text-align: start; font: inherit; padding: 2px; }
.ch-head-main span { display: flex; flex-direction: column; min-width: 0; }
.ch-head-main b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-head-main small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-log { flex: 1; overflow-y: auto; padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 3px; }
.ch-day { text-align: center; margin: 12px 0 6px; }
.ch-day span { font-size: 12px; color: var(--muted); background: var(--surface2); padding: 3px 12px; border-radius: 999px; }
.ch-sys { text-align: center; font-size: 12.5px; color: var(--muted); margin: 4px 0; }
.ch-older { text-align: center; margin-bottom: 8px; }
.ch-msg { display: flex; align-items: flex-end; gap: 4px; max-width: min(78%, 620px); align-self: flex-start; }
.ch-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.ch-bub { background: var(--surface2); border: 1px solid var(--border); padding: 7px 11px 5px; border-radius: 16px; border-end-start-radius: 5px; min-width: 64px; overflow-wrap: anywhere; }
.ch-msg.mine .ch-bub { background: linear-gradient(135deg, #7c5cf0, #6d28d9); border-color: transparent; color: #fff; border-end-start-radius: 16px; border-end-end-radius: 5px; }
.ch-msg.mine .ch-bub a { color: #fff; }
.ch-bub a { color: var(--teal); }
.ch-text { font-size: 14.5px; line-height: 1.5; white-space: normal; }
.ch-who { display: block; background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; margin-bottom: 1px; }
.ch-time { display: block; font-size: 10.5px; opacity: .6; text-align: end; margin-top: 2px; }
.ch-more { opacity: 0; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 8px; }
.ch-msg:hover .ch-more, .ch-more:focus-visible { opacity: 1; }
@media (hover: none) { .ch-more { opacity: .55; } }
.ch-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.ch-composer textarea { flex: 1; resize: none; overflow-y: hidden; min-height: 42px; max-height: 160px; border-radius: 14px; padding: 10px 13px; line-height: 1.45; }
.ch-send { height: 42px; width: 46px; padding: 0; display: grid; place-items: center; flex: none; }
[dir="rtl"] .ch-send svg { transform: scaleX(-1); }
.ch-foot-note { padding: 14px; text-align: center; border-top: 1px solid var(--border); background: var(--surface); }
.ch-uname { display: flex; align-items: center; gap: 0; direction: ltr; }
.ch-uname > span { padding: 0 10px; color: var(--muted); font-weight: 700; }
.ch-uname input { flex: 1; }
.ch-ok { color: var(--teal); font-weight: 600; } .ch-bad { color: var(--amber, #f0a35e); font-weight: 600; }
.ch-onboard { max-width: 560px; }
.ch-bullets { padding-inline-start: 0; list-style: none; display: grid; gap: 8px; margin: 14px 0 20px; font-size: 14px; }
.ch-prof-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.ch-frow { display: flex; align-items: center; gap: 8px; }
.ch-frow .ch-item { flex: 1; min-width: 0; }
.ch-members { max-height: 320px; overflow-y: auto; }
.ch-menu { display: grid; gap: 6px; }
.ch-menu .btn { justify-content: flex-start; }
.ch-quote { border-inline-start: 3px solid var(--border); padding-inline-start: 10px; }
.ch-safety { margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface2); }
.ch-safety-num { font-family: Consolas, "Courier New", monospace; font-size: 17px; letter-spacing: .5px; word-spacing: 6px; margin: 8px 0; text-align: center; line-height: 1.7; }
.ch-pick { display: grid; gap: 2px; max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.ch-pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.ch-pick-row:hover { background: var(--surface2); }
.nav-btn { position: relative; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4f6b; color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; margin-inline-start: auto; line-height: 1; }
@media (max-width: 760px) {
  .main-chat ~ .sos-btn, body:has(.chat-wrap.has-open) .sos-btn { display: none; }
  .chat-wrap { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 68px - env(safe-area-inset-bottom)); }
  .chat-wrap.has-open .chat-side { display: none; }
  .chat-wrap:not(.has-open) .chat-pane { display: none; }
  .chat-side { border-inline-end: 0; }
  .ch-back { display: inline-flex; }
  .ch-msg { max-width: 88%; }
  .nav-btn .nav-badge { position: absolute; top: 2px; inset-inline-end: 8px; margin: 0; }
}

/* ---------- moderation ---------- */
.ch-sanction { margin: 0 14px 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--amber) 14%, var(--surface2)); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); font-size: 13.5px; display: grid; gap: 3px; }
.ch-sanction.ch-s-ban { background: color-mix(in srgb, #ef4f6b 14%, var(--surface2)); border-color: color-mix(in srgb, #ef4f6b 45%, transparent); }
.page > .ch-sanction { margin: 0; padding: 18px; font-size: 15px; }
.ad-page .page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ad-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.ad-tab { background: none; border: 0; color: var(--text2); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.ad-tab:hover { background: var(--surface2); color: var(--text); }
.ad-tab.on { background: color-mix(in srgb, var(--violet) 18%, var(--surface2)); color: var(--text); }
.ad-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ad-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.ad-tile.hot { border-color: #ef4f6b; background: color-mix(in srgb, #ef4f6b 10%, var(--surface)); }
.ad-num { font-size: 28px; font-weight: 700; }
.ad-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface3); color: var(--text2); white-space: nowrap; }
.ad-role { background: color-mix(in srgb, var(--violet) 25%, transparent); color: var(--text); }
.ad-mute { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--text); }
.ad-timeout { background: color-mix(in srgb, #f08a4b 25%, transparent); color: var(--text); }
.ad-ban, .ad-st-open { background: color-mix(in srgb, #ef4f6b 25%, transparent); color: var(--text); }
.ad-st-resolved { background: color-mix(in srgb, var(--teal) 22%, transparent); color: var(--text); }
.ad-report { margin-top: 14px; display: grid; gap: 10px; }
.ad-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; align-items: baseline; }
.ad-kv > span:nth-child(odd) { color: var(--muted); font-size: 13px; }
.ad-reason { white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-quote { padding: 10px 12px; border-inline-start: 3px solid var(--violet); background: var(--surface2); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-actions { flex-wrap: wrap; gap: 6px; }
.ad-link { background: none; border: 0; padding: 0; color: var(--teal); font: inherit; font-weight: 600; cursor: pointer; }
.ad-search { margin-bottom: 14px; } .ad-search input { width: 100%; }
.ad-list { display: grid; gap: 2px; padding: 8px; }
.ad-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.ad-row:hover { background: var(--surface2); } .ad-row.static { cursor: default; } .ad-row.static:hover { background: none; }
.ad-logrow { padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ad-logrow:last-child { border-bottom: 0; }
.ad-logrow > div { flex-basis: 100%; }
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.ad-grid .card { margin: 0; } .ad-page .card + .card { margin-top: 14px; }
.ad-msg { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ad-msg > div:first-child { grid-column: 1 / -1; }
.ad-msg > div:nth-child(2) { overflow-wrap: anywhere; white-space: pre-wrap; }
@media (max-width: 760px) { .ad-grid { grid-template-columns: 1fr; } .ad-kv { grid-template-columns: 1fr; gap: 2px; } .ad-kv > span:nth-child(odd) { margin-top: 6px; } }
