:root {
  --ink: #243330;
  --muted: #65736f;
  --canvas: #f4f7f5;
  --paper: #fff;
  --line: #dce5e1;
  --brand: #176f62;
  --brand-dark: #0e5148;
  --brand-soft: #e6f2ee;
  --coral: #c4514b;
  --coral-soft: #fbe9e7;
  --green: #397d59;
  --green-soft: #e8f4ec;
  --blue: #39769b;
  --blue-soft: #e5f1f8;
  --amber: #b66b20;
  --amber-soft: #fff0db;
  --violet: #70558f;
  --violet-soft: #f0eafa;
}

body[data-theme="purple"] {
  --ink: #302838;
  --muted: #746b7d;
  --canvas: #f7f4f9;
  --brand: #76518d;
  --brand-dark: #503663;
  --control-hover: #76518d;
  --control-hover-soft: #f1eaf5;
  --brand-soft: #eee6f3;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 0; overflow-x: clip; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Heebo, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar { position: sticky; z-index: 100; top: 0; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100vw - 1520px) / 2)); color: #fff; background: var(--brand-dark); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 600 1.3rem Newsreader, serif; }
.display-name { padding-inline-start: 10px; border-inline-start: 1px solid rgb(255 255 255 / 35%); font: 400 .82rem Heebo, sans-serif; opacity: .9; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgb(255 255 255 / 45%); border-radius: 50%; font-family: Heebo, sans-serif; }
.top-actions { display: flex; gap: 6px; }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 5px; cursor: pointer; text-decoration: none; }
.icon-button svg { width: 19px; height: 19px; }
.topbar .icon-button { border-color: rgb(255 255 255 / 25%); }

.app-shell { width: min(1520px, calc(100% - 32px)); margin: 24px auto 48px; }
.guest-notice { margin-bottom: 18px; padding: 14px 18px; color: #513d23; background: #fff5df; border: 1px solid #ead6a4; border-radius: 7px; }
.guest-notice strong { display: block; margin-bottom: 3px; }
.guest-notice p { margin: 0; line-height: 1.6; }
.guest-notice a, .guest-login-link { color: inherit; font-weight: 700; text-underline-offset: 3px; }
.guest-login-link { padding: 8px 10px; }
.eyebrow { margin: 0 0 3px; color: var(--brand); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.22rem; }

.status-band { margin-bottom: 20px; padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.section-heading, .panel-heading, .calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.primary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; color: #fff; background: var(--brand); border: 0; border-radius: 5px; font-weight: 700; cursor: pointer; }
.primary-button:hover { background: var(--brand-dark); }
.onset-action.primary-button { background: var(--coral); }
.onset-action.primary-button:hover { background: #a43f3a; }
.primary-button svg { width: 17px; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 20px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.status-item { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px; border-inline-end: 1px solid var(--line); }
.status-item:last-child { border-inline-end: 0; }
.status-item > svg { width: 22px; flex: 0 0 auto; }
.status-item div { min-width: 0; display: grid; gap: 2px; }
.status-item span { color: var(--muted); font-size: .76rem; }
.status-item strong { overflow-wrap: anywhere; font-size: .95rem; }
.status-current svg { color: var(--coral); } .status-count svg { color: var(--green); }
.status-mikveh svg { color: var(--blue); } .status-next svg { color: var(--amber); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.drawer-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.drawer-shortcut { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 8px 12px; color: var(--brand-dark); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; font-weight: 700; cursor: pointer; }
.drawer-shortcut:hover, .drawer-shortcut:focus-visible { color: var(--brand-dark); background: var(--brand-soft); border-color: var(--brand); }
.drawer-shortcut svg { width: 19px; height: 19px; }
.calendar-section, .action-panel, .vest-panel, .notification-panel, .journal-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.calendar-section { position: relative; padding: 16px 22px 94px; scroll-margin-top: 100px; }
.calendar-add-button { --calendar-add-accent: var(--brand); --calendar-add-hover: var(--brand-dark); position: absolute; inset-inline-end: 22px; inset-block-end: 22px; width: 62px; height: 62px; display: grid; place-items: center; color: #fff; background: var(--calendar-add-accent); border: 0; border-radius: 18px; box-shadow: 0 5px 14px rgb(20 36 32 / 24%); cursor: pointer; transition: background .15s ease, transform .15s ease, box-shadow .15s ease; }
.calendar-add-button[data-next-step="onset"] { --calendar-add-accent: var(--coral); --calendar-add-hover: #a43f3a; }
.calendar-add-button[data-next-step="hefsek"] { --calendar-add-accent: var(--violet); --calendar-add-hover: #594174; }
.calendar-add-button[data-next-step="shivah"] { --calendar-add-accent: var(--green); --calendar-add-hover: #2c6244; }
.calendar-add-button[data-next-step="mikveh"] { --calendar-add-accent: var(--blue); --calendar-add-hover: #2c5e7b; }
.calendar-add-button:hover { background: var(--calendar-add-hover); transform: translateY(-2px); box-shadow: 0 8px 18px rgb(20 36 32 / 28%); }
.calendar-add-button:focus-visible { outline: 3px solid var(--calendar-add-accent); outline-offset: 3px; }
.calendar-add-button svg { width: 26px; height: 26px; stroke-width: 2.5; }
.chat-launcher { position: fixed; z-index: 20; inset-inline-start: 22px; inset-block-end: 22px; min-height: 52px; display: inline-flex; align-items: center; gap: 9px; padding: 0 17px; color: #fff; background: var(--brand-dark); border: 0; border-radius: 999px; box-shadow: 0 5px 16px rgb(20 36 32 / 24%); font-weight: 700; cursor: pointer; }
.chat-launcher:hover { background: var(--brand); transform: translateY(-1px); }
.chat-launcher svg { width: 20px; height: 20px; }
.chat-dialog { position: fixed; inset: auto 22px 86px auto; width: min(440px, calc(100% - 28px)); max-height: min(680px, calc(100dvh - 110px)); margin: 0; padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 48px rgb(20 36 32 / 25%); overflow: hidden; }
.chat-dialog::backdrop { background: rgb(20 36 32 / 38%); }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; background: var(--brand-soft); border-bottom: 1px solid var(--line); }
.chat-header .eyebrow { margin-bottom: 2px; }
.chat-header h2 { font-size: 1.08rem; }
.chat-header .icon-button { width: 34px; height: 34px; color: var(--muted); border-color: var(--line); }
.chat-messages { max-height: 240px; display: flex; flex-direction: column; gap: 9px; padding: 16px 16px 8px; overflow-y: auto; }
.chat-message { max-width: 88%; margin: 0; padding: 10px 12px; background: #f1f5f3; border-radius: 12px 12px 12px 3px; font-size: .9rem; line-height: 1.55; }
.chat-message-user { align-self: flex-start; color: #fff; background: var(--brand); border-radius: 12px 12px 3px 12px; }
.chat-form-container { max-height: 340px; padding: 0 16px; overflow-y: auto; }
.chat-form-container form { margin: 6px 0 12px; padding: 14px; background: #fbfcfb; border: 1px solid var(--line); border-radius: 10px; }
.chat-form-container form h2 { font-size: 1rem; }
.chat-form-container form .eyebrow { font-size: .68rem; }
.chat-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
.chat-option { min-height: 38px; padding: 7px 12px; color: var(--brand-dark); background: var(--paper); border: 1px solid var(--brand); border-radius: 999px; font-size: .84rem; font-weight: 700; cursor: pointer; }
.chat-option:hover { color: #fff; background: var(--brand); }
.chat-option:disabled { opacity: .5; cursor: not-allowed; }
.chat-option:disabled:hover { color: var(--brand-dark); background: var(--paper); }
.chat-disclaimer { margin: 0; padding: 8px 16px 12px; color: var(--muted); border-top: 1px solid var(--line); font-size: .72rem; }
.calendar-toolbar { text-align: center; }
.calendar-toolbar .icon-button { color: var(--brand); border-color: var(--line); }
.calendar-heading { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 8px; }
.calendar-heading h2 { white-space: nowrap; }
.hebrew-range { margin: 0; color: var(--muted); font-size: .83rem; }
.view-toggle { display: flex; justify-content: center; gap: 4px; width: fit-content; margin: 8px auto 0; padding: 3px; background: #eef2f0; border-radius: 999px; }
.view-toggle button { padding: 6px 20px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; font-weight: 700; cursor: pointer; }
.view-toggle button.active { color: var(--ink); background: var(--paper); box-shadow: 0 1px 3px rgb(20 47 41 / 12%); }
.tahara-progress { margin: 18px 0 0; padding: 17px 14px 13px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.tahara-progress h2 { color: var(--muted); font-size: 1.12rem; text-align: right; }
.progress-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 14px 0 0; padding: 0; list-style: none; }
.progress-steps li { position: relative; display: grid; justify-items: center; gap: 6px; min-width: 0; color: var(--muted); text-align: center; }
.progress-steps li:not(:last-child)::after { content: ''; position: absolute; z-index: 0; top: 14px; inset-inline-start: 50%; width: 100%; height: 3px; background: #e2e5eb; }
.progress-steps li.complete:not(:last-child)::after { background: var(--brand); }
.progress-steps span { position: relative; z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); background: var(--paper); border: 3px solid #e2e5eb; border-radius: 50%; font-weight: 800; }
.progress-steps strong { max-width: 100%; font-size: .84rem; font-weight: 700; overflow-wrap: anywhere; }
.source-note { margin: 9px 0 0; color: var(--muted); font-size: .68rem; text-align: center; }
.progress-steps li.active { color: var(--brand-dark); }
.progress-steps li.active span, .progress-steps li.complete span { color: #fff; background: var(--brand); border-color: var(--brand); }
.progress-steps li.active strong { font-weight: 800; }
.halachic-source { color: var(--muted); font-size: .7rem; line-height: 1.5; text-align: start; }
.halachic-source summary { width: fit-content; color: var(--muted); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.halachic-source summary:hover,
.halachic-source summary:focus-visible { color: var(--brand); }
.source-quote { margin: 8px 0 0; padding-inline-start: 10px; border-inline-start: 2px solid var(--line); }
.source-quote blockquote { margin: 0; color: var(--ink); font: 400 .92rem/1.8 "Frank Ruhl Libre", "Noto Serif Hebrew", serif; }
.source-quote figcaption { margin-top: 2px; color: var(--muted); font: 400 .66rem/1.5 Heebo, sans-serif; }
.vest-sources { display: grid; gap: 5px; padding-top: 10px; }
.progress-steps li[data-progress-step="onset"].active,
.progress-steps li[data-progress-step="onset"].complete { color: var(--coral); }
.progress-steps li[data-progress-step="onset"].active span,
.progress-steps li[data-progress-step="onset"].complete span { background: var(--coral); border-color: var(--coral); }
.progress-steps li[data-progress-step="onset"] span { border-color: #dcaaa6; }
.progress-steps li[data-progress-step="hefsek"].active,
.progress-steps li[data-progress-step="hefsek"].complete { color: var(--violet); }
.progress-steps li[data-progress-step="hefsek"].active span,
.progress-steps li[data-progress-step="hefsek"].complete span { background: var(--violet); border-color: var(--violet); }
.progress-steps li[data-progress-step="hefsek"] span { border-color: #b9a8ce; }
.progress-steps li[data-progress-step="shivah"].active,
.progress-steps li[data-progress-step="shivah"].complete { color: var(--green); }
.progress-steps li[data-progress-step="shivah"].active span,
.progress-steps li[data-progress-step="shivah"].complete span { background: var(--green); border-color: var(--green); }
.progress-steps li[data-progress-step="shivah"] span { border-color: #9bc8aa; }
.progress-steps li[data-progress-step="mikveh"].active,
.progress-steps li[data-progress-step="mikveh"].complete { color: var(--blue); }
.progress-steps li[data-progress-step="mikveh"].active span,
.progress-steps li[data-progress-step="mikveh"].complete span { background: var(--blue); border-color: var(--blue); }
.progress-steps li[data-progress-step="mikveh"] span { border-color: #9ac2d9; }
.process-animation-link { display:inline-flex; align-items:center; gap:6px; margin-top:16px; color:var(--brand); font-size:.8rem; font-weight:800; text-decoration:none; }
.process-animation-link:hover { color:var(--brand-dark); text-decoration:underline; }
.process-animation-link svg { width:16px; height:16px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin: 18px 0 14px; padding: 10px; background: #f8faf9; border-block: 1px solid var(--line); }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.niddah-dot { background: var(--coral); } .hefsek-dot { background: var(--violet); }
.clean-dot { background: var(--green); } .mikveh-dot { background: var(--blue); } .vest-dot { background: var(--amber); }
.weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.weekdays { margin-bottom: 6px; }
.weekdays span { padding: 5px; color: var(--muted); font-size: .76rem; font-weight: 700; text-align: center; }
.day-cell { position: relative; aspect-ratio: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; color: var(--ink); background: #fbfcfb; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
@media (min-width: 1100px) {
  .day-cell { aspect-ratio: auto; min-height: clamp(84px, 7vw, 124px); }
}
.day-cell:hover, .day-cell:focus-visible { z-index: 1; outline: 2px solid var(--brand); outline-offset: 1px; }
.day-cell.selected { z-index: 1; outline: 3px solid var(--brand-dark); outline-offset: -3px; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--brand-dark); }
.day-cell.empty { visibility: hidden; }
.day-number { font-size: 1rem; font-weight: 800; }
.hebrew-day { color: var(--muted); font-size: .66rem; white-space: nowrap; }
.day-badge { position: absolute; inset-block-start: 3px; inset-inline-start: 3px; max-width: calc(100% - 6px); padding: 1px 4px; overflow: hidden; color: #fff; border-radius: 3px; font-size: .57rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.day-sub-badge {
  position: absolute;
  inset-inline-start: 3px;
  inset-block-end: 3px;
  max-width: calc(100% - 6px);
  padding: 1px 4px;
  color: #fff;
  background: var(--blue);
  border-radius: 3px;
  font-size: .52rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.day-action { position: absolute; inset-block-start: 3px; inset-inline-end: 3px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; padding: 0; color: #fff; background: #8b9491; border: 0; border-radius: 50%; opacity: 0; pointer-events: none; cursor: pointer; transition: opacity .15s ease, transform .15s ease; }
.day-action svg { width: 13px; height: 13px; }
.day-cell:hover .day-action, .day-action:focus-visible { opacity: 1; pointer-events: auto; }
.day-action:hover { transform: scale(1.08); }
.day-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.day-cell.today:not(.selected)::after { content: 'היום'; position: absolute; inset-block-end: 3px; color: var(--brand); font-size: .52rem; font-weight: 800; line-height: 1; }
.day-cell.niddah { background: var(--coral-soft); border-color: #dcaaa6; } .niddah .day-badge { background: var(--coral); }
.day-cell.niddah .day-action { background: var(--coral); }
.day-cell.hefsek-ready .day-action { background: var(--violet); }
.day-cell.hefsek { background: var(--violet-soft); border-color: #b9a8ce; } .hefsek .day-badge { background: var(--violet); }
.day-cell.hefsek .day-action { background: var(--violet); }
.day-cell.shivah { background: var(--green-soft); border-color: #9bc8aa; } .shivah .day-badge { background: var(--green); }
.day-cell.shivah .day-action { background: var(--green); }
.day-cell.mikveh { background: var(--blue-soft); border-color: #9ac2d9; } .mikveh .day-badge { background: var(--blue); }
.day-cell.mikveh .day-action { background: var(--blue); }
.day-cell.shivah.mikveh { background: linear-gradient(180deg, var(--green-soft), var(--blue-soft)); border-color: #8fc3aa; }
.day-cell.shivah.mikveh .day-badge { background: var(--green); }
.day-cell.shivah.mikveh .day-sub-badge { background: var(--blue); }
.day-cell.vest { background: var(--amber-soft); border-color: #e0b374; } .vest .day-badge { background: var(--amber); }
.day-cell.vest .day-action { background: var(--amber); }

.side-panel { display: grid; gap: 20px; }
.action-panel, .vest-panel, .notification-panel, .journal-panel { padding: 20px; }
.action-list { display: grid; gap: 4px; margin-top: 15px; }
.action-item { border-bottom: 1px solid var(--line); }
.action-item:last-child { border-bottom: 0; }
.action-list button { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 8px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: right; cursor: pointer; }
.action-item > button { border-bottom: 0; }
.action-list button:last-child { border-bottom: 0; }
.action-list button:hover { background: #f7faf8; }
.action-list button:disabled { color: var(--muted); opacity: .5; cursor: not-allowed; }
.action-list button:disabled:hover { background: transparent; }
.action-list button.onset-action { color: var(--coral); }
.action-list button.onset-action:hover { background: var(--coral-soft); }
.action-list svg { width: 20px; color: var(--brand); }
.action-list span { display: grid; }
.action-list small { color: var(--muted); }
.action-item .halachic-source { padding: 0 39px 10px; }
.count-badge { min-width: 28px; height: 28px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 50%; font-weight: 800; }
.vest-list { display: grid; gap: 0; margin-top: 12px; }
.vest-item { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.vest-item:last-child { border-bottom: 0; }
.vest-date { display: grid; place-items: center; align-content: center; min-height: 40px; padding: 5px 3px; color: var(--amber); background: var(--amber-soft); border-radius: 5px; font-size: .72rem; font-weight: 800; text-align: center; direction: ltr; }
.vest-item p { margin: 0; font-weight: 700; }.vest-item small { color: var(--muted); }
.empty-state { margin: 18px 0 4px; color: var(--muted); font-size: .88rem; }
.notification-status { margin: 12px 0 4px; color: var(--muted); font-size: .88rem; }
.notification-list { display: grid; gap: 8px; }
.notification-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.notification-item:last-child { border-bottom: 0; }
.notification-item span { color: var(--muted); white-space: nowrap; }
.journal-list { display: grid; gap: 0; margin-top: 12px; }
.journal-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.journal-item:last-child { border-bottom: 0; }
.journal-item-heading { display: flex; align-items: baseline; justify-content: flex-start; gap: 18px; }
.journal-item-heading strong { font-size: .9rem; }
.journal-item-heading span { color: var(--brand); font-size: .72rem; font-weight: 700; }
.journal-item p { margin: 4px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.journal-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--brand); font-size: .8rem; font-weight: 800; text-decoration: none; }
.journal-link:hover { color: var(--brand-dark); text-decoration: underline; }
.journal-link svg { width: 15px; height: 15px; }

dialog { width: min(390px, calc(100% - 28px)); padding: 26px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 24px 70px rgb(20 47 41 / 25%); }
.utility-drawer[open] { position: fixed; inset: 0 auto 0 0; width: min(440px, calc(100vw - 28px)); max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; overflow-x: hidden; overflow-y: auto; border: 0; border-inline-end: 1px solid var(--line); border-radius: 0; box-shadow: 0 12px 42px rgb(20 36 32 / 22%); animation: drawer-in .22s ease-out; }
.utility-drawer::backdrop { background: rgb(20 36 32 / 38%); }
.drawer-header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.drawer-header h2 { font-size: 1.15rem; }
.drawer-header .icon-button { width: 36px; height: 36px; color: var(--muted); border-color: var(--line); }
.utility-drawer .side-panel { display: grid; gap: 12px; padding: 16px; }
.utility-drawer .action-panel, .utility-drawer .vest-panel, .utility-drawer .notification-panel, .utility-drawer .journal-panel { padding: 20px; }
.utility-drawer .action-panel[hidden], .utility-drawer .vest-panel[hidden], .utility-drawer .notification-panel[hidden], .utility-drawer .journal-panel[hidden] { display: none; }
.form-dialog { --form-accent: var(--brand); --form-soft: var(--brand-soft); border-top: 4px solid var(--form-accent); }
.form-dialog[data-form-type="onset"] { --form-accent: var(--coral); --form-soft: var(--coral-soft); }
.form-dialog[data-form-type="hefsek"] { --form-accent: var(--violet); --form-soft: var(--violet-soft); }
.form-dialog[data-form-type="bedikah"] { --form-accent: var(--green); --form-soft: var(--green-soft); }
.form-dialog[data-form-type="mikveh"] { --form-accent: var(--blue); --form-soft: var(--blue-soft); }
.form-dialog .eyebrow { color: var(--form-accent); }
.form-dialog .primary-button { background: var(--form-accent); }
.form-dialog .primary-button:hover { background: var(--control-hover); }
.day-dialog { --day-accent: #8b9491; --day-soft: #f1f3f2; border-top: 4px solid var(--day-accent); }
.day-dialog[data-day-type="niddah"] { --day-accent: var(--coral); --day-soft: var(--coral-soft); }
.day-dialog[data-day-type="hefsek"] { --day-accent: var(--violet); --day-soft: var(--violet-soft); }
.day-dialog[data-day-type="shivah"] { --day-accent: var(--green); --day-soft: var(--green-soft); }
.day-dialog[data-day-type="mikveh"] { --day-accent: var(--blue); --day-soft: var(--blue-soft); }
.day-dialog[data-day-type="vest"] { --day-accent: var(--amber); --day-soft: var(--amber-soft); }
.day-dialog .eyebrow { color: var(--day-accent); }
.day-dialog .event-row { background: var(--day-soft); border-inline-start-color: var(--day-accent); }
.day-dialog .primary-button { background: var(--day-accent); }
.day-dialog .onset-action.primary-button { background: var(--coral); }
.day-dialog .onset-action.primary-button:hover { background: #a43f3a; }
.day-dialog .primary-button:hover { background: var(--control-hover); }
.day-dialog .secondary-action-button { min-height: 42px; flex: 1; padding: 9px 16px; color: var(--day-accent); background: transparent; border: 1px solid var(--day-accent); border-radius: 5px; font-weight: 700; cursor: pointer; }
.day-dialog .onset-action.secondary-action-button { color: var(--coral); border-color: var(--coral); }
.day-dialog .onset-action.secondary-action-button:hover { color: #a43f3a; background: var(--coral-soft); border-color: #a43f3a; }
.day-dialog .secondary-action-button:hover { color: var(--control-hover); background: var(--control-hover-soft); border-color: var(--control-hover); }
.dialog-drag-handle { width: 48px; height: 5px; margin: -12px auto 14px; background: var(--day-accent); border-radius: 999px; cursor: grab; touch-action: none; opacity: .7; }
.dialog-drag-handle:active { cursor: grabbing; }
dialog::backdrop { background: rgb(20 36 32 / 48%); backdrop-filter: blur(2px); }
.day-dialog { position: fixed; inset: 50% auto auto 50%; width: min(420px, calc(100% - 28px)); max-height: min(720px, calc(100vh - 28px)); margin: 0; padding: 20px 22px; border-radius: 16px; transform: translate(-50%, -50%); animation: day-dialog-in .28s cubic-bezier(.22, 1, .36, 1); }
.form-dialog { position: fixed; inset: 50% auto auto 50%; width: min(420px, calc(100% - 28px)); max-height: min(720px, calc(100vh - 28px)); margin: 0; padding: 20px 22px; border-radius: 16px; transform: translate(-50%, -50%); animation: day-dialog-in .28s cubic-bezier(.22, 1, .36, 1); overflow-x: hidden; overflow-y: auto; }
.day-dialog::backdrop, .form-dialog::backdrop { animation: backdrop-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes day-dialog-in { from { opacity: 0; transform: translate(-50%, -47%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawer-in { from { opacity: .7; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
.dialog-close { position: absolute; inset-block-start: 12px; inset-inline-end: 12px; color: var(--muted); border-color: transparent; }
.dialog-date { margin: 3px 0 20px; color: var(--muted); }
.day-events { display: grid; gap: 8px; }
.event-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #f7faf8; border-inline-start: 3px solid var(--brand); }
.event-actions { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.event-action { width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; color: var(--brand); background: transparent; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.event-action svg { width: 15px; height: 15px; }
.event-action:hover { color: var(--control-hover); background: var(--control-hover-soft); border-color: var(--control-hover); }
.event-action-delete { color: #a43c34; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.dialog-actions button { flex: 1; min-width: 130px; }
.context-action-warning { flex: 1 0 100%; margin: 0; padding: 10px 12px; color: #8e2d2a; background: #fbe9e7; border: 1px solid rgb(164 60 52 / 22%); border-radius: 6px; font-size: .84rem; font-weight: 700; line-height: 1.5; }
.sync-status { min-height: 20px; margin: 0; color: var(--muted); font-size: .82rem; }
.sync-status[data-type="success"] { color: var(--green); }
.sync-status[data-type="error"] { color: var(--coral); }
form { display: grid; gap: 15px; }
form h2 { margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.onset-time-row { grid-template-columns: 1fr; }
.onset-time-input { min-height: 48px; font-size: 1.05rem; }
.date-pair { margin-bottom: -2px; }
form label { display: grid; gap: 5px; font-size: .86rem; font-weight: 700; }
form input, form select, form textarea { width: 100%; min-height: 42px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #b9c9c4; border-radius: 5px; }
form input[readonly] { color: var(--muted); background: #f7faf8; }
.hebrew-date-field { position: relative; }
.hebrew-date-field input { cursor: pointer; }
.hebrew-date-field input:disabled { cursor: not-allowed; }
.hebrew-date-picker { position: absolute; z-index: 3; inset: 100% 0 auto; display: grid; grid-template-columns: 1fr 1.2fr .75fr; gap: 6px; margin-top: 5px; padding: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 8px 24px rgb(20 47 41 / 16%); }
.hebrew-date-picker select { min-width: 0; min-height: 38px; padding: 6px; color: var(--ink); background: #fff; border: 1px solid #b9c9c4; border-radius: 4px; }
.radio-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.radio-group legend { grid-column: 1 / -1; margin-bottom: -2px; font-size: .86rem; font-weight: 700; }
.radio-option { display: flex; grid-template-columns: none; align-items: center; gap: 8px; min-height: 42px; padding: 8px 10px; background: #fff; border: 1px solid #b9c9c4; border-radius: 5px; cursor: pointer; }
.radio-option input { width: 17px; height: 17px; min-height: 17px; margin: 0; accent-color: var(--brand); }
.check-row { grid-template-columns: 20px 1fr; align-items: center; }
.check-row input { width: 18px; min-height: 18px; accent-color: var(--brand); }
.form-error {
  display: block;
  min-height: 20px;
  margin: 0;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgb(164 60 52 / 0.22);
  border-radius: 8px;
  background: rgb(164 60 52 / 0.08);
  color: #8e2d2a;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.45;
  position: relative;
  padding-inline-start: 34px;
}
.form-error[hidden] {
  display: none;
}
.form-error::before {
  content: '✕';
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .92rem;
  font-weight: 900;
}
.form-error[data-type="success"] {
  background: rgb(32 137 97 / 0.09);
  border-color: rgb(32 137 97 / 0.25);
  color: #176c4d;
}
.form-error[data-type="success"]::before { content: '✓'; }
.form-error[data-type="info"] {
  background: rgb(61 96 166 / 0.08);
  border-color: rgb(61 96 166 / 0.2);
  color: #24528a;
}
.form-error[data-type="info"]::before { content: 'i'; }
.zmanim-hint { min-height:20px; margin:0; color:var(--muted); font-size:.8rem; }
.zmanim-hint a { color:var(--brand); }
.zmanim-info-button { width:32px; height:32px; display:grid; place-items:center; margin:4px 0 2px auto; padding:0; color:var(--brand); background:var(--brand-soft); border:1px solid var(--line); border-radius:50%; cursor:pointer; }
.zmanim-info-button:hover { color:var(--control-hover); background:var(--control-hover-soft); border-color:var(--control-hover); }
.zmanim-info-button svg { width:17px; height:17px; }
.check-row small { display: inline-block; margin-inline-start: 5px; color: var(--muted); font-size: .78rem; font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .day-dialog, .form-dialog, .utility-drawer, .day-dialog::backdrop, .form-dialog::backdrop { animation: none; }
  .calendar-add-button { transition: none; }
}

@media (max-width: 900px) {
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-item:nth-child(2) { border-inline-end: 0; }
  .status-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .topbar { min-width: 0; padding-inline: 10px; }
  .brand > span:not(.brand-mark) { display: none; }
  .top-actions { flex: 0 1 auto; gap: 4px; }
  .topbar .icon-button { width: 34px; height: 34px; }
  .app-shell { width: calc(100% - 20px); margin-top: 12px; }
  .day-dialog { width: calc(100% - 28px); max-width: 420px; max-height: 90dvh; overflow-x: hidden; overflow-y: auto; padding: 22px 16px; }
  .form-dialog { width: calc(100% - 28px); max-width: 420px; max-height: 90dvh; padding: 22px 16px; }
  .day-dialog .dialog-actions { display: grid; grid-template-columns: 1fr; }
  .day-dialog .dialog-actions button { width: 100%; min-width: 0; }
  .status-band, .action-panel, .vest-panel, .notification-panel, .journal-panel { padding: 15px; }
  .calendar-section { padding: 12px 15px 86px; }
  .calendar-add-button { inset-inline-end: 15px; inset-block-end: 15px; width: 56px; height: 56px; border-radius: 16px; }
  .chat-launcher { inset-inline-start: 12px; inset-block-end: 12px; min-height: 48px; padding-inline: 14px; }
  .chat-dialog { inset: auto 0 0; width: 100%; max-width: none; max-height: 88dvh; border-radius: 16px 16px 0 0; }
  .chat-messages { max-height: 24dvh; }
  .chat-form-container { max-height: 43dvh; }
  .section-heading { align-items: flex-start; }
  .section-heading .primary-button { width: 42px; padding: 0; font-size: 0; }
  .section-heading .primary-button svg { width: 19px; }
  .status-grid { grid-template-columns: 1fr; }
  .status-item { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .status-item:last-child { border-bottom: 0; }
  .drawer-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .drawer-shortcut { min-height: 44px; }
  .weekdays, .calendar-days { gap: 3px; }
  .day-cell { min-height: 0; aspect-ratio: 1; border-radius: 4px; padding-top: 20px; }
  .day-number { font-size: .86rem; }
  .hebrew-day { font-size: .56rem; }
  .day-badge { position: static; margin-top: 2px; max-width: 100%; font-size: .5rem; }
  .day-action { inset-block-start: 2px; inset-inline-end: 2px; width: 18px; height: 18px; }
  .day-action svg { width: 11px; height: 11px; }
}

.board-tour[hidden] { display: none; }
.board-tour-shade { position: fixed; z-index: 1000; inset: 0; background: rgb(24 18 31 / 58%); }
.board-tour-card { position: fixed; z-index: 1003; inset: auto 24px 24px; width: min(420px, calc(100% - 48px)); margin-inline: auto; padding: 22px 24px 20px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 8px; box-shadow: 0 18px 50px rgb(24 18 31 / 32%); animation: board-tour-in .24s ease-out; }
.board-tour-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .78rem; font-weight: 700; }.board-tour-close { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }.board-tour-close svg { width: 16px; }
.board-tour-card .eyebrow { margin-top: 14px; }.board-tour-card h2 { margin: 0; font-size: 1.35rem; }.board-tour-card > p:not(.eyebrow) { margin: 8px 0 20px; color: var(--muted); line-height: 1.7; }.board-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.tour-skip { padding: 8px 0; color: var(--muted); background: transparent; border: 0; cursor: pointer; }.board-tour-actions .primary-button { min-height: 40px; }.board-tour-actions .primary-button svg { width: 16px; }
.board-tour-target { position: relative !important; z-index: 1002 !important; outline: 3px solid #edb6c9 !important; outline-offset: 5px; box-shadow: 0 0 0 8px rgb(237 182 201 / 22%), 0 8px 28px rgb(24 18 31 / 28%) !important; animation: board-tour-pulse 1.5s ease-in-out infinite; }
@keyframes board-tour-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes board-tour-pulse { 0%, 100% { outline-offset: 5px; } 50% { outline-offset: 8px; } }
@media (max-width: 600px) { .board-tour-card { inset-inline: 14px; inset-block-end: 14px; width: auto; padding: 18px; } }