/* ============================================================
   Master Cargo CRM — layout.css
   מדורים 2-6: Reset/root · Typography · Layout · Topbar · Sidebar
   פוצל מ-app.css (1007 שו') ב-06/09/2026 לפי docs/REFACTOR_PLAN.md §6.
   סדר הטעינה ב-base.html: tokens → layout → components-core → components-feature → pages
   (הסדר = סדר המדורים המקורי ב-app.css; אסור להחליף בין הקבצים — ה-cascade תלוי בו).
   כל הצבעים/הרדיוסים מגיעים מ-tokens.css. אין ערכים קשיחים כאן פרט לקטעים
   המסומנים "verbatim" שהועתקו מסגנון הבית של טל.
   ============================================================ */

/* ---------- 2. Reset / root ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html[dir="rtl"] { direction: rtl; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* verbatim — Tal's triple-gradient signature background */
  background:
    radial-gradient(1100px 520px at 88% -10%, rgba(232,135,59,.16), transparent 60%),
    radial-gradient(900px 480px at 8% 112%, rgba(34,211,238,.10), transparent 55%),
    linear-gradient(160deg, #0B1020 0%, #0E1428 55%, #101A33 100%);
  background-attachment: fixed;
  background-color: var(--bg);
}
img, svg, video { max-width: 100%; height: auto; display: inline-block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }
::selection { background: rgba(var(--accent-rgb), .45); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4 { margin: 0 0 var(--sp-2); line-height: 1.25; font-weight: 800; letter-spacing: .1px; }
h1 { font-size: var(--fs-2xl); font-weight: 900; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); font-weight: 700; }
p { margin: 0 0 var(--sp-3); }
small, .small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { font-weight: 700; }
.w900 { font-weight: 900; }
.w300 { font-weight: 300; }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
.grad-text {
  /* verbatim — gradient hero title */
  font-weight: 900; letter-spacing: .5px;
  background: linear-gradient(90deg, #F5B26B 0%, #E8873B 35%, #22D3EE 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.num, .ltr {
  direction: ltr;
  unicode-bidi: embed;
  font-variant-numeric: tabular-nums;
}
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pre { white-space: pre-wrap; word-break: break-word; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .85em; }
.tone-good { color: var(--good); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }
.tone-accent { color: var(--accent); }
.tone-cyan { color: var(--cyan); }

/* ---------- 4. Layout ---------- */
.topbar {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 60;
  height: calc(var(--nav-h) + var(--sa-t));
  padding: var(--sa-t) var(--sp-3) 0;
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--sh-nav);
}
.sidebar {
  position: fixed; z-index: 70;
  inset-block-start: calc(var(--nav-h) + var(--sa-t)); inset-block-end: 0;
  inset-inline-start: 0;
  width: min(85vw, 320px);
  display: flex; flex-direction: column;
  background: var(--sb-bg);
  border-inline-end: 1px solid rgba(34,211,238,.28);
  box-shadow: var(--sh-drawer);
  overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-3) var(--sp-3) calc(var(--sp-4) + var(--sa-b));
  transform: translateX(100%);
  transition: transform var(--t-med) var(--ease);
  visibility: hidden;
}
body.drawer-open .sidebar { transform: none; visibility: visible; }
.backdrop {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(3,6,14,.62);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity var(--t-med) var(--ease);
}
body.drawer-open .backdrop { opacity: 1; pointer-events: auto; }
body.drawer-open { overflow: hidden; }

.main {
  padding: calc(var(--nav-h) + var(--sa-t) + var(--sp-4)) var(--sp-3) calc(var(--sp-7) + var(--sa-b));
  max-width: 100%;
}
body.no-nav .main { padding-top: calc(var(--sp-5) + var(--sa-t)); }
.container { max-width: var(--content-max); margin-inline: auto; }
.container-narrow { max-width: 760px; margin-inline: auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.page-head .actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.section { margin-block: var(--sp-5); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.section-head h2, .section-head h3 { margin: 0; display: flex; align-items: center; gap: var(--sp-2); }
.section-head .count { font-weight: 800; color: var(--accent-2); }

/* stacks & grids */
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--sp-3); }
.grid-2 { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.text-center { text-align: center; }
.text-start { text-align: start; }
.hide-mobile { display: none !important; }

/* ---------- 5. Topbar internals ---------- */
.nav-toggle {
  width: var(--touch); height: var(--touch); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(12,22,38,.95);
  border: 1px solid rgba(34,211,238,.45);
  border-radius: 10px; color: var(--text); font-size: 1.25rem; line-height: 1;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.nav-toggle:hover { background: rgba(34,211,238,.12); }
.nav-toggle .ico-close { display: none; }
body.drawer-open .nav-toggle .ico-open { display: none; }
body.drawer-open .nav-toggle .ico-close { display: inline; }

.orb {
  /* verbatim — spinning conic-gradient brand orb with breathing halo */
  position: relative; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
  background: conic-gradient(#F5B26B, #E8873B, #22D3EE, #F5B26B);
  animation: orb-spin 9s linear infinite;
  box-shadow: 0 0 14px rgba(232,135,59,.35);
}
.orb::before {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: var(--bg); opacity: .92;
}
.orb::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid rgba(34,211,238,.45);
  animation: orb-breathe 3.2s ease-out infinite;
}
.orb-lg { width: 64px; height: 64px; } .orb-lg::before { inset: 9px; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-breathe { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }

.brand { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 900; font-size: 1.02rem; letter-spacing: .3px; white-space: nowrap; }
.brand-sub { font-size: var(--fs-xs); color: var(--faint); margin-top: -2px; white-space: nowrap; }
.topbar .brand, .topbar .orb, .topbar .nav-toggle { flex: 0 0 auto; }
.topbar-title {
  font-weight: 700; font-size: var(--fs-md); color: var(--muted);
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .spacer { flex: 0 1 var(--sp-2); }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); flex: 0 0 auto; }

.icon-btn {
  position: relative; width: var(--touch); height: var(--touch);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04); color: var(--text); font-size: 1.15rem; line-height: 1;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: rgba(232,135,59,.12); border-color: rgba(232,135,59,.55); text-decoration: none; }
.icon-btn:active { transform: scale(.96); }
.badge {
  position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  font-size: .7rem; font-weight: 900; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg), var(--glow-accent);
}
.badge.is-zero, .badge:empty { display: none; }

.user-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: var(--touch); padding: 0 var(--sp-2) 0 var(--sp-3);
  border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04); color: var(--text);
}
.user-chip:hover { text-decoration: none; border-color: rgba(232,135,59,.55); }
.user-chip .name { font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.user-chip .role { font-size: var(--fs-xs); color: var(--faint); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad-accent); color: var(--on-accent);
  font-weight: 900; font-size: .8rem; letter-spacing: .3px;
}
.avatar-sm { width: 24px; height: 24px; font-size: .68rem; }
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar-cyan { background: linear-gradient(135deg, #22D3EE, #0EA5E9); color: #04121a; }
.avatar-muted { background: rgba(255,255,255,.12); color: var(--muted); }

.health-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  background: var(--good-2); box-shadow: 0 0 8px rgba(74,222,128,.6);
}
.health-dot.is-bad { background: var(--bad-2); box-shadow: 0 0 8px rgba(248,113,113,.7); animation: pulse-bad 1.6s ease-in-out infinite; }
.health-dot.is-warn { background: var(--warn); box-shadow: 0 0 8px rgba(253,230,138,.6); }
.health-wrap { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; height: var(--touch); font-size: var(--fs-xs); color: var(--faint); }
@keyframes pulse-bad { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* ---------- 6. Sidebar internals ---------- */
.sb-brand { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2) var(--sp-3); }
.sb-group {
  /* alternating-tint banded groups (Hub sidebar idiom) */
  border-radius: 12px; padding: var(--sp-2); margin-bottom: var(--sp-2);
  background: rgba(255,255,255,.025);
}
.sb-group:nth-of-type(even) { background: rgba(34,211,238,.035); }
.sb-group-title { font-size: var(--fs-xs); font-weight: 700; color: var(--faint); letter-spacing: .5px; padding: 2px var(--sp-2) var(--sp-2); }
.nav-btn {
  /* verbatim — Hub sidebar button */
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%; min-height: var(--touch); margin-bottom: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  color: #EAF2FF;
  border-radius: 10px;
  font-size: .84rem; font-weight: 600;
  padding: .42rem .6rem; line-height: 1.3;
  text-align: start;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.nav-btn:hover { border-color: rgba(232,135,59,.6); background: rgba(232,135,59,.12); text-decoration: none; }
.nav-btn:active { transform: scale(.985); }
.nav-btn.is-active {
  border-color: rgba(232,135,59,.55);
  background: rgba(232,135,59,.10);
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-btn .ico { width: 22px; text-align: center; flex: 0 0 auto; font-size: 1rem; }
.nav-btn .lbl { flex: 1 1 auto; min-width: 0; }
.nav-btn .nav-badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill);
  background: rgba(var(--accent-rgb), .18); border: 1px solid rgba(var(--accent-rgb), .5);
  color: var(--accent-2); font-size: .72rem; font-weight: 800; line-height: 20px; text-align: center;
}
.sb-footer { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--sp-2); }
.sb-user { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2); }
.sb-user .name { font-weight: 700; font-size: var(--fs-sm); }
.sb-user .role { font-size: var(--fs-xs); color: var(--faint); }
.sb-version { font-size: var(--fs-xs); color: var(--faint); text-align: center; }
