/* Visual language modeled on the clinic's previous system (see docs 05): teal primary, dark sidebar, white rounded cards. */
@font-face { font-family: 'Assistant'; font-weight: 400; font-display: swap; src: url('/fonts/assistant-400.woff2') format('woff2'); }
@font-face { font-family: 'Assistant'; font-weight: 600; font-display: swap; src: url('/fonts/assistant-600.woff2') format('woff2'); }
@font-face { font-family: 'Assistant'; font-weight: 700; font-display: swap; src: url('/fonts/assistant-700.woff2') format('woff2'); }

:root {
  --primary: #00acc1;
  --primary-dark: #00838f;
  --primary-soft: #e0f5f8;
  --sidebar: #004157;
  --sidebar-active: #00566b;
  --bg: #f3f6f9;
  --card: #ffffff;
  --row: #f7f9fb;
  --text: #141415;
  --body: #3c4858;
  --muted: #6c859d;
  --border: #e3e8ee;
  --line: #d3dbe3;
  --danger: #e53935;
  --ok: #2e9e5b;
  --ok-soft: #e3f4ea;
  --warn: #e08a00;
  --warn-soft: #fdf1dc;
  --today: #fff8dd;
  --chip: #f0f3f6;
  --radius-card: 16px;
  --radius-tile: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101820; --card: #17222c; --row: #1c2935; --text: #eef3f7; --body: #c9d4de; --muted: #8aa1b5;
    --border: #253441; --line: #2e4150; --primary-soft: #0e3640; --ok-soft: #123526; --warn-soft: #3a2c10;
    --today: #2c2a17; --chip: #22313e; --sidebar: #00303f; --sidebar-active: #00485a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
svg { width: 1.2em; height: 1.2em; vertical-align: -0.2em; flex: none; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--body); font: 15px/1.5 'Assistant', 'Open Sans Hebrew', Arial, sans-serif; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text); margin: 0; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.status { min-height: 1.4em; color: var(--danger); font-size: 14px; margin: 6px 0; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: var(--radius-card); padding: 32px; }
.auth-card h1 { font-size: 26px; margin: 18px 0 8px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--primary-dark); font-weight: 700; }
.brand-mark { display: inline-block; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff 0 22%, var(--primary) 23% 100%); }
.secret { display: block; direction: ltr; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; letter-spacing: 1px; word-break: break-all; }

/* ---------- form controls (underline style) ---------- */
label { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 2px; padding: 6px 2px; font: inherit; font-size: 15px; color: var(--text);
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; outline: none;
}
input:focus, select:focus, textarea:focus { border-bottom: 2px solid var(--primary); padding-bottom: 5px; }
textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; min-height: 90px; }
textarea:focus { border: 2px solid var(--primary); padding: 9px; }
select { background: var(--card); }
input[type=checkbox] { display: inline-block; width: auto; margin: 0; accent-color: var(--primary); }
input[type=color] { width: 44px; height: 30px; padding: 0; border: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 24px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 24px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--body); font-size: 14px; margin: 10px 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--body); font-size: 14px; margin: 10px 0; cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line); position: relative; transition: .15s; }
.switch input::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { inset-inline-start: 18px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 22px; border-radius: 48px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font-weight: 600; }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.outline { background: transparent; color: var(--primary-dark); }
.btn.outline:hover { background: var(--primary-soft); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 32px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.auth-card .btn { width: 100%; margin-top: 14px; }
.divider { text-align: center; font-size: 13px; margin: 14px 0 0; }
.link { background: none; border: 0; color: var(--primary-dark); padding: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--chip); color: var(--primary-dark); }
.icon-btn.on { color: var(--ok); }
.icon-btn.warn { color: var(--warn); }
.icon-btn svg, .nav-item svg, .fab svg, .btn svg, .chip svg { width: 20px; height: 20px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset-inline-start: 0; top: 0; bottom: 0; width: 94px; background: var(--sidebar); display: flex; flex-direction: column; align-items: center; padding: 18px 8px; z-index: 20; }
.logo .brand-mark { width: 36px; height: 36px; }
#nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; width: 100%; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 8px; color: #fff; font-size: 12px; text-decoration: none; }
.nav-item:hover { background: var(--sidebar-active); text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); }
.profile { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; color: var(--sidebar); font-weight: 700; }
.main { flex: 1; margin-inline-start: 94px; padding: 24px 48px 32px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 32px; font-weight: 700; }
.page-sub { color: var(--body); font-size: 16px; }
.head-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; }
.fab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.fab:hover { background: var(--primary-dark); }
.fab svg { width: 26px; height: 26px; }
.bell { position: relative; color: var(--text); }
.bell .count { position: absolute; top: -2px; inset-inline-end: -2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; display: grid; place-items: center; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 40px; }

/* ---------- menus ---------- */
.menu { position: absolute; z-index: 50; min-width: 200px; background: var(--card); border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .14); padding: 6px 0; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; background: none; border: 0; color: var(--text); text-align: start; font-size: 14px; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--row); }
.menu .menu-head { padding: 8px 16px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--border); }
.menu svg { width: 18px; height: 18px; color: var(--muted); }

/* ---------- cards, tiles, rows ---------- */
.card { background: var(--card); border-radius: var(--radius-card); padding: 24px 32px; margin-bottom: 24px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 22px; font-weight: 700; }
.card-head .spacer { flex: 1; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cards2 > .card { margin-bottom: 0; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius-tile); padding: 14px 18px; background: var(--card); }
.tile.active { background: var(--primary); border-color: var(--primary); }
.tile.active * { color: #fff !important; }
.tile-label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.tile-label b { color: var(--text); font-size: 16px; }
.tile-label .help { margin-inline-start: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--line); color: #fff; font-size: 11px; display: grid; place-items: center; cursor: help; }
.tile-value { font-size: 26px; font-weight: 700; color: var(--text); margin-top: 6px; }
.tile-value small { font-size: 14px; color: var(--muted); font-weight: 400; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 48px; border-radius: 10px; background: var(--row); }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--primary-soft); }
.row .name { min-width: 160px; color: var(--primary-dark); font-weight: 600; }
.row .name.unassigned { color: var(--muted); font-weight: 400; }
.row .grow { flex: 1; min-width: 0; }
.row .num { width: 28px; color: var(--muted); font-size: 14px; text-align: center; }
.row .date { min-width: 110px; font-weight: 600; color: var(--text); }
.row .kind { display: flex; align-items: center; gap: 6px; min-width: 90px; font-weight: 600; color: var(--text); }
.row .kind svg { width: 20px; height: 20px; color: var(--warn); }
.row .acts { display: flex; gap: 2px; margin-inline-start: auto; }
.row .note-text { white-space: pre-wrap; color: var(--body); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--chip); color: var(--text); font-size: 14px; white-space: nowrap; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.chip svg { width: 14px; height: 14px; color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: #fdecea; color: var(--danger); }
.day-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 18px 4px 8px; }
.empty { color: var(--muted); padding: 16px 4px; }
.debt { color: var(--danger); }
.badge { margin-inline-start: 6px; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.note { background: var(--warn-soft); padding: 10px 14px; border-radius: 10px; margin: 10px 0; color: var(--body); }

/* ---------- filters ---------- */
.filters { display: grid; grid-template-columns: 2fr 1.4fr 1.2fr 1.2fr 1.4fr; gap: 0 20px; align-items: end; margin-bottom: 8px; }
.filters label { margin: 0; }
.multi { position: relative; }
.multi .menu { min-width: 180px; padding: 8px 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 15px; }
th { text-align: start; font-weight: 700; color: var(--text); padding: 6px 12px; white-space: nowrap; }
td { padding: 10px 12px; background: var(--row); white-space: nowrap; }
tr td:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
tr td:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
th.sort { cursor: pointer; }
.wa { color: #25d366; }

/* ---------- case header and tabs ---------- */
.case-meta { color: var(--body); font-size: 16px; margin: -8px 0 6px; }
.case-desc { color: var(--text); font-size: 17px; margin: 10px 0; white-space: pre-wrap; }
.contact-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -8px -32px 18px; padding: 0 32px; overflow-x: auto; }
.tabs a { padding: 14px 22px; color: var(--muted); font-size: 16px; border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; }
.tabs a.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tabs-card { padding-bottom: 0; }
.bar { display: block; height: 10px; border-radius: 5px; background: var(--primary); min-width: 2px; }
.tabs-card .tabs { margin-bottom: 0; border-bottom: 0; }
.accordion { background: var(--row); border-radius: 12px; margin: 12px 0; }
.accordion > summary { list-style: none; cursor: pointer; padding: 18px 24px; font-size: 18px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::after { content: '⌄'; margin-inline-start: auto; color: var(--muted); }
.accordion[open] > summary::after { content: '⌃'; }
.accordion > .acc-body { padding: 0 24px 18px; }
.contact-row { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr 34px; gap: 0 16px; align-items: end; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.actions.start { justify-content: flex-start; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: inline-flex; gap: 6px; }
.cal-nav button, .seg button { height: 40px; min-width: 40px; padding: 0 14px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 10px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); margin-inline-start: auto; }
.seg button { border: 0; height: 34px; }
.seg button.on { background: var(--primary); color: #fff; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--card); border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border); }
.month .dow { padding: 6px; text-align: center; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); }
.month .cell { min-height: 96px; padding: 4px 6px; border-top: 1px solid var(--border); border-inline-start: 1px solid var(--border); cursor: pointer; overflow: hidden; }
.month .cell.other { color: var(--muted); }
.month .cell.today { background: var(--today); }
.month .dnum { font-size: 14px; }
.hol { display: block; background: #9aa5b1; color: #fff; font-size: 12px; border-radius: 4px; padding: 0 6px; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hol.chag { background: #7b8794; }
.ev { display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; overflow: hidden; cursor: pointer; }
.ev .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.ev .t { color: var(--muted); }
.ev b { overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ev.unassigned b { color: var(--muted); font-weight: 400; }
.ev.cancelled b { text-decoration: line-through; }
.more { font-size: 13px; color: var(--primary-dark); }
.tgrid { display: grid; background: var(--card); border-radius: var(--radius-card); border: 1px solid var(--border); overflow: hidden; }
.tgrid .hcell { padding: 6px; text-align: center; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); }
.tgrid .hcell.today, .tgrid .col.today { background: var(--today); }
.tgrid .allday { min-height: 26px; border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); padding: 2px; }
.tgrid .times { position: relative; }
.tgrid .tlabel { height: 48px; font-size: 13px; color: var(--muted); padding: 0 6px; border-top: 1px solid var(--border); }
.tgrid .col { position: relative; border-inline-start: 1px solid var(--border); background-image: linear-gradient(var(--border) 1px, transparent 1px); background-size: 100% 48px; cursor: pointer; }
.tgrid .blk { position: absolute; inset-inline: 3px; border-radius: 4px; padding: 2px 6px; color: #fff; font-size: 13px; overflow: hidden; cursor: pointer; }
.tgrid .blk.unassigned { opacity: .55; }
.tgrid .blk.cancelled { opacity: .45; text-decoration: line-through; }

/* ---------- dialogs ---------- */
.dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; border: 0; border-radius: var(--radius-card); padding: 26px 30px; background: var(--card); color: var(--body); }
.dialog::backdrop { background: rgba(0, 20, 30, .45); }
.dialog .dlg-head { display: flex; align-items: center; margin-bottom: 8px; }
.dialog h2 { font-size: 22px; }
.dialog .close { margin-inline-start: auto; }
.dialog .actions { justify-content: flex-start; }
.dialog .full-link { margin-inline-start: auto; align-self: center; }
.checks { display: grid; gap: 2px; margin: 8px 0; max-height: 220px; overflow-y: auto; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .main { padding: 18px 16px 90px; margin-inline-start: 0; }
  .sidebar { top: auto; width: 100%; height: 64px; flex-direction: row; padding: 0 8px; }
  .sidebar .logo, .profile .profile-label { display: none; }
  #nav { flex-direction: row; margin: 0; justify-content: space-around; }
  .nav-item { padding: 6px 2px; font-size: 11px; flex: 1; }
  .profile { margin: 0 4px; }
  .tiles, .cards2, .filters, .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .card { padding: 18px 16px; }
  .tabs { margin: -4px -16px 14px; padding: 0 16px; }
  .page-head h1 { font-size: 26px; }
  .row .name { min-width: 0; }
  .month .cell { min-height: 70px; }
  .contact-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .tiles, .cards2, .filters, .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}
