/* Design C: bottom tabs on phones, fixed sidebar on desktop, stage-coloured labels.
   Loaded after mobile.css and overrides its tokens and layout. */

@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/rubik-hebrew.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/rubik-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --page: #F3F6F5;
  --surface: #FFFFFF;
  --surface-soft: #EBF0EE;
  --ink: #15201E;
  --muted: #55625F;
  --line: #E1E8E5;
  --accent: #1F5F57;
  --accent-strong: #164842;
  --accent-soft: #E3EFEC;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --warn: #8A5300;
  --warn-soft: #FFF4E5;
  --ok: #1D7A46;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --tabbar-h: 64px;
  --shadow: 0 12px 40px rgba(21, 32, 30, 0.14);
  --shadow-sm: 0 1px 3px rgba(21, 32, 30, 0.08);
  font-family: 'Rubik', system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

/* The closed sidebar sits off-screen; in RTL that widened the phone layout. */
html, body { overflow-x: clip; }
body { font-size: 15px; }
button { border-radius: 10px; }
.primary { color: #FFFFFF; font-weight: 500; }
.search-input { border-radius: 999px; padding-inline: 18px; box-shadow: var(--shadow-sm); border-color: transparent; }
.status-line { font-size: 13px; }

/* ── Top bar ── */
.topbar { background: var(--page); border-bottom: 0; padding-bottom: 6px; }
.topbar .actions, #userLine, .menu-btn { display: none; }
.brand strong { font-size: 24px; font-weight: 700; }

/* ── Sidebar: "More" sheet on phones, fixed rail on desktop ── */
.sidebar { width: var(--sidebar-w); padding-inline: 10px; gap: 2px; transition: transform .22s ease-out, visibility .22s; }
.sidebar:not(.open) { visibility: hidden; }
.sidebar-brand { padding: 4px 8px 16px; }
.sidebar-brand strong { font-size: 18px; color: var(--accent); }
.nav-item { border-radius: 10px; min-height: 44px; padding: 10px 12px; font-weight: 500; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-icon, .tab-item svg, .icon-btn svg, .action-btn svg, .row-chevron {
  width: 22px; height: 22px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Bottom tab bar (phones only) ── */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 8px max(8px, env(safe-area-inset-bottom));
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 52px; border: 0; background: transparent; color: var(--muted);
  font-size: 12px; padding: 6px 0; border-radius: 10px;
}
.tab-item.active { color: var(--accent); font-weight: 700; }
body.signed-in .app { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
body.signed-in .scroll-top { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }

/* ── Chips (specialty filter) ── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips:empty { display: none; }
.chip {
  flex: 0 0 auto; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid #D5DEDB; background: var(--surface); color: var(--ink); font-size: 13px;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; font-weight: 500; }

/* ── Contacts list: alphabetical rows ── */
.list { padding: 0 14px 14px; }
.contact-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); padding: 10px 12px; margin-bottom: 6px;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow .16s ease-out;
}
.contact-row:hover { box-shadow: 0 6px 18px rgba(21, 32, 30, 0.1); }
.contact-row .contact-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.contact-row .contact-title { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }
.contact-row .name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row .meta { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.icon-btn:hover { background: #D3E6E1; }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Drawer / doctor card ── */
.drawer { background: var(--page); }
.drawer-head { align-items: center; }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 4px 0 12px; }
.profile-head strong { font-size: 22px; font-weight: 700; }
.profile-head .meta { font-size: 14px; }
.action-grid { gap: 8px; margin: 0 0 14px; }
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0;
  border-radius: var(--radius-lg); background: var(--surface); color: var(--ink);
  text-decoration: none; font-size: 13px; box-shadow: var(--shadow-sm);
}
.action-btn.primary-action { background: var(--accent); color: #FFFFFF; font-weight: 500; }
.action-btn.disabled { opacity: .45; pointer-events: none; }
.secondary-actions { flex-wrap: wrap; margin-bottom: 14px; }
.secondary-actions button { min-height: 38px; font-size: 13px; border-radius: 999px; }
.facts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0;
  background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.facts-grid .detail { border-top: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
.facts-grid > .detail:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.facts-grid .detail span { font-weight: 500; overflow-wrap: anywhere; }
.facts-grid .detail-more { grid-column: 1 / -1; background: var(--surface); border-top: 0; padding: 12px 14px; }
.facts-grid .detail-more .detail-grid { grid-template-columns: 1fr; }
.facts-grid .detail-more .detail { padding: 10px 0 0; border-top: 1px solid var(--line); }
.section-block { border-top: 0; }
.section-block h4 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }

/* ── Row lists (dashboard, expert's cases) ── */
.row-list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px;
  padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; text-align: start; color: var(--ink);
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: #F7FAF9; }
.row-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--accent); }
.row-dot.overdue { background: var(--danger); }
.row-dot.stuck { background: var(--warn); }
.row-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.row-title { font-size: 15px; font-weight: 500; }
.row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.row-chevron { width: 18px; height: 18px; color: var(--muted); }
body[dir="ltr"] .row-chevron { transform: scaleX(-1); }

/* Stage label: tinted with the stage colour (Trello-style) */
.stage-badge {
  --stage: #6B7280;
  min-height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: color-mix(in oklch, var(--stage) 16%, white);
  color: color-mix(in oklch, var(--stage) 55%, black);
}
.due-tag { font-weight: 500; color: var(--accent); }
.due-tag.overdue { color: var(--danger); }
.due-tag.warn { color: var(--warn); }

/* ── Dashboard ── */
.dash { display: flex; flex-direction: column; gap: 14px; padding: 4px 14px 20px; }
.dash-hero {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; min-height: 0;
  border: 0; border-radius: 20px; background: var(--accent); color: #FFFFFF; text-align: start;
}
.dash-hero:hover { background: var(--accent-strong); }
.dash-hero-num { font-size: 48px; font-weight: 700; line-height: 1; }
.dash-hero-text { display: flex; flex-direction: column; gap: 2px; }
.dash-hero-label { font-size: 17px; font-weight: 700; }
.dash-hero-sub { font-size: 13px; opacity: .9; }
.metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; gap: 8px; }
.metric-card {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-height: 0;
  border: 0; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); text-align: start;
}
.metric-card:hover { box-shadow: 0 6px 18px rgba(21, 32, 30, 0.1); }
.metric-card .metric-value { font-size: 22px; font-weight: 700; }
.metric-card .metric-label { margin: 0; }
.metric-card.green .metric-value { color: var(--ink); }
.metric-card.yellow .metric-value { color: var(--warn); }
.metric-card.red .metric-value { color: var(--danger); }
.dash-cols { display: grid; gap: 14px; }
.dash-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dash-section { padding: 0; }
.dash-h { margin: 0 4px 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.dash-h.warn { color: var(--warn); }
.dash-empty { margin: 0; border: 0; border-radius: var(--radius-lg); }
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 8px 14px; box-shadow: var(--shadow-sm); }
.bar-link { width: 100%; border: 0; background: none; color: inherit; border-radius: 8px; text-align: start; min-height: 36px; }
.bar-link:hover { background: var(--surface-soft); }
.bar-track, .bar-fill { display: block; }

/* Case cards elsewhere pick up the new surface style */
.case-card { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.case-title { font-weight: 500; }

/* ── Desktop: fixed sidebar, no tab bar, wider content ── */
@media (min-width: 900px) {
  .bottom-nav { display: none !important; }
  body.signed-in .app { padding-bottom: 0; }
  body.signed-in .scroll-top { bottom: 24px; }
  body.signed-in .sidebar { transform: none; box-shadow: none; visibility: visible; }
  .sidebar-overlay { display: none !important; }
  #moreTabBtn { display: none; }
  .app, body.signed-in .app {
    max-width: none; margin: 0; margin-inline-start: var(--sidebar-w);
    border: 0;
  }
  .topbar, .section-page { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 24px; box-sizing: border-box; }
  .list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-inline: 0; }
  .contact-row { margin: 0; }
  .dash { padding-inline: 0; }
  .dash-hero-num { font-size: 56px; }
  .dash-cols { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .drawer, .drawer.open {
    top: 0; bottom: 0; left: auto; right: auto; inset-inline-end: 0; width: min(560px, 100vw);
    transform: none; opacity: 0; visibility: hidden;
    transition: opacity .18s ease-out, visibility .18s;
    border-inline-start: 1px solid var(--line);
  }
  .drawer.open { opacity: 1; visibility: visible; }
}

@media (min-width: 1300px) {
  .list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Phone: scale the whole interface up (user found the default text too small).
   zoom enlarges every screen evenly, including inline-styled case cards. ── */
@media (max-width: 899px) {
  body { zoom: 1.15; }
}
