/* SHIFT UNLOCK — מערכת עיצוב. חום-שחור חם + זהב ממושמע. RTL-first. */

:root {
  --bg: oklch(0.155 0.012 75);
  --surface: oklch(0.195 0.014 75);
  --surface-2: oklch(0.175 0.013 75);
  --raised: oklch(0.235 0.016 78);
  --border: oklch(0.29 0.018 78);
  --border-soft: oklch(0.245 0.015 78);
  --ink: oklch(0.935 0.012 85);
  --ink-soft: oklch(0.76 0.02 82);
  --ink-faint: oklch(0.62 0.02 80);
  --gold: oklch(0.78 0.126 85);
  --gold-strong: oklch(0.85 0.14 88);
  --gold-dim: oklch(0.78 0.126 85 / 0.14);
  --gold-ink: oklch(0.22 0.05 85);
  --success: oklch(0.76 0.14 152);
  --success-dim: oklch(0.76 0.14 152 / 0.13);
  --danger: oklch(0.7 0.19 27);
  --danger-dim: oklch(0.7 0.19 27 / 0.14);
  --warn: oklch(0.8 0.13 75);
  --warn-dim: oklch(0.8 0.13 75 / 0.13);
  --radius: 10px;
  --radius-sm: 7px;
  --z-sticky: 10;
  --z-modal: 20;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.35), 0 8px 28px -12px oklch(0 0 0 / 0.5);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Heebo", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

/* ---------- מעטפת ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-inline-end: 1px solid var(--border-soft);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 10px 20px;
}

.brand .mark {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.brand .mark b { color: var(--gold); font-weight: 800; }

.brand .sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-weight: 500;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  transition: background 160ms var(--ease), color 160ms var(--ease);
  min-height: 44px;
}

.nav-link:hover { background: var(--raised); color: var(--ink); }

.nav-link.active {
  background: var(--gold-dim);
  color: var(--gold-strong);
  font-weight: 600;
}

.nav-link .count {
  background: var(--gold);
  color: var(--gold-ink);
  font-size: 12px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}

.nav-link .count.zero { display: none; }

.sidebar .spacer { flex: 1; }

.conn {
  padding: 10px 12px;
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.conn .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  margin-inline-end: 7px;
  background: var(--danger);
  vertical-align: 1px;
}

.conn .dot.on { background: var(--success); }

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 36px 60px;
  max-width: 1160px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 24px;
  flex-wrap: wrap;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.page-head .hint { color: var(--ink-faint); font-size: 13.5px; margin-top: 4px; }

h2 {
  font-size: 16.5px;
  font-weight: 600;
  margin: 34px 0 12px;
  color: var(--ink);
}

h2:first-child { margin-top: 0; }

/* ---------- רצועת מדדים ---------- */

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 26px;
  box-shadow: var(--shadow);
}

.stat {
  flex: 1 1 150px;
  padding: 16px 22px;
  border-inline-start: 1px solid var(--border-soft);
}

.stat:first-child { border-inline-start: none; }

.stat .label { font-size: 12.5px; color: var(--ink-faint); font-weight: 500; }

.stat .value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.stat .value .unit { font-size: 14px; color: var(--ink-soft); font-weight: 500; }

.stat.gold .value { color: var(--gold-strong); }
.stat.danger .value { color: var(--danger); }

/* ---------- טבלאות ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background 140ms var(--ease); }

tbody tr:hover { background: var(--raised); }

td.num, th.num { font-variant-numeric: tabular-nums; }

a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }

a.row-link:hover { color: var(--gold-strong); }

/* ---------- פס התקדמות ---------- */

.progress {
  --p: 0%;
  position: relative;
  height: 6px;
  border-radius: 99px;
  background: var(--raised);
  min-width: 90px;
  overflow: hidden;
}

.progress::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--p);
  border-radius: 99px;
  background: var(--gold);
  transition: width 400ms var(--ease);
}

.progress.full::after { background: var(--success); }

.progress-cell { display: grid; gap: 5px; min-width: 130px; }

.progress-cell .nums {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- תגיות מצב ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 99px;
  padding: 3px 11px;
  white-space: nowrap;
}

.chip.active { background: var(--success-dim); color: var(--success); }
.chip.frozen { background: var(--danger-dim); color: var(--danger); }
.chip.completed { background: var(--gold-dim); color: var(--gold-strong); }
.chip.pending { background: var(--warn-dim); color: var(--warn); }
.chip.neutral { background: var(--raised); color: var(--ink-soft); }

/* ---------- כפתורים וטפסים ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 160ms var(--ease), border-color 160ms var(--ease),
    color 160ms var(--ease), transform 160ms var(--ease);
}

.btn:hover { background: oklch(0.27 0.017 78); border-color: var(--ink-faint); }

.btn:active { transform: translateY(1px); }

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--gold-ink);
}

.btn.primary:hover { background: var(--gold-strong); border-color: var(--gold-strong); }

.btn.danger {
  background: transparent;
  border-color: oklch(0.7 0.19 27 / 0.45);
  color: var(--danger);
}

.btn.danger:hover { background: var(--danger-dim); }

.btn.sm { min-height: 33px; padding: 4px 13px; font-size: 13px; }

.btn.ghost { background: transparent; }

label.field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="password"], input[type="date"], input[type="file"], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  padding: 9px 12px;
  min-height: 42px;
  width: 100%;
  transition: border-color 160ms var(--ease);
}

input:hover, select:hover, textarea:hover { border-color: var(--ink-faint); }

input::placeholder { color: var(--ink-faint); }

input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  padding: 0;
}

input[type="checkbox"]:checked { background: var(--gold); border-color: var(--gold); }

input[type="checkbox"]:checked::before {
  content: "";
  width: 10px;
  height: 6px;
  border: 2.5px solid var(--gold-ink);
  border-top: none;
  border-right: none;
  transform: rotate(-45deg) translateY(-1px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  align-items: end;
}

/* ---------- פאנלים ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 18px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
  align-items: start;
}

/* בלי זה, תוכן רחב (טבלאות) מותח את עמודות ה-grid מעבר למסך במובייל */
.two-col > * { min-width: 0; }

/* ---------- התראות ופיד ---------- */

.alert-list, .feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.alert-item, .feed-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}

.alert-item:last-child, .feed-item:last-child { border-bottom: none; }

.alert-item .msg { flex: 1; }

.alert-item .who { font-weight: 600; }

.alert-item form { margin-inline-start: auto; }

.feed-item { color: var(--ink-soft); }

.feed-item .who { color: var(--ink); font-weight: 600; }

.feed-item time, .alert-item time {
  color: var(--ink-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  flex-shrink: 0;
  align-self: center;
}

.badge-dot.failed_charge, .badge-dot.missed { background: var(--danger); }
.badge-dot.reconstructed, .badge-dot.mismatch { background: var(--warn); }
.badge-dot.info { background: var(--ink-faint); }

/* ---------- מסך התחברות ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 40px 34px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  text-align: center;
}

.login-card .brand { justify-content: center; padding: 0; }

.login-card .error { color: var(--danger); font-size: 13.5px; margin: 0; }

/* ---------- סולם (הגדרות) ---------- */

.ladder-row {
  display: grid;
  grid-template-columns: 26px 1fr 110px 150px 60px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}

.ladder-row:last-child { border-bottom: none; }

.ladder-row .order {
  color: var(--ink-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.ladder-head {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.unit-kind-big { color: var(--gold-strong); }

/* ---------- אישורים ---------- */

.review-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.review-item:last-child { border-bottom: none; }

.review-item .what { flex: 1; min-width: 220px; }

.review-item .what .unit-name { font-weight: 600; }

.review-item .what .meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

.review-item .actions { display: flex; gap: 8px; }

.empty {
  text-align: center;
  color: var(--ink-faint);
  padding: 42px 20px;
  font-size: 14.5px;
}

.empty strong { color: var(--ink-soft); display: block; margin-bottom: 4px; font-size: 16px; }

/* ---------- שונות ---------- */

.note {
  background: var(--gold-dim);
  border: 1px solid oklch(0.78 0.126 85 / 0.3);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  margin: 0 0 18px;
}

.note.ok { background: var(--success-dim); border-color: oklch(0.76 0.14 152 / 0.35); }
.note.err { background: var(--danger-dim); border-color: oklch(0.7 0.19 27 / 0.4); }

code.inline {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 12.5px;
  direction: ltr;
  unicode-bidi: embed;
  word-break: break-all;
}

.kv { display: grid; gap: 8px; font-size: 13.5px; }

.kv > div { display: flex; justify-content: space-between; gap: 12px; }

.kv .k { color: var(--ink-faint); }

.kv .v { font-variant-numeric: tabular-nums; font-weight: 500; text-align: left; }

.muted { color: var(--ink-faint); }

.mobile-nav { display: none; }

/* ---------- רספונסיביות ---------- */

@media (max-width: 900px) {
  .shell { flex-direction: column; }

  .sidebar {
    position: static;
    height: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 10px 14px;
    gap: 2px;
    overflow-x: auto;
    border-inline-end: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .brand { padding: 0 4px 0 10px; }

  .brand .sub, .sidebar .conn, .sidebar .spacer { display: none; }

  .nav-link { min-height: 40px; padding: 8px 11px; white-space: nowrap; }

  .main { padding: 20px 16px 50px; }

  .two-col { grid-template-columns: 1fr; }

  .ladder-row { grid-template-columns: 22px 1fr 90px; }

  .ladder-row .course-col { grid-column: 2 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
