/* =====================================================================
   ConceptApp — Warm paper · mobile-first iOS design system
   Single typeface: Heebo for everything (headings + UI). Noto Sans
   siblings cover Arabic / Cyrillic / Devanagari for translated UIs.
   1px borders, almost no shadows. Accent is the business brand color.
   Token names match the Design Kit (ערכת עיצוב).
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&display=swap');

/* ---------- TOKENS ---------- */
:root {
  /* Surfaces · warm paper */
  --bg:           #faf9f5;
  --surface:      #fdfcf8;
  --surface-2:    #f3f1e9;
  --surface-3:    #ece9df;
  --border:       #e8e6dc;
  --border-strong:#d4d1c4;

  /* Text */
  --text-1: #141413;
  --text-2: #4a4d55;
  --text-3: #6e7077;
  --text-4: #9a978d;   /* kickers, labels, timestamps */

  /* Accent — brand color per business, overridable. Held sparingly:
     active tab, one primary CTA per screen, focus, underline. */
  --accent:       #9000ff;
  --accent-soft:  color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-bg:    color-mix(in srgb, var(--accent) 5%, var(--surface));
  --accent-border:color-mix(in srgb, var(--accent) 35%, var(--border));
  --accent-text:  color-mix(in srgb, var(--accent) 80%, var(--text-1));
  --on-accent:    #FFFFFF;

  /* Semantic */
  --danger: #C4341A;
  --warn:   #B57814;
  --success:#1F7A4D;
  --danger-soft: color-mix(in srgb, var(--danger) 10%, transparent);
  --warn-soft:   color-mix(in srgb, var(--warn) 14%, transparent);
  --success-soft:color-mix(in srgb, var(--success) 12%, transparent);

  /* Fonts */
  /* One family app-wide. --font-serif kept as an alias so existing
     heading rules resolve to the same Heebo stack (no per-rule edits). */
  --font-sans:  'Heebo', 'Noto Sans', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-serif: var(--font-sans);

  /* Type scale */
  --fs-1: 31px;  /* page title · serif */
  --fs-2: 24px;  /* section title · serif */
  --fs-3: 18px;  /* card title */
  --fs-4: 15px;  /* body */
  --fs-5: 13px;  /* small */
  --fs-6: 11px;  /* micro / labels */

  /* Spacing · 4px base */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;   /* sheets */

  /* Shadow — almost none. Border defines the card. */
  --shadow-1: 0 1px 2px rgba(20,20,19,0.04);
  --shadow-2: 0 2px 6px rgba(20,20,19,0.06), 0 12px 32px rgba(20,20,19,0.06);
  --shadow-sheet: 0 -12px 44px rgba(20,20,19,0.20);
  --shadow-fab: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent);

  /* Motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --t-fast: 150ms;
  --t-base: 200ms;

  /* iOS safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Bottom navigation height (content padding helper) */
  --bnav-h: calc(64px + var(--safe-bottom));
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--fs-4);
  line-height: 1.55;
  direction: rtl;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: color-mix(in srgb, var(--accent) 20%, transparent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
input::placeholder, textarea::placeholder { color: var(--text-4); }

/* ---------- TYPOGRAPHY ---------- */
.h1, .h2 { font-family: var(--font-serif); font-weight: 500; }
.h1 { font-size: var(--fs-1); letter-spacing: -0.01em; line-height: 1.1; }
.h2 { font-size: var(--fs-2); letter-spacing: -0.01em; line-height: 1.2; }
.h3 { font-size: var(--fs-3); font-weight: 600; letter-spacing: -0.2px; line-height: 1.3; }
.serif { font-family: var(--font-serif); font-weight: 500; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.label { font-size: var(--fs-6); font-weight: 600; color: var(--text-4); letter-spacing: 0.06em; }
.small { font-size: var(--fs-5); }
.kicker { font-size: 12.5px; color: var(--text-4); font-weight: 500; }

/* Accent underline — on a name or one word, instead of colored text */
.u-accent {
  text-decoration: underline;
  text-decoration-thickness: 0.085em;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--accent);
}

/* Section head: serif title + hairline */
.section-head {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.section-head .title { font-family: var(--font-serif); font-weight: 500; font-size: 17px; color: var(--text-1); }
.section-head .rule { flex: 1; height: 1px; background: var(--border); }
.section-head .icon { font-size: 15px; line-height: 1; }

/* =====================================================================
   MOBILE iOS SHELL
   ===================================================================== */

/* Phone column — the app is phone-only; on wide screens it stays a
   centered column so it always reads as the mobile product. */
.phone-col { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* Top app bar */
.appbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + 8px) var(--s-4) 11px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar-brand .mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--text-1); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 18px; font-weight: 700;
}
.appbar-brand .titles { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.appbar-brand .name { font-size: 14px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-chip {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; padding: 0;
  font-size: 12px; color: var(--text-3); font-family: inherit; cursor: pointer;
}
.branch-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.branch-chip .bname {
  text-decoration: underline; text-decoration-thickness: 0.08em;
  text-underline-offset: 0.14em; text-decoration-color: var(--border-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}
.branch-chip .caret { font-size: 9px; color: var(--text-4); }
.appbar-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); background: transparent;
  transition: background var(--t-fast) var(--ease);
}
.icon-btn:hover, .icon-btn:active { background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; flex: none;
  border: none; cursor: pointer;
}

/* Scrollable content area */
.scroll-body {
  flex: 1;
  padding: 18px var(--s-4) calc(var(--bnav-h) + var(--s-5));
}

/* Bottom navigation + FAB */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
  display: flex; align-items: flex-start; justify-content: space-around;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 9px 8px calc(10px + var(--safe-bottom));
}
.bottom-nav .inner { display: flex; align-items: flex-start; justify-content: space-around; width: 100%; max-width: 480px; margin: 0 auto; }
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  padding: 2px 6px; width: 60px; min-height: 44px;
  color: var(--text-4);
  transition: opacity var(--t-fast) var(--ease);
  text-decoration: none;
}
.bnav-item:hover { opacity: 0.75; text-decoration: none; }
.bnav-item .bnav-label { font-size: 10.5px; font-weight: 500; color: inherit; white-space: nowrap; }
.bnav-item svg { stroke: currentColor; }
.bnav-item.active { color: var(--accent); }
.bnav-item.active .bnav-label { font-weight: 600; }

.fab {
  width: 52px; height: 52px; margin-top: -16px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
  border: none; cursor: pointer;
  transition: filter var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(0.95); }

/* =====================================================================
   BOTTOM SHEET (replaces centered modal on mobile)
   .modal-overlay/.modal-shell keep their names so modules keep working.
   ===================================================================== */
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(20,22,28,0.42);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; animation: scrimIn var(--t-base) ease both; }
.modal-shell {
  width: 100%; max-width: 480px;
  background: var(--bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px var(--s-5) calc(var(--s-6) + var(--safe-bottom));
  max-height: 88dvh; overflow-y: auto;
  box-shadow: var(--shadow-sheet);
  animation: sheetUp 280ms var(--ease) both;
}
.modal-shell::before {
  content: ''; display: block;
  width: 40px; height: 4px; border-radius: 99px;
  background: var(--border-strong);
  margin: 0 auto 16px;
}
.modal-shell h2, .modal-shell h3 {
  font-family: var(--font-serif); font-weight: 500;
  font-size: 23px; margin-bottom: var(--s-4);
}
.modal-actions { display: flex; gap: var(--s-2); margin-top: var(--s-5); }
.modal-actions .btn-primary { flex: 1; }

/* Sheet list rows (branch picker, module list, account) */
.sheet-row {
  width: 100%; text-align: start;
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 13px 14px; margin-bottom: var(--s-2);
  cursor: pointer; min-height: 44px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  color: var(--text-1); text-decoration: none;
}
.sheet-row:hover { background: var(--surface-2); text-decoration: none; }
.sheet-row.selected { background: var(--accent-soft); border-color: var(--accent-border); }
.sheet-row .emoji {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--surface-2); display: grid; place-items: center; font-size: 16px;
}
.sheet-row .body { flex: 1; min-width: 0; }
.sheet-row .name { font-size: 14.5px; font-weight: 600; color: var(--text-1); }
.sheet-row .meta { font-size: 12px; color: var(--text-4); }
.sheet-row .check { color: var(--accent); font-size: 16px; flex: none; }

/* ---------- LEGACY DESKTOP LAYOUT (admin pages) → mobile column ---------- */
.app { display: flex; flex-direction: column; min-height: 100dvh; max-width: 560px; margin: 0 auto; }
.sidebar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + var(--s-3)) var(--s-4) var(--s-3);
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
  gap: var(--s-3);
  position: sticky; top: 0; z-index: 60;
}
.sidebar-brand {
  display: flex; align-items: center; gap: var(--s-2);
  font-weight: 600; font-size: var(--fs-4); color: var(--text-1);
}
.sidebar-brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--text-1); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 700;
}
.sidebar-section { display: flex; flex-direction: row; align-items: center; gap: var(--s-1); flex-wrap: wrap; }
.sidebar-section .label { display: none; }
.sidebar-section:last-child { margin-inline-start: auto; }
.nav-item {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 8px 12px; min-height: 40px;
  border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: var(--fs-5);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text-1); text-decoration: none; }
.nav-item.active { background: transparent; color: var(--accent-text); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 0.085em;
  text-underline-offset: 0.18em; text-decoration-color: var(--accent); }
.nav-item.active:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }

.main { padding: 18px var(--s-4) var(--s-8); width: 100%; }
.page-head {
  display: flex; flex-direction: column; align-items: stretch;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.page-head h1 { font-family: var(--font-serif); font-weight: 500; font-size: var(--fs-1); letter-spacing: -0.01em; line-height: 1.1; }
.page-head .sub { font-size: var(--fs-5); color: var(--text-3); margin-top: var(--s-1); }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- CARDS ---------- */
.row {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: var(--s-4);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); gap: var(--s-3); }
.card-title { font-size: var(--fs-3); font-weight: 600; }
.card-sub { font-size: var(--fs-5); color: var(--text-3); margin-top: var(--s-1); }
.card-featured {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 13px;
  padding: var(--s-4);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 11px 17px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text-1); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-3); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn-danger { background: var(--surface); border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 7px var(--s-3); min-height: 36px; font-size: var(--fs-5); }
.btn-lg { padding: 14px var(--s-5); min-height: 50px; font-size: 15px; border-radius: 11px; }

/* ---------- INPUTS ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field label { font-size: var(--fs-5); font-weight: 500; color: var(--text-2); }
.field .hint { font-size: var(--fs-5); color: var(--text-4); }
.input, .select, .textarea {
  width: 100%;
  padding: 12px 13px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-1);
  font-size: 14.5px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  outline: none;
  direction: rtl;
  min-height: 44px;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239a978d' d='M6 8L0 0h12z'/></svg>"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-start: var(--s-6); }
.textarea { min-height: 96px; resize: vertical; }

/* ---------- BADGES & CHIPS ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}
.badge-accent  { background: var(--accent-soft);  color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn    { background: var(--warn-soft);    color: var(--warn); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Horizontal chips strip (quick access) */
.chips-row {
  display: flex; gap: 9px; overflow-x: auto;
  padding-bottom: var(--s-1);
  margin-inline: calc(-1 * var(--s-4));
  padding-inline: var(--s-4);
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { height: 0; }
.chip {
  flex: none; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 9px 13px; min-height: 44px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--border-strong); background: var(--accent-bg); }
.chip .c-icon { font-size: 16px; line-height: 1; }
.chip .c-name { font-size: 13px; font-weight: 500; color: var(--text-1); white-space: nowrap; }

/* ---------- LIST / ROW PATTERNS ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--surface-2);
  transition: background var(--t-fast) var(--ease);
  min-height: 56px;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface-2); }
.list-item .avatar {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--surface-2); color: var(--accent-text);
  display: grid; place-items: center;
  font-weight: 600;
  flex-shrink: 0;
}
.list-item .body { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; font-size: var(--fs-4); }
.list-item .meta { font-size: var(--fs-5); color: var(--text-4); margin-top: 2px; }

/* ---------- TABLE (horizontal scroll on phone) ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table th {
  text-align: start;
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-6);
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: 0.05em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }

/* ---------- TOOLBAR ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.toolbar .input { flex: 1; min-width: 160px; max-width: none; }
.toolbar .spacer { flex: 0; }

/* ---------- WIZARD STEPS ---------- */
.steps { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-5); flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-6);
  color: var(--text-4);
  font-weight: 600;
}
.step.active { color: var(--accent-text); }
.step.done { color: var(--success); }
.step .num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  display: grid; place-items: center;
  font-size: var(--fs-6);
  font-weight: 700;
}
.step.active .num { background: var(--accent); color: var(--on-accent); }
.step.done .num { background: var(--success); color: #fff; }
.step-divider { flex: 1; height: 1px; background: var(--border); min-width: 12px; }

/* ---------- MODULE GRID / TILES ---------- */
.modules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.module-tile {
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  text-align: start;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.module-tile:hover { border-color: var(--border-strong); background: var(--accent-bg); }
.module-tile:active { transform: scale(0.975); }
.module-tile.on { border-color: var(--accent-border); background: var(--accent-bg); }
.module-tile-head { display: flex; align-items: center; justify-content: space-between; }
.module-tile-name { font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.module-tile-desc { font-size: 11.5px; color: var(--text-4); line-height: 1.35; }
.module-tile-icon { font-size: 21px; line-height: 1; background: none; width: auto; height: auto; }
.module-tile.on .module-tile-icon { background: none; }

.toggle {
  width: 46px; height: 27px;
  background: var(--border-strong);
  border-radius: 999px;
  position: relative;
  transition: background var(--t-base) var(--ease);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; right: 3px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--t-base) var(--ease);
}
.module-tile.on .toggle { background: var(--accent); }
.module-tile.on .toggle::after { transform: translateX(-19px); }

/* ---------- COLOR SWATCHES ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.swatch {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.swatch.selected { border-color: var(--text-1); }
.swatch:hover { transform: scale(1.06); }

/* ---------- EMPTY STATE ---------- */
.empty { text-align: center; padding: var(--s-6) var(--s-4); color: var(--text-4); }
.empty .icon { font-size: 34px; margin-bottom: var(--s-3); }
.empty h3 { font-size: var(--fs-4); font-weight: 600; color: var(--text-2); margin-bottom: var(--s-1); }
.empty p { color: var(--text-4); font-size: var(--fs-5); margin-bottom: var(--s-4); max-width: 320px; margin-inline: auto; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; bottom: calc(var(--bnav-h) + var(--s-3)); left: 50%; transform: translateX(-50%);
  background: var(--text-1); color: var(--bg);
  padding: 10px 16px;
  border-radius: 9px;
  font-size: var(--fs-5);
  box-shadow: var(--shadow-2);
  display: none; z-index: 300;
  max-width: calc(100% - 32px);
}
.toast.show { display: block; animation: fadeIn var(--t-base) var(--ease); }

/* ---------- UTILITIES ---------- */
.stack-1 > * + * { margin-top: var(--s-1); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-5 > * + * { margin-top: var(--s-5); }
.stack-6 > * + * { margin-top: var(--s-6); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.flex-center  { display: flex; align-items: center; gap: var(--s-3); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.muted { color: var(--text-3); }
.hidden { display: none !important; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================================
   DARK THEME — warm dark, accent unchanged.
   ===================================================================== */
[data-theme="dark"] {
  --bg:           #161512;
  --surface:      #1d1c18;
  --surface-2:    #26241f;
  --surface-3:    #302d27;
  --border:       #2e2c26;
  --border-strong:#454238;
  --text-1: #f2f0ea;
  --text-2: #c2bfb6;
  --text-3: #94918a;
  --text-4: #7a776f;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-2: 0 2px 6px rgba(0,0,0,0.4), 0 12px 32px rgba(0,0,0,0.35);
}
[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .textarea { background: var(--surface); }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .toast { background: var(--surface-3); color: var(--text-1); border: 1px solid var(--border-strong); }
[data-theme="dark"] .toggle::after { background: var(--text-1); }

/* Theme toggle pill */
.theme-toggle {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 8px 12px; min-height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--fs-5);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text-1); }
.theme-toggle .icon { font-size: 14px; }

/* =====================================================================
   SKELETONS
   ===================================================================== */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: var(--r-sm);
  display: block;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sk-row { height: 14px; margin-bottom: var(--s-2); }
.sk-row:last-child { margin-bottom: 0; }
.sk-card { padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: var(--s-3); }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; background: var(--surface-2); } }

/* =====================================================================
   SCHEDULE MATRIX (modules/schedule.js) — scrolls horizontally on phone
   ===================================================================== */
.schedule-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center;
  margin-bottom: var(--s-3);
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.schedule-toolbar .input { max-width: none; flex: 1; min-width: 130px; padding: 8px var(--s-3); min-height: 40px; }
.schedule-toolbar .spacer { flex: 1; }
.schedule-toolbar .nav-week { display: flex; gap: 2px; align-items: center; }
.schedule-legend {
  display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center;
  margin-bottom: var(--s-3);
  font-size: var(--fs-5); color: var(--text-4);
}
.schedule-legend .code { display: inline-flex; align-items: center; gap: 6px; }
.schedule-legend .code-pill { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; color: var(--text-2); font-size: var(--fs-6); }

.matrix-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: var(--fs-5); min-width: 560px; }
.matrix-table th, .matrix-table td { padding: var(--s-3) var(--s-2); text-align: center; border-bottom: 1px solid var(--surface-2); border-inline-start: 1px solid var(--surface-2); vertical-align: middle; }
.matrix-table th:first-child, .matrix-table td:first-child { border-inline-start: none; }
.matrix-table thead th { background: var(--surface-2); color: var(--text-4); font-size: var(--fs-6); font-weight: 600; letter-spacing: 0.05em; padding: var(--s-3); }
.matrix-table thead th.today { background: var(--accent-soft); color: var(--accent-text); }
.matrix-table tbody tr:hover { background: var(--surface-2); }
.matrix-table tbody tr:last-child td { border-bottom: none; }
.matrix-name { text-align: start !important; font-weight: 600; padding: var(--s-3) var(--s-4) !important; min-width: 120px; position: sticky; inset-inline-start: 0; background: var(--surface); }
.matrix-name .role { font-size: var(--fs-6); color: var(--text-4); font-weight: 400; margin-top: 2px; }
.matrix-cell { cursor: pointer; min-width: 64px; transition: background var(--t-fast) var(--ease); position: relative; }
.matrix-cell:hover { background: var(--accent-soft); }
.matrix-cell.holiday { background: var(--warn-soft); color: var(--warn); }
.matrix-cell.shop-closed { background: var(--surface-2); color: var(--text-4); cursor: not-allowed; }
.matrix-cell.shop-closed:hover { background: var(--surface-2); }
.matrix-cell.has-shift { background: var(--accent-bg); }
.matrix-cell .hrs { font-weight: 600; color: var(--text-1); font-size: var(--fs-5); direction: ltr; display: inline-block; }
.matrix-cell .role-tag { font-size: 10px; color: var(--text-4); margin-top: 2px; }
.matrix-cell .code { font-weight: 700; color: var(--accent-text); font-size: var(--fs-4); padding: 2px 6px; background: var(--accent-soft); border-radius: 4px; display: inline-block; }
.matrix-cell.empty-day { color: var(--text-4); font-size: 16px; }
.matrix-row.unsubmitted { box-shadow: inset 3px 0 0 var(--danger); }
.matrix-row.unsubmitted .matrix-name::after {
  content: ' לא הוגש'; color: var(--danger); font-size: var(--fs-6); font-weight: 600; margin-inline-start: 4px;
}

/* =====================================================================
   HELP OVERLAY
   ===================================================================== */
.help-overlay { position: fixed; inset: 0; background: rgba(20,22,28,0.42); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 400; display: none; align-items: flex-end; justify-content: center; }
.help-overlay.show { display: flex; animation: scrimIn var(--t-base) ease; }
.help-shell { background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--s-5); padding-bottom: calc(var(--s-6) + var(--safe-bottom)); width: 100%; max-width: 480px; max-height: 80dvh; overflow-y: auto; box-shadow: var(--shadow-sheet); animation: sheetUp 280ms var(--ease) both; }
.help-shell h3 { font-family: var(--font-serif); font-weight: 500; font-size: 23px; margin-bottom: var(--s-4); }
.help-shell .row { display: flex; justify-content: space-between; align-items: center; padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.help-shell .row:last-child { border-bottom: none; }
.help-shell kbd { background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; padding: 2px 8px; border-radius: var(--r-sm); font-family: monospace; font-size: var(--fs-5); }

/* Kanban — stacked columns on phone */
.kanban { display: flex; flex-direction: column; gap: var(--s-3); }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: var(--s-3); }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-2); padding: 0 2px; }
.kanban-col-name { font-weight: 600; font-size: var(--fs-5); color: var(--text-2); }
.kanban-col-count { font-size: var(--fs-6); color: var(--text-4); background: var(--surface); border: 1px solid var(--border); padding: 1px 8px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: var(--s-3); margin-bottom: var(--s-2); transition: opacity var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.kanban-card:last-child { margin-bottom: 0; }
.kanban-card-title { font-weight: 600; font-size: 14px; }
.kanban-card-meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-4); margin-top: 4px; flex-wrap: wrap; }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }
.kanban-col.drop-target { background: var(--accent-soft); border-color: var(--accent); transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }

/* Global search palette */
.palette-overlay { position: fixed; inset: 0; background: rgba(20,22,28,0.42); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 500; display: none; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.palette-overlay.open { display: flex; animation: viewIn var(--t-base) var(--ease); }
.palette-shell { background: var(--bg); border-radius: var(--r-lg); width: 92%; max-width: 480px; max-height: 70dvh; display: flex; flex-direction: column; border: 1px solid var(--border); box-shadow: var(--shadow-2); overflow: hidden; }
.palette-input-wrap { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.palette-input-wrap .palette-icon { font-size: 18px; }
.palette-input { flex: 1; border: none; background: transparent; outline: none; font-size: var(--fs-3); color: var(--text-1); padding: 4px 0; }
.palette-input::placeholder { color: var(--text-4); }
.palette-input-wrap kbd { background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--fs-6); color: var(--text-4); }
.palette-results { flex: 1; overflow-y: auto; padding: var(--s-2); min-height: 80px; }
.palette-empty { padding: var(--s-6) var(--s-5); text-align: center; color: var(--text-4); font-size: var(--fs-5); }
.palette-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-sm); cursor: pointer; transition: background var(--t-fast) var(--ease); min-height: 44px; }
.palette-row.active, .palette-row:hover { background: var(--accent-soft); }
.palette-row-icon { font-size: 18px; width: 28px; text-align: center; }
.palette-row-body { flex: 1; min-width: 0; }
.palette-row-title { font-weight: 600; font-size: var(--fs-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-row-sub { font-size: var(--fs-5); color: var(--text-4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-row-tag { font-size: var(--fs-6); color: var(--text-4); background: var(--surface-2); padding: 2px 8px; border-radius: var(--r-sm); }
.palette-foot { display: flex; gap: var(--s-3); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--border); font-size: var(--fs-6); color: var(--text-4); background: var(--surface-2); }
.palette-foot kbd { background: var(--surface); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; font-family: inherit; font-size: 11px; }

/* Lists module */
.lists-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.list-card-head { display: flex; align-items: center; gap: var(--s-2); }
.list-pin { background: transparent; padding: 4px 8px; border-radius: var(--r-sm); font-size: var(--fs-3); cursor: pointer; }
.list-pin:hover { background: var(--surface-2); }
.list-title { flex: 1; font-weight: 600; font-size: var(--fs-3); cursor: pointer; }
.list-title:hover { color: var(--accent-text); }
.list-progress { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.list-progress-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width var(--t-base) var(--ease); }
.list-progress-text { font-size: var(--fs-6); color: var(--text-4); font-variant-numeric: tabular-nums; }
.list-items { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow-y: auto; }
.list-item-row { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--surface-2); min-height: 40px; }
.list-item-row:last-child { border-bottom: none; }
.list-item-row input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; cursor: pointer; accent-color: var(--accent); }
.list-item-text { flex: 1; font-size: var(--fs-5); word-break: break-word; }
.list-item-row.done .list-item-text { text-decoration: line-through; color: var(--text-4); }

/* Analytics module */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: var(--s-4); display: flex; gap: var(--s-3); align-items: flex-start; }
.kpi-icon { font-size: 20px; flex-shrink: 0; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; }
.kpi-label { font-size: var(--fs-6); color: var(--text-4); margin-bottom: 2px; }
.kpi-value { font-size: var(--fs-2); font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: var(--fs-6); color: var(--text-4); margin-top: 4px; }

.analytics-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }

.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr 52px; gap: var(--s-2); align-items: center; font-size: var(--fs-5); }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bar-track { height: 18px; background: var(--surface-2); border-radius: var(--r-sm); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); transition: width var(--t-base) var(--ease); border-radius: var(--r-sm); }
.bar-value { text-align: end; font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; }

.seg-control { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg { padding: 7px 14px; border-radius: 7px; font-size: var(--fs-5); font-weight: 600; color: var(--text-3); cursor: pointer; min-height: 36px; transition: background var(--t-fast) var(--ease); }
.seg.active { background: var(--surface); color: var(--text-1); box-shadow: 0 1px 2px rgba(20,20,19,0.08); }

.status-chips { display: flex; flex-direction: column; gap: var(--s-2); }
.status-chip-row { display: flex; align-items: center; justify-content: space-between; padding: var(--s-2) 0; border-bottom: 1px solid var(--surface-2); }
.status-chip-row:last-child { border-bottom: none; }

/* Role permissions matrix */
.perm-matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.perm-matrix { width: 100%; border-collapse: collapse; font-size: var(--fs-5); }
.perm-matrix th, .perm-matrix td { padding: var(--s-2) var(--s-3); text-align: center; border-bottom: 1px solid var(--surface-2); }
.perm-matrix thead th { font-size: var(--fs-6); color: var(--text-4); font-weight: 600; letter-spacing: 0.05em; background: var(--surface-2); }
.perm-matrix tbody th { text-align: start; font-weight: 600; padding-inline-end: var(--s-4); white-space: nowrap; }
.perm-matrix select { padding: 6px 24px 6px 8px; font-size: var(--fs-6); border-radius: 7px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-height: 36px; }
.perm-matrix tr:last-child td, .perm-matrix tr:last-child th { border-bottom: none; }

/* Activity feed */
.feed-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.activity-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 14px; border-top: 1px solid var(--surface-2); cursor: pointer; transition: background var(--t-fast) var(--ease); min-height: 52px; width: 100%; text-align: start; background: transparent; border-inline: none; border-bottom: none; }
.activity-row:first-child { border-top: none; }
.activity-row:hover { background: var(--surface-2); }
.activity-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }

/* Lists module — send/receive */
.send-item-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--surface-2); }
.send-item-row:last-child { border-bottom: none; }
.send-item-row .nm { flex: 1; min-width: 0; font-size: 14px; word-break: break-word; }
.stepper { display: flex; align-items: center; gap: 6px; flex: none; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 19px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--t-fast) var(--ease); }
.stepper button:active { background: var(--surface-2); transform: scale(0.95); }
.stepper input { width: 54px; text-align: center; background: var(--surface); color: var(--text-1); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 2px; min-height: 40px; font-size: 15px; font-variant-numeric: tabular-nums; outline: none; -moz-
/* ---------- Toggle switch (storefront open/close, etc.) ---------- */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-strong); border-radius: 30px; transition: background var(--t-fast) var(--ease); }
.switch .slider::before { content: ""; position: absolute; height: 24px; width: 24px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--t-fast) var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(-20px); }
.switch input:disabled + .slider { opacity: 0.5; cursor: not-allowed; }
