/* ── MedComply Dashboard — Shared Styles ── */
:root {
  /* Brand */
  --mc-dark: #207d73;
  --mc-primary: #2da696;
  --mc-light: #3ac2b1;
  --mc-pale: #eaf7f3;

  /* Neutrals */
  --mc-bg: #f9fafb;
  --mc-card: #ffffff;
  --mc-text: #111827;
  --mc-text-secondary: #6b7280;
  --mc-border: #e5e7eb;

  /* Semantic */
  --mc-error: #dc2626;
  --mc-warning: #d97706;
  --mc-success: #16a34a;

  /* Spacing */
  --mc-space-xs: 4px;
  --mc-space-sm: 8px;
  --mc-space-md: 16px;
  --mc-space-lg: 24px;
  --mc-space-xl: 32px;

  /* Radius */
  --mc-radius-card: 12px;
  --mc-radius-input: 8px;
  --mc-radius-pill: 999px;

  /* Shadow */
  --mc-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --mc-shadow-lg: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);

  /* Typography */
  --mc-font: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mc-text-xs: 12px;
  --mc-text-sm: 13px;
  --mc-text-base: 15px;
  --mc-text-lg: 18px;
  --mc-text-xl: 22px;

  /* Backward-compat aliases (elan-* -> mc-*) */
  --elan-green: var(--mc-primary);
  --elan-green-light: var(--mc-light);
  --elan-green-dark: var(--mc-dark);
  --elan-teal: var(--mc-primary);
  --elan-teal-light: var(--mc-light);
  --elan-bg: var(--mc-bg);
  --elan-white: var(--mc-card);
  --elan-border: var(--mc-border);
  --elan-border-light: #f0f0f0;
  --elan-text: var(--mc-text);
  --elan-text-dark: #1f243c;
  --elan-text-light: var(--mc-text-secondary);
  --elan-text-muted: var(--mc-text-secondary);
  --elan-red: var(--mc-error);
  --elan-red-light: #fdecea;
  --elan-green-badge: #6fc99e;
  --elan-link: #135eb4;
  --elan-link-dark: #0d4a8f;
  --elan-radius: var(--mc-radius-card);
  --elan-shadow: var(--mc-shadow);
  --elan-font: var(--mc-font);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { background: #fff; }

/* ══════════════════════════════════════
   Google Material 3 — MedComply variant
   Heebo (Google Hebrew font) + teal brand
   ══════════════════════════════════════ */

html, body {
  min-height: 100vh;
  /* direction inherits from <html dir="rtl|ltr"> — i18n.js flips it per language. */
  text-align: start;
  font-family: 'Heebo', 'Google Sans', 'Roboto', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1f1f1f;
  background: transparent;
  position: relative;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Background image ──
   Matches the pre-Cognito login visual recipe: `cover` fills the
   viewport, `center top` anchors the image to the top so the focal point
   (upper portion of the photo) stays visible and only the bottom edge
   crops on narrow windows. `fixed` prevents parallax-style scroll-up.
   Pages that want a flat surface override this in their own inline
   <style> with `!important`. */
body {
  background: #fff url('background.webp') center top / cover no-repeat fixed !important;
}

/* ── Material 3 Typography Scale ── */
h1 { font-size: 24px; font-weight: 500; color: #1f1f1f; line-height: 1.3; letter-spacing: 0; }
h2 { font-size: 20px; font-weight: 500; color: #1f1f1f; line-height: 1.35; }
h3 { font-size: 16px; font-weight: 500; color: #1f1f1f; line-height: 1.4; }
p  { font-size: 14px; color: #444746; line-height: 1.5; }
small, .caption { font-size: 12px; color: #5f6368; }

/* ── Links (Google teal) ── */
a { color: #207d73; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar (thin, Google style) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dadce0; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }

/* ── Safe area iOS ── */
.mc-bottom-bar { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ── Page load fade (Material motion) ──
   Scoped away from bg-reveal pages — those own their own theatre
   (1.0s image-only → 400ms overlay → 800ms content). Running this
   0.2s fadein in parallel is redundant on those pages. Internal app
   pages (no bg-reveal-active/bg-reveal-resting class) still get the
   smooth 0.2s transition between navigations. */
body:not(.bg-reveal-active):not(.bg-reveal-resting) { animation: mc-fadein 0.2s ease-out; }
@keyframes mc-fadein { from { opacity: 0; } to { opacity: 1; } }

label {
  display: block;
  text-align: start;
}

.form-group {
  text-align: start;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-primary {
  background: var(--elan-green);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--elan-green-dark); }

.btn-outline {
  background: transparent;
  color: var(--elan-green);
  border: 2px solid var(--elan-green);
}
.btn-outline:hover:not(:disabled) { background: var(--elan-green-light); }

.btn-large {
  padding: 12px 32px;
  font-size: 14px;
  height: 48px;
  border-radius: 24px;
}

/* ── Inputs ── */
input, select, textarea {
  /* direction inherits from root; content-type overrides below force LTR
     on email/password/tel/number/url fields regardless of UI direction. */
  text-align: start;
}
/* Content types that are always LTR by content (emails, passwords, numbers,
   phone numbers, URLs) — keep LTR + end-align inside an RTL UI, start-align
   inside an LTR UI. text-align:start resolves correctly in both directions. */
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"] {
  direction: ltr;
  text-align: start;
}

.input-field {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  text-align: start;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus {
  outline: none;
  border-color: #207d73;
  box-shadow: 0 0 0 2px rgba(32,125,115,0.2);
}
.input-field::placeholder {
  color: #5f6368;
}

/* ── Card (Material 3: filled card) ── */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  padding: 24px;
}

/* ── Top bar (Material 3: top app bar) ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #dadce0;
  padding: 0 16px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo {
  font-size: 16px;
  font-weight: 700;
  color: #207d73;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.topbar-logo svg, .topbar-logo i[data-lucide] { color: #1f1f1f; }
.topbar-nav {
  display: flex;
  gap: 8px;
  list-style: none;
}
.topbar-nav a {
  text-decoration: none;
  color: #1f1f1f;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  transition: background 0.2s;
}
.topbar-nav a:hover,
.topbar-nav a.active {
  background: var(--elan-green-light);
  color: var(--elan-green);
}

/* ── More menu (dropdown) ── */
.more-wrap { position: relative; list-style: none; }
.more-trigger {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--elan-text); font-size: 0.95rem; font-weight: 400;
  padding: 8px 16px; border-radius: var(--elan-radius);
  background: none; border: none; cursor: pointer; font-family: inherit;
  line-height: 1.4;
  transition: background 0.2s;
}
.more-trigger:hover { background: var(--elan-green-light); color: var(--elan-green); }
.more-trigger .chev { font-size: 0.7rem; transition: transform 0.2s; }
.more-wrap.open .more-trigger { background: var(--elan-green-light); color: var(--elan-green); }
.more-wrap.open .more-trigger .chev { transform: rotate(180deg); }
.more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 290px;
  background: #fff;
  border: 1px solid var(--elan-border);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.12);
  padding: 8px;
  z-index: 200;
}
.more-wrap.open .more-menu { display: block; }
.more-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--elan-text);
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s;
}
.more-item:hover { background: rgba(45,166,150,0.08); }
.more-item .ico {
  width: 36px; height: 36px;
  background: rgba(45,166,150,0.1); color: var(--elan-green);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.more-item .ico [data-lucide] { width: 18px; height: 18px; stroke-width: 1.8; }
.more-item .text { display: flex; flex-direction: column; min-width: 0; }
.more-item .text .title { font-weight: 600; color: var(--elan-text); font-size: 0.93rem; }
.more-item .text .desc { font-size: 0.78rem; color: var(--elan-text-light); margin-top: 1px; }
.more-divider { height: 1px; background: #f0f0f0; margin: 6px 4px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--elan-text-light);
}
.topbar-logout {
  background: var(--elan-red-light);
  border: 1.5px solid var(--elan-red);
  color: var(--elan-red);
  cursor: pointer;
  font-family: var(--elan-font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--elan-radius);
  transition: background 0.2s, color 0.2s;
}
.topbar-logout:hover { background: var(--elan-red); color: #fff; }

/* ── Nav new record button (topbar) — must override .btn-primary from elan-ui.css ── */
.topbar .nav-new-record,
a.nav-new-record.btn-primary,
.nav-new-record {
  padding: 6px 16px !important;
  border-radius: 6px !important;
  font-size: 0.85rem !important;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: var(--elan-green) !important;
  color: #fff !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  font-family: var(--elan-font);
  transition: background 0.2s;
  line-height: 1.4;
  min-height: auto !important;
  width: auto !important;
  box-shadow: none !important;
}
.nav-new-record:hover {
  background: var(--elan-green-dark) !important;
  filter: none !important;
}

/* ── Page layout ── */
.page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--elan-green-dark);
  margin-bottom: 24px;
}

/* ── Error / success messages ── */
.msg {
  padding: 12px 16px;
  border-radius: var(--elan-radius);
  font-size: 0.95rem;
  margin-bottom: 16px;
}
.msg-error {
  background: #fdecea;
  color: var(--elan-red);
  border: 1px solid #f5c6cb;
}
.msg-success {
  background: var(--elan-green-light);
  color: var(--elan-green-dark);
  border: 1px solid #b7e4c7;
}
.msg:empty { display: none; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--elan-border);
  border-top-color: var(--elan-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Dashboard cards grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.dash-card {
  background: var(--elan-white);
  border-radius: var(--elan-radius);
  box-shadow: var(--elan-shadow);
  padding: 28px 24px;
  text-align: center;
  text-decoration: none;
  color: var(--elan-text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}
.dash-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-color: var(--elan-green);
}
.dash-card-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.dash-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.dash-card-desc {
  font-size: 0.9rem;
  color: var(--elan-text-light);
}

/* ── Collapsible form fields ── */
.cf-group {
  border-radius: var(--elan-radius);
  transition: background 0.15s;
}
.cf-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 6px 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.cf-toggle:hover {
  background: var(--elan-green-light);
}
.cf-chevron {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--elan-text-light);
  transition: transform 0.2s;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.cf-closed .cf-chevron {
  transform: rotate(-90deg);
}
html[dir="rtl"] .cf-closed .cf-chevron {
  transform: rotate(90deg);
}
.cf-preview {
  margin-inline-start: auto;
  margin-inline-end: 8px;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--elan-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  opacity: 0;
  transition: opacity 0.2s;
}
.cf-closed .cf-preview {
  opacity: 1;
}
.cf-body {
  overflow: hidden;
  max-height: 200px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
  margin-top: 4px;
}
.cf-closed .cf-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

/* ── Hamburger button (hidden on desktop) ── */
.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}
.topbar-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--elan-text-dark);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.topbar-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar-hamburger.open span:nth-child(2) { opacity: 0; }
.topbar-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── AutoFill component ── */
.autofill-wrap { position: relative; }
.af-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.af-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--elan-green-badge);
  color: var(--elan-green);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  font-size: 0.88rem;
  font-weight: 500;
}
.af-tag-x {
  background: none;
  border: none;
  color: var(--elan-green);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-weight: 700;
  border-radius: 50%;
  transition: background 0.15s;
}
.af-tag-x:hover { background: rgba(26,115,64,0.15); }
.af-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  inset-inline-end: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 2px solid #1a9e6f;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
}
.af-dropdown.af-open { display: block; }
.af-option {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: background 0.1s;
}
.af-option:hover, .af-option.af-active { background: var(--elan-green-badge); }
.af-label { font-size: 0.95rem; font-weight: 500; color: #1e1e22; }
.af-sublabel { font-size: 0.78rem; color: var(--elan-text-muted); }
.af-option-other { border-top: 1px solid rgba(0,0,0,0.06); }
.af-option-other .af-label { color: var(--elan-green); font-style: italic; }

/* ── Responsive ── */
/* ════════════════════════════════════════════════════
   SKELETON LOADERS
   ════════════════════════════════════════════════════ */
.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 6px;
  color: transparent !important;
}
.skeleton-line { display: block; height: 14px; margin: 8px 0; }
.skeleton-row td { padding: 14px 16px; }
.skeleton-row .skeleton { width: 100%; height: 14px; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════
   ACTION SHEET (replaces confirm() for destructive ops)
   ════════════════════════════════════════════════════ */
.action-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 600; display: none;
}
.action-sheet-overlay.open { display: block; }
.action-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 601;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  max-width: 480px; margin: 0 auto;
  display: none;
}
.action-sheet.open { display: block; transform: translateY(0); }
.action-sheet-handle { width: 40px; height: 4px; background: #d0d0d0; border-radius: 9999px; margin: 0 auto 14px; }
.action-sheet-title { font-size: 1.1rem; font-weight: 700; text-align: center; color: var(--elan-text); margin-bottom: 6px; }
.action-sheet-desc { font-size: 0.92rem; color: var(--elan-text-light); text-align: center; margin-bottom: 18px; }
.action-sheet-btn {
  display: block; width: 100%; padding: 14px;
  border: none; border-radius: 12px;
  font-family: inherit; font-size: 1rem; font-weight: 700;
  cursor: pointer; margin-bottom: 8px;
}
.action-sheet-btn.danger { background: var(--elan-red); color: #fff; }
.action-sheet-btn.danger:hover { background: #b71c1c; }
.action-sheet-btn.cancel { background: #f0f0f0; color: var(--elan-text); }
.action-sheet-btn.cancel:hover { background: #e0e0e0; }

/* ════════════════════════════════════════════════════
   COMMAND PALETTE (Cmd+K / /)
   ════════════════════════════════════════════════════ */
.cmdk-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 700; display: none; align-items: flex-start; justify-content: center;
  padding: 80px 20px 20px;
}
.cmdk-overlay.open { display: flex; }
.cmdk-modal {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 70vh;
}
.cmdk-input {
  width: 100%; padding: 18px 20px;
  border: none; outline: none;
  font-family: inherit; font-size: 1.05rem;
  border-bottom: 1px solid var(--elan-border);
}
.cmdk-list { list-style: none; padding: 6px; margin: 0; overflow-y: auto; flex: 1; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  cursor: pointer; transition: background 0.1s;
  font-size: 0.95rem;
}
.cmdk-item.active, .cmdk-item:hover { background: rgba(45,166,150,0.1); }
.cmdk-item .ico { width: 28px; height: 28px; background: rgba(45,166,150,0.1); color: var(--elan-green); border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmdk-item .ico [data-lucide] { width: 16px; height: 16px; stroke-width: 1.8; }
.cmdk-item .label { flex: 1; }
.cmdk-item .hint { font-size: 0.78rem; color: var(--elan-text-light); }
.cmdk-empty { padding: 30px; text-align: center; color: var(--elan-text-light); font-size: 0.9rem; }
.cmdk-footer { padding: 8px 14px; background: #fafbfc; border-top: 1px solid var(--elan-border); font-size: 0.78rem; color: var(--elan-text-light); }

/* ════════════════════════════════════════════════════
   SWIPE ACTIONS (for list rows)
   ════════════════════════════════════════════════════ */
.swipeable { position: relative; touch-action: pan-y; }
.swipe-content { position: relative; transition: transform 0.25s; background: #fff; z-index: 2; }
.swipe-content.swiped { transform: translateX(-160px); }
[dir="rtl"] .swipe-content.swiped { transform: translateX(160px); }
.swipe-actions {
  position: absolute; top: 0; bottom: 0;
  inset-inline-end: 0;
  display: flex; align-items: stretch;
  z-index: 1;
}
.swipe-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  width: 80px; padding: 0 8px;
  background: var(--elan-green); color: #fff;
  border: none; cursor: pointer; font-family: inherit;
  font-size: 0.78rem; font-weight: 700;
}
.swipe-action.delete { background: var(--elan-red); }
.swipe-action [data-lucide] { width: 20px; height: 20px; stroke-width: 2; }

/* ════════════════════════════════════════════════════
   PULL-TO-REFRESH indicator
   ════════════════════════════════════════════════════ */
.ptr-indicator {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-30px);
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--elan-border);
  border-radius: 9999px;
  padding: 10px 18px;
  font-size: 0.88rem; font-weight: 600; color: var(--elan-green);
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s, transform 0.25s;
  pointer-events: none;
}
.ptr-indicator.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ptr-indicator .spinner-mini {
  width: 14px; height: 14px;
  border: 2px solid var(--elan-green-light);
  border-top-color: var(--elan-green);
  border-radius: 50%;
  animation: ptr-spin 0.8s linear infinite;
}
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════
   ONBOARDING TOUR (first-time gesture intro)
   ════════════════════════════════════════════════════ */
.onb-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 800; display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.onb-overlay.open { display: flex; }
.onb-card {
  background: #fff; border-radius: 16px;
  max-width: 380px; width: 100%;
  padding: 32px 28px 24px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.onb-icon {
  width: 64px; height: 64px;
  background: rgba(45,166,150,0.12); color: var(--elan-green);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.onb-icon [data-lucide] { width: 32px; height: 32px; stroke-width: 1.6; }
.onb-card h3 { font-size: 1.25rem; color: var(--elan-green-dark); margin-bottom: 8px; }
.onb-card p { font-size: 0.95rem; color: var(--elan-text-light); line-height: 1.55; margin-bottom: 20px; }
.onb-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.onb-dot { width: 7px; height: 7px; border-radius: 50%; background: #d0d0d0; transition: background 0.2s; }
.onb-dot.active { background: var(--elan-green); }
.onb-btns { display: flex; gap: 8px; }
.onb-btns button {
  flex: 1; padding: 12px;
  border: none; border-radius: 10px;
  font-family: inherit; font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
}
.onb-btns .skip { background: #f0f0f0; color: var(--elan-text-light); }
.onb-btns .next { background: var(--elan-green); color: #fff; }
.onb-btns .next:hover { background: var(--elan-green-dark); }

/* ════════════════════════════════════════════════════
   MOBILE BOTTOM TAB BAR + MORE SHEET (Apple Health style)
   ════════════════════════════════════════════════════ */
.bottom-tabs {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--elan-border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.bottom-tabs ul {
  display: flex; list-style: none; justify-content: space-around;
  padding: 6px 4px; margin: 0;
}
.bottom-tabs li { flex: 1; }
.bottom-tabs a, .bottom-tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  width: 100%; padding: 8px 4px; min-height: 56px;
  background: none; border: none; cursor: pointer;
  color: var(--elan-text-muted); text-decoration: none;
  font-family: inherit; font-size: 0.7rem; font-weight: 600;
  transition: color 0.15s;
}
.bottom-tabs a [data-lucide], .bottom-tabs button [data-lucide] {
  width: 24px; height: 24px; stroke-width: 1.6;
}
.bottom-tabs a:hover, .bottom-tabs button:hover { color: var(--elan-text); }
.bottom-tabs a.active, .bottom-tabs button.active { color: var(--elan-green); font-weight: 700; }
.bottom-tabs a.active [data-lucide], .bottom-tabs button.active [data-lucide] { stroke-width: 2.2; }

.more-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
}
.more-sheet-overlay.open { display: block; }
.more-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  display: none;
}
.more-sheet.open { display: block; transform: translateY(0); }
.more-sheet-handle { width: 40px; height: 4px; background: #d0d0d0; border-radius: 9999px; margin: 0 auto 16px; }
.more-sheet h3 { font-size: 0.85rem; color: var(--elan-text-light); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 12px; padding: 0 4px; }
.more-sheet-list { list-style: none; padding: 0; margin: 0; }
.more-sheet-list li a, .more-sheet-list li button {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 12px; width: 100%; border: none;
  background: none; color: var(--elan-text); text-decoration: none;
  font-size: 1rem; font-family: inherit; cursor: pointer;
  border-radius: 10px; text-align: start;
}
.more-sheet-list li a:hover, .more-sheet-list li button:hover { background: rgba(45,166,150,0.06); }
.more-sheet-list .ico {
  width: 36px; height: 36px;
  background: rgba(45,166,150,0.1); color: var(--elan-green);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.more-sheet-list .ico [data-lucide] { width: 18px; height: 18px; stroke-width: 1.6; }
.more-sheet-list li + li { border-top: 1px solid #f5f5f5; }
.more-sheet-divider { height: 1px; background: var(--elan-border); margin: 8px 4px; }

/* Activate bottom tabs on mobile, hide desktop nav */
@media (max-width: 767px) {
  .bottom-tabs { display: block; }
  body { padding-bottom: 80px; } /* room for tab bar */
  .topbar nav { display: none !important; }
  .topbar-hamburger { display: none !important; }
}

@media (max-width: 768px) {
  /* Compact closed-state topbar — logo + hamburger only */
  .topbar { padding: 10px 14px; min-height: 0; }
  .topbar-hamburger { display: flex; }
  .topbar-logo { font-size: 1.1rem; }

  /* Open menu = floating overlay drawer, NOT push-down.
     - position: absolute below the topbar so it doesn't grow the topbar
     - max-height + overflow-auto so it never exceeds ~60vh
     - shadow + opaque bg so content beneath stays readable */
  .topbar nav {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    inset-inline-start: 0;
    background: #fff;
    border-bottom: 1px solid var(--elan-border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 99;
  }
  .topbar nav.open { display: block; }

  .topbar-nav {
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding: 4px 0;
  }
  .topbar-nav a, .topbar-nav .more-trigger {
    display: block;
    padding: 14px 18px;
    font-size: 1rem;
    border-bottom: 1px solid var(--elan-border-light);
    width: 100%;
    text-align: start;
    border-radius: 0;
  }
  .topbar-nav li:last-child a, .topbar-nav li:last-child .more-trigger { border-bottom: none; }

  /* Hide the rounded chevron in mobile — the dropdown items will be inline */
  .more-wrap.open .more-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(45,166,150,0.04);
    margin: 0;
    padding: 4px 8px;
    min-width: 0;
  }

  .nav-new-record { display: none; }

  .page-content { padding: 20px 12px; }
  .card { padding: 20px; }
  .btn-large { padding: 14px 24px; font-size: 1rem; }
}

@media (max-width: 480px) {
  .topbar-logo { font-size: 1.1rem; }
}

/* ─────────────────────────────────────────────────────────────
   Feature additions (2026-04-15): tooltip, save-pill, auth-steps,
   field-error, mode-toggle, shortcut-tip, canonical btn hierarchy.
   ───────────────────────────────────────────────────────────── */

/* Fix 1 — disabled-button tooltip wrapper */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-wrap::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 50%;
  transform: translateX(50%);
  background: #111827;
  color: #fff;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 1000;
  font-family: Heebo, sans-serif;
}
.tooltip-wrap:has(button:disabled):hover::after,
.tooltip-wrap.show-tip::after { opacity: 1; }

/* Fix 2 — autosave status pill */
.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9999px;
  font-family: Heebo, sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
  margin: 12px 0;
  border: 1px solid #e5e7eb;
  min-height: 32px;
  box-sizing: border-box;
}
.save-pill .save-pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.save-pill .save-pill-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #d1d5db;
  border-top-color: #207d73;
  border-radius: 50%;
  display: none;
  animation: save-pill-spin 0.8s linear infinite;
  flex-shrink: 0;
}
.save-pill .save-pill-check { display: none; width: 16px; height: 16px; flex-shrink: 0; }
@keyframes save-pill-spin { to { transform: rotate(360deg); } }
.save-pill[data-state="dirty"]  .save-pill-dot { background: #f59e0b; }
.save-pill[data-state="dirty"]  .save-pill-spinner,
.save-pill[data-state="dirty"]  .save-pill-check { display: none; }
.save-pill[data-state="saving"] .save-pill-dot { display: none; }
.save-pill[data-state="saving"] .save-pill-spinner { display: inline-block; }
.save-pill[data-state="saving"] .save-pill-check { display: none; }
.save-pill[data-state="saved"] { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.save-pill[data-state="saved"] .save-pill-dot { display: none; }
.save-pill[data-state="saved"] .save-pill-check { display: inline-block; color: #16a34a; }

/* Fix 3 — auth step indicator */
.auth-steps {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0;
  margin: 0 0 20px 0;
  counter-reset: step;
  gap: 0;
}
.auth-steps li {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: Heebo, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
}
.auth-steps li + li::before {
  content: '';
  position: absolute;
  top: 13px;
  inset-inline-end: 50%;
  inset-inline-start: calc(50% + 14px);
  height: 2px;
  background: #d1d5db;
  z-index: 0;
}
.auth-steps .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  position: relative;
  z-index: 1;
}
.auth-steps[data-active="1"] li[data-step="1"] .step-num,
.auth-steps[data-active="2"] li[data-step="2"] .step-num,
.auth-steps[data-active="3"] li[data-step="3"] .step-num {
  background: #207d73; border-color: #207d73; color: #fff;
}
.auth-steps[data-active="1"] li[data-step="1"],
.auth-steps[data-active="2"] li[data-step="2"],
.auth-steps[data-active="3"] li[data-step="3"] { color: #207d73; }
/* Completed steps: teal fill with check SVG replacing the number */
.auth-steps[data-active="2"] li[data-step="1"] .step-num,
.auth-steps[data-active="3"] li[data-step="1"] .step-num,
.auth-steps[data-active="3"] li[data-step="2"] .step-num {
  background: #207d73; border-color: #207d73; color: transparent;
}
.auth-steps[data-active="2"] li[data-step="1"] .step-num::after,
.auth-steps[data-active="3"] li[data-step="1"] .step-num::after,
.auth-steps[data-active="3"] li[data-step="2"] .step-num::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}
.auth-steps[data-active="2"] li[data-step="1"] + li::before,
.auth-steps[data-active="3"] li[data-step="1"] + li::before,
.auth-steps[data-active="3"] li[data-step="2"] + li::before { background: #207d73; }

/* Fix 4 — field error */
.field-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 6px;
  display: none;
  font-family: Heebo, sans-serif;
}
.field-error.visible { display: block; }

/* Fix 5 — secretary/doctor mode toggle link */
.mode-toggle {
  background: none;
  border: none;
  color: #207d73;
  font-size: 14px;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  display: block;
  margin: 8px auto;
  font-family: Heebo, sans-serif;
  text-decoration: underline;
}
.mode-toggle:hover { color: #2da696; }

/* Fix 6 — canonical button hierarchy for document action group */
.doc-action-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.doc-action-group .btn-primary,
.doc-action-group .btn-secondary,
.doc-action-group .btn-ghost {
  padding: 10px 22px;
  font-family: Heebo, sans-serif;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.doc-action-group .btn-primary {
  background: #207d73;
  color: #fff;
  border: 2px solid #207d73;
  font-weight: 700;
}
.doc-action-group .btn-primary:hover { background: #2da696; border-color: #2da696; }
.doc-action-group .btn-primary:disabled { background: #9ca3af; border-color: #9ca3af; cursor: not-allowed; }
.doc-action-group .btn-secondary {
  background: #fff;
  color: #207d73;
  border: 2px solid #207d73;
  font-weight: 600;
}
.doc-action-group .btn-secondary:hover:not(:disabled) { background: #f0faf8; }
.doc-action-group .btn-secondary:disabled { color: #9ca3af; border-color: #d1d5db; background: #f9fafb; cursor: not-allowed; }
.doc-action-group .btn-ghost {
  background: transparent;
  color: #207d73;
  border: 2px solid transparent;
  font-weight: 500;
  opacity: 0.85;
}
.doc-action-group .btn-ghost:hover { background: rgba(32,125,115,0.06); opacity: 1; }

/* Fix 7 — shortcut discovery tooltip */
.shortcut-tip {
  position: absolute;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-family: Heebo, sans-serif;
  padding: 10px 14px;
  border-radius: 8px;
  border-inline-end: 3px solid #207d73;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 9999;
  pointer-events: none;
  max-width: 260px;
  line-height: 1.4;
}
.shortcut-tip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  inset-inline-end: 24px;
  width: 0; height: 0;
  border-inline-start: 6px solid transparent;
  border-inline-end: 6px solid transparent;
  border-top: 6px solid #111827;
}

/* ════════════════════════════════════════════════════
   DESIGN SYSTEM — Google Material 3 (mc-*)
   ════════════════════════════════════════════════════ */

/* ── Card (Material 3: filled card, elevation 1) ── */
.mc-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  padding: 16px;
}

/* ── Input (Material 3: outlined text field) ── */
.mc-input {
  width: 100%; height: 48px; border: 1px solid #dadce0; border-radius: 8px;
  padding: 0 14px; font-size: 14px; font-family: inherit;
  background: #fff; color: #1f1f1f;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mc-input:focus { outline: none; border-color: #207d73; box-shadow: 0 0 0 2px rgba(32,125,115,0.2); }
.mc-input::placeholder { color: #5f6368; }
.mc-input.error { border-color: #d93025; }

/* ── Buttons (Material 3: filled, outlined, text) ── */
.mc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px; border-radius: 20px;
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none; letter-spacing: 0.01em;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  text-decoration: none;
}
.mc-btn:active { transform: scale(0.97); }
.mc-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.mc-btn-primary { background: #207d73; color: #fff; }
.mc-btn-primary:hover:not(:disabled) { background: #1a6860; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.mc-btn-ghost, .mc-btn-outline { background: transparent; color: #207d73; border: 1px solid #dadce0; }
.mc-btn-ghost:hover:not(:disabled), .mc-btn-outline:hover:not(:disabled) { background: #eaf7f3; }
.mc-btn-danger { background: transparent; color: #d93025; border: 1px solid #dadce0; }
.mc-btn-danger:hover:not(:disabled) { background: #fce8e6; }
.mc-btn-sm { height: 32px; padding: 0 16px; font-size: 12px; }
.mc-btn-lg { height: 48px; padding: 0 28px; font-size: 14px; border-radius: 24px; }
.mc-btn-full { width: 100%; }

/* ── Badge / Chip (Material 3: assist chip) ── */
.mc-badge {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 8px; font-size: 12px; font-weight: 500;
}
.mc-badge-teal { background: #e6f4ea; color: #207d73; }
.mc-badge-amber { background: #fef7e0; color: #7c4a03; }
.mc-badge-red { background: #fce8e6; color: #c5221f; }
.mc-badge-green { background: #e6f4ea; color: #137333; }
.mc-badge-grey { background: #f1f3f4; color: #5f6368; }

/* ── Labels / muted (Material 3: label-medium) ── */
.mc-label { font-size: 12px; font-weight: 500; color: #5f6368; letter-spacing: 0.02em; }
.mc-nav-item { font-size: 14px; font-weight: 500; }

/* ── Section headers (Material 3: title-small) ── */
.mc-section-title {
  font-size: 11px; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase; color: #5f6368; margin-bottom: 8px;
}

/* ══════════════════════════════════════════════════════
   CANONICAL LOGO — check mark bursts out the top-right
   of the ring (custom SVG, not Lucide's check-circle).
   Rendered via ::before so no HTML edits are needed;
   any inherited <i data-lucide> or inline <svg> inside a
   logo element is hidden.
   ══════════════════════════════════════════════════════ */
.mc-logo,
.topbar-logo,
.nav-logo,
a.logo,
.logo-text {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
  text-decoration: none !important;
  font-weight: 800 !important;
  font-size: 1.68rem !important;   /* +20% over prior 1.4rem */
  color: #111827 !important;        /* black wordmark */
  font-family: var(--mc-font, 'Heebo', sans-serif) !important;
  line-height: 1.2;
  letter-spacing: 0;
}
.mc-logo::before,
.topbar-logo::before,
.nav-logo::before,
a.logo::before,
.logo-text::before {
  content: '';
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  margin-inline-end: 8px;
  vertical-align: middle;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16.5 4.21 A 9 9 0 1 0 19.79 7.5'/%3E%3Cpath d='M7 12 L 10 15 L 20 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex-shrink: 0;
}
/* Suppress any inherited icon inside a logo element — the ::before replaces it */
.mc-logo [data-lucide],
.topbar-logo [data-lucide],
.nav-logo [data-lucide],
a.logo [data-lucide],
.logo-text [data-lucide],
.mc-logo > svg,
.topbar-logo > svg,
.nav-logo > svg,
a.logo > svg,
.logo-text > svg,
.mc-logo h1 [data-lucide],
.mc-logo h1 > svg { display: none !important; }
/* Sub-classes continue to work when present */
.mc-logo .mc-logo-text { font-size: inherit; font-weight: inherit; color: inherit; }
.mc-logo .mc-logo-sub { font-size: 0.65em; font-weight: 400; color: var(--mc-text-secondary, #5f6368); margin-inline-start: 4px; }

/* ── Force every check-circle icon + every visual logo wrapper to black,
      overriding the inline teal color="…--elan-green…" styles left over
      on login/signup/legal/payment nav anchors and card-header h1s. ── */
[data-lucide="check-circle"] { color: #111827 !important; }
.login-logo, .login-logo *, .login-logo h1,
.signup-logo, .signup-logo *, .signup-logo h1,
a[href="landing.html"], a[href="landing.html"] *,
a[href="index.html"].topbar-logo, a[href="index.html"].topbar-logo *,
.topbar-logo, .topbar-logo * {
  color: #111827 !important;
}

/* ── Toast (Material 3: snackbar) ── */
.mc-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #323232; color: #fff; padding: 10px 20px;
  border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.15s, transform 0.15s; z-index: 9999;
  box-shadow: 0 3px 5px rgba(0,0,0,0.2);
}
.mc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ── Shimmer (loading skeleton) ── */
.mc-shimmer {
  height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, #f1f3f4 25%, #e8eaed 50%, #f1f3f4 75%);
  background-size: 200% 100%; animation: mc-shimmer 1.4s infinite;
  margin-bottom: 8px;
}
.mc-shimmer:nth-child(2) { width: 75%; }
.mc-shimmer:nth-child(3) { width: 50%; }
@keyframes mc-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Empty state ── */
.mc-empty { text-align: center; padding: 24px 16px; color: #5f6368; font-size: 14px; }

/* ── Error state ── */
.mc-error { color: #d93025; font-size: 12px; margin-top: 4px; }

/* ── Micro-interactions (Material motion) ── */
@keyframes mc-error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.mc-shake { animation: mc-error-shake 0.3s ease; }
/* ══════════════════════════════════════════════════════════════════════════
   ltr-overrides.css — English-mode direction overrides
   2026-04-24
   ──────────────────────────────────────────────────────────────────────────
   i18n.js flips document.documentElement.dir between "rtl" (Hebrew) and
   "ltr" (English) on every language change. Most per-page and per-component
   CSS in the dashboard was authored with Hebrew RTL baked in via
   `text-align: right`, `direction: rtl`, `margin-right`, `padding-right`,
   `border-right`, and `right: 0` positioning. These rules are physical, not
   logical — they do NOT flip when the container's dir changes.

   Rather than touch dozens of files, this sheet catches the high-traffic
   patterns when `[dir="ltr"]` is in effect and flips them back to the
   natural English reading order. Shared CSS (shared.css, shared-app.css,
   auth-card.css, ui/elan-ui.css) has already been converted to logical
   properties in-place for the rules that are easy to flip. This file
   covers everything else.

   Load order: after shared.css, shared-app.css, elan-ui.css, auth-card.css
   so `[dir="ltr"]` selectors win the cascade. Page-specific inline styles
   that still use physical properties should progressively migrate, but
   this file keeps the app functional in English today.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Text alignment: flip "text-align: right" to left in LTR ─────────── */
[dir="ltr"] body,
[dir="ltr"] label,
[dir="ltr"] .form-group,
[dir="ltr"] .input-field,
[dir="ltr"] input,
[dir="ltr"] select,
[dir="ltr"] textarea,
[dir="ltr"] .mc-input,
[dir="ltr"] .cmdk-input,
[dir="ltr"] .table th,
[dir="ltr"] .table td {
  text-align: left;
}

/* The auth-card text inputs are LTR-by-content even in Hebrew (email/password).
   In English we want them left-aligned at the line start. */
[dir="ltr"] .auth-card .text-input {
  direction: ltr;
  text-align: left;
}

/* ── Non-latin-content inputs should left-align in LTR, right in RTL ─── */
[dir="ltr"] input[type="text"],
[dir="ltr"] input[type="search"],
[dir="ltr"] textarea {
  direction: ltr;
  text-align: left;
}

/* ── Background image positioning on select chevrons ─────────────────── */
[dir="ltr"] select.input-field {
  background-position: right 14px center;
  padding-inline-end: 36px;
}

/* ── Legacy hardcoded "right: N" / "left: N" positions ───────────────── */
/* Most absolute-positioned UI pieces hardcode right:0 to mean "pin to the
   Hebrew end (visual-right)". In LTR they should pin to the visual-left.
   Page-specific inline styles that use `right: N` need individual fixes;
   these rules catch the common shared components. */
[dir="ltr"] .modal-close {
  inset-inline-start: auto;
  inset-inline-end: 12px;
  left: auto;
  right: 12px;
}

/* ── Swipe-action panels on list rows ────────────────────────────────── */
[dir="ltr"] .swipe-content.swiped {
  transform: translateX(-160px);
}

/* ── Shortcut-tip arrow + accent ─────────────────────────────────────── */
[dir="ltr"] .shortcut-tip {
  border-inline-start: 3px solid #207d73;
  border-inline-end: none;
}
[dir="ltr"] .shortcut-tip::after {
  inset-inline-start: 24px;
  inset-inline-end: auto;
}

/* ── Preview column in collapsible-field pattern ─────────────────────── */
[dir="ltr"] .cf-preview {
  margin-inline-start: 8px;
  margin-inline-end: auto;
}

/* ── Chevron rotation in closed state matches reading direction ──────── */
[dir="ltr"] .cf-closed .cf-chevron {
  transform: rotate(-90deg);
}
[dir="rtl"] .cf-closed .cf-chevron {
  transform: rotate(90deg);
}

/* ── Action-sheet destructive button block ───────────────────────────── */
[dir="ltr"] .action-sheet-btn,
[dir="ltr"] .onb-card,
[dir="ltr"] .mc-empty,
[dir="ltr"] .mc-error {
  /* These center-align naturally — keep them centered in both directions.
     No change needed; this rule intentionally matches nothing new — it
     documents that these components are dir-neutral. */
}

/* ══════════════════════════════════════════════════════════════════════════
   Page-specific hotspots — inline-styled HTML pages
   ──────────────────────────────────────────────────────────────────────────
   The pages below hardcode `text-align: right`, `margin-right`, or
   `padding-right` inside their own <style> blocks. Rather than mutate 60+
   HTML files we flip the worst offenders here. If the rule's original
   intent was "pin to the reading end", the logical-equivalent in LTR is
   "pin to the reading end of English", i.e., left.
   ══════════════════════════════════════════════════════════════════════════ */

/* Generic: any element whose ONLY direction rule is text-align:right should
   flip when dir=ltr. The attribute selector matches inline styles. */
[dir="ltr"] [style*="text-align: right"],
[dir="ltr"] [style*="text-align:right"] {
  text-align: left !important;
}

[dir="ltr"] [style*="direction: rtl"],
[dir="ltr"] [style*="direction:rtl"] {
  direction: ltr !important;
}

/* ── Table columns: keep numerical columns right-aligned in both langs
      (because numbers are LTR glyphs — right-align makes visual sense
      for column alignment regardless of UI language). Opt-in via class. */
[dir="ltr"] td.num,
[dir="ltr"] th.num,
[dir="ltr"] td.amount,
[dir="ltr"] th.amount,
[dir="ltr"] .tabular-num,
[dir="ltr"] .mc-amount {
  text-align: right;
}

/* ══════════════════════════════════════════════════════════════════════════
   Chrome components — mc-chrome.js injected DOM
   ──────────────────────────────────────────────────────────────────────────
   The chrome reads `document.documentElement.dir` at mount time and flips
   the triad + slot positions correspondingly via flex ordering. Sub-header
   chips read direction-neutral. No extra overrides needed here — the
   components use flex + margin-inline-* throughout.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Safety: ensure the hamburger close X + settings tester-chip position
      flip with direction. Uses logical insets so both dirs resolve. */
[dir="ltr"] .sheet-close-btn,
[dir="ltr"] .menu-sheet-close {
  inset-inline-start: auto;
  inset-inline-end: 16px;
  left: auto;
  right: 16px;
}
