/* ===== משתני עיצוב ===== */
:root {
  --bg: #0b0e14;
  --bg-soft: #0f131c;
  --card: #131824;
  --card-hover: #171d2c;
  --border: #222a3a;
  --border-light: #2c3650;
  --text: #e8ebf2;
  --text-soft: #aab2c5;
  --muted: #6b7488;
  --accent: #e11d2e;
  --accent-2: #ff3b3b;
  --accent-soft: rgba(225, 29, 46, 0.13);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 250px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 24px -14px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 8px 26px -8px rgba(225, 29, 46, 0.4);
  --font: 'Heebo', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 70% 40% at 90% -10%, rgba(225, 29, 46, 0.22), transparent),
    radial-gradient(ellipse 55% 40% at -10% 110%, rgba(225, 29, 46, 0.14), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* רשת רקע עדינה + כתמי אור נעים */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(225, 29, 46, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225, 29, 46, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 75% 0%, black, transparent 72%);
  mask-image: radial-gradient(ellipse 85% 70% at 75% 0%, black, transparent 72%);
}

body::after {
  content: '';
  position: fixed;
  inset: -12%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle 460px at 18% 22%, rgba(225, 29, 46, 0.1), transparent 70%),
    radial-gradient(circle 560px at 85% 80%, rgba(225, 29, 46, 0.07), transparent 70%);
  animation: bg-drift 18s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-3%, 4%, 0) scale(1.07); }
}

/* אנימציית לד רץ — נקודת אור שנוסעת לאורך פס */
@keyframes led-flow {
  0% { background-position: -60% 0, 0 0; }
  100% { background-position: 160% 0, 0 0; }
}

@keyframes led-pulse {
  0%, 100% { box-shadow: 0 0 16px 2px rgba(225, 29, 46, 0.75); }
  50% { box-shadow: 0 0 26px 6px rgba(225, 29, 46, 1); }
}

@keyframes logo-breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(225, 29, 46, 0.3), 0 6px 20px rgba(225, 29, 46, 0.45); }
  50% { box-shadow: 0 0 0 1px rgba(225, 29, 46, 0.55), 0 6px 32px rgba(225, 29, 46, 0.85); }
}

h1, h2, h3, h4 { letter-spacing: -0.01em; }

::selection { background: rgba(225, 29, 46, 0.35); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
}

/* סקרולבר */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #46242f; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #642f3c; }

button { font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 500;
}

.field input {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== מבנה כללי ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== סרגל צד ===== */
.sidebar {
  width: var(--sidebar-w);
  background:
    radial-gradient(ellipse 100% 24% at 50% 0%, rgba(225, 29, 46, 0.18), transparent),
    var(--bg-soft);
  border-inline-start: none;
  border-inline-end: 1px solid var(--border);
  box-shadow: 4px 0 24px -12px rgba(0, 0, 0, 0.6);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.brand::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, transparent 0 42%, var(--accent-2) 46%, #ffe9e9 50%, var(--accent-2) 54%, transparent 58% 100%),
    linear-gradient(90deg, rgba(225, 29, 46, 0.18), rgba(225, 29, 46, 0.18));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: led-flow 2.6s linear infinite;
  filter: drop-shadow(0 0 5px rgba(255, 59, 59, 0.85));
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(225, 29, 46, 0.3), 0 6px 20px rgba(225, 29, 46, 0.45);
  animation: logo-breathe 3.2s ease-in-out infinite;
}

.brand-name {
  font-weight: 800;
  font-size: 16.5px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #fff, #c7cbd6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav-section {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: start;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
  transition: stroke 0.15s;
}

.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item:hover svg { stroke: #ff9d9d; }

.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(225, 29, 46, 0.03));
  color: #ff9d9d;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(225, 29, 46, 0.22);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  inset-inline-start: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(var(--accent), var(--accent-2));
  animation: led-pulse 2.2s ease-in-out infinite;
}

[dir="rtl"] .nav-item.active::before {
  inset-inline-start: auto;
  inset-inline-end: -14px;
  border-radius: 4px 0 0 4px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ===== אזור ראשי ===== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.72);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 100%;
  height: 3px;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, transparent 0 42%, var(--accent-2) 46%, #ffe9e9 50%, var(--accent-2) 54%, transparent 58% 100%),
    linear-gradient(90deg, rgba(225, 29, 46, 0.25), rgba(225, 29, 46, 0.25));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: led-flow 2.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 59, 59, 0.9));
}

.page-title {
  font-size: 19px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  position: relative;
  padding-inline-start: 14px;
}

.page-title::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(225, 29, 46, 0.7);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-chip-top {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 12px 6px 8px;
  border-radius: 99px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.user-chip-top:hover { border-color: var(--border-light); }

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 3px 10px -2px rgba(225, 29, 46, 0.55);
}

.role-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: #ff9d9d;
}

.role-badge.owner { background: var(--warning-soft); color: var(--warning); }

.discord-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(88, 101, 242, 0.1);
  border-bottom: 1px solid rgba(88, 101, 242, 0.3);
  color: var(--text-soft);
  font-size: 13px;
  padding: 10px 28px;
  flex-wrap: wrap;
}

.discord-banner span { display: flex; align-items: center; gap: 8px; }
.discord-banner svg { width: 16px; height: 16px; stroke: #5865f2; }

main.content {
  padding: 26px 28px 60px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== כרטיסים ===== */
.card {
  background: linear-gradient(180deg, var(--card-hover), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card), 0 16px 40px -24px rgba(0, 0, 0, 0.8);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 70%);
  opacity: 0.6;
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-card), 0 20px 46px -22px rgba(0, 0, 0, 0.85);
}

.card::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  pointer-events: none;
  background-image: linear-gradient(90deg, transparent 0 43%, var(--accent-2) 47%, #ffe9e9 50%, var(--accent-2) 53%, transparent 57% 100%);
  background-size: 250% 100%;
  background-repeat: no-repeat;
  animation: led-flow 3.6s linear infinite;
  filter: drop-shadow(0 0 5px rgba(255, 59, 59, 0.8));
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: -0.005em;
}

.card-title svg { width: 17px; height: 17px; stroke: var(--accent-2); filter: drop-shadow(0 0 6px rgba(225, 29, 46, 0.35)); }

.card-desc { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }

/* ===== רשת סטטיסטיקות ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: linear-gradient(165deg, var(--card-hover), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.stat-grid .stat-card:nth-child(1) { animation-delay: 0.02s; }
.stat-grid .stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: 0.14s; }
.stat-grid .stat-card:nth-child(5) { animation-delay: 0.18s; }
.stat-grid .stat-card:nth-child(6) { animation-delay: 0.22s; }

.stat-card:hover {
  border-color: rgba(225, 29, 46, 0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 18px 34px -16px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(225, 29, 46, 0.15);
}

.stat-card:hover .stat-icon { transform: scale(1.08); }

.stat-card.clickable { cursor: pointer; user-select: none; }
.stat-card.clickable:active { transform: translateY(-1px) scale(0.99); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.18s;
}

.stat-icon svg { width: 21px; height: 21px; }

.stat-icon.indigo { background: linear-gradient(150deg, rgba(225, 29, 46, 0.22), rgba(225, 29, 46, 0.08)); box-shadow: inset 0 0 0 1px rgba(225, 29, 46, 0.3); }
.stat-icon.indigo svg { stroke: #ff9d9d; filter: drop-shadow(0 0 8px rgba(225, 29, 46, 0.6)); }
.stat-icon.green { background: linear-gradient(150deg, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.08)); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.3); }
.stat-icon.green svg { stroke: var(--success); filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.55)); }
.stat-icon.amber { background: linear-gradient(150deg, rgba(251, 191, 36, 0.22), rgba(251, 191, 36, 0.08)); box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.3); }
.stat-icon.amber svg { stroke: var(--warning); filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.55)); }
.stat-icon.red { background: linear-gradient(150deg, rgba(248, 113, 113, 0.22), rgba(248, 113, 113, 0.08)); box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.3); }
.stat-icon.red svg { stroke: var(--danger); filter: drop-shadow(0 0 8px rgba(248, 113, 113, 0.55)); }

.stat-num {
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.015em;
  background: linear-gradient(180deg, #fff, #c4c9d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ===== טבלאות ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

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

thead th {
  text-align: start;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(34, 42, 58, 0.6);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(225, 29, 46, 0.05); }

.rank-cell { font-weight: 700; color: var(--muted); width: 40px; }
.rank-1 { color: #fbbf24; }
.rank-2 { color: #cbd5e1; }
.rank-3 { color: #d97706; }

/* ===== תגיות ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge.success { background: var(--success-soft); color: var(--success); }
.badge.muted { background: rgba(107, 116, 136, 0.15); color: var(--muted); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: #ff9d9d; }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ===== משתמש עם אווטאר ===== */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.user-chip img, .user-chip .avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.avatar-fallback {
  background: linear-gradient(135deg, #374151, #4b5563);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #d1d5db;
}

.user-chip .uc-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-chip .uc-id { font-size: 11px; color: var(--muted); direction: ltr; text-align: end; }

/* ===== טפסים ===== */
.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-row input, .form-row select, .form-row textarea, .input {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9.5px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus, .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-row input, .form-row textarea { flex: 1; min-width: 140px; }
.form-row select { min-width: 170px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.form-grid .field input, .form-grid .field select, .form-grid .field textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9.5px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  width: 100%;
}

.form-grid .field textarea { resize: vertical; min-height: 74px; }

.field-full { grid-column: 1 / -1; }

/* ===== כפתורים ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  padding: 9.5px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  transition: opacity 0.15s, transform 0.12s, box-shadow 0.2s;
  white-space: nowrap;
  box-shadow: 0 10px 26px -8px rgba(225, 29, 46, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  position: relative;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: linear-gradient(105deg, transparent 0 42%, rgba(255, 255, 255, 0.35) 50%, transparent 58% 100%);
  background-size: 250% 100%;
  background-repeat: no-repeat;
  background-position: -60% 0;
}

.btn:hover::after { animation: btn-shine 0.8s ease; }
.btn:disabled::after { animation: none; }

@keyframes btn-shine {
  from { background-position: -60% 0; }
  to { background-position: 160% 0; }
}

.btn svg { width: 15px; height: 15px; stroke: currentColor; }
.btn:hover { opacity: 0.96; transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(225, 29, 46, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn:active { transform: scale(0.98) translateY(0); }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; transform: none; }

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.btn.ghost:hover { border-color: var(--border-light); color: var(--text); opacity: 1; }

.btn.danger {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--danger);
}

.btn.danger:hover { background: var(--danger-soft); opacity: 1; }

.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.small svg { width: 13px; height: 13px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.13s;
}

.icon-btn svg { width: 14px; height: 14px; stroke: currentColor; }
.icon-btn:hover { color: var(--text); border-color: var(--border-light); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); background: var(--danger-soft); }

/* ===== צ'יפים לסינון ===== */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 6px 14px;
  border-radius: 99px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.13s;
}

.chip:hover { border-color: var(--border-light); color: var(--text); }

.chip.active {
  background: var(--accent-soft);
  border-color: rgba(225, 29, 46, 0.45);
  color: #ff9d9d;
}

/* ===== חיפוש ===== */
.search-box {
  position: relative;
  margin-bottom: 14px;
  max-width: 320px;
}

.search-box input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 38px 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
}

.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.search-box svg {
  position: absolute;
  top: 50%;
  inset-inline-start: 12px;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--muted);
  pointer-events: none;
}

/* ===== טאבים פנימיים ===== */
.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.sub-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.13s, border-color 0.13s;
  margin-bottom: -1px;
}

.sub-tab:hover { color: var(--text-soft); }
.sub-tab.active {
  color: #ff9d9d;
  border-bottom-color: var(--accent);
  text-shadow: 0 0 14px rgba(255, 59, 59, 0.5);
}

/* ===== מצב ריק ===== */
.empty-state {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 26px;
  height: 26px;
  stroke: #4a5573;
  margin-bottom: 12px;
  padding: 15px;
  box-sizing: content-box;
  border-radius: 50%;
  background: var(--bg-soft);
  box-shadow: inset 0 0 0 1px var(--border);
}

.empty-state p { margin: 0; font-size: 13.5px; }

/* ===== שלד טעינה ===== */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row { height: 46px; margin-bottom: 10px; }
.skeleton-card { height: 84px; }

/* ===== מודאל ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

.modal {
  background: linear-gradient(180deg, var(--card-hover), var(--card));
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 26px;
  width: 480px;
  max-width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: var(--shadow), 0 0 0 1px rgba(225, 29, 46, 0.06);
  animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.modal::after {
  content: '';
  position: absolute;
  inset-inline: 14px;
  top: 0;
  height: 2px;
  border-radius: 99px;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, transparent 0 42%, var(--accent-2) 47%, #ffe9e9 50%, var(--accent-2) 53%, transparent 58% 100%),
    linear-gradient(90deg, rgba(225, 29, 46, 0.2), rgba(225, 29, 46, 0.2));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: led-flow 2.8s linear infinite;
  filter: drop-shadow(0 0 5px rgba(255, 59, 59, 0.8));
}

.modal.wide { width: 640px; }

.modal h3 { margin: 0 0 6px; font-size: 16.5px; }
.modal .modal-desc { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ===== שיחת זיכרון ===== */
.chat-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px 2px;
}

.chat-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 13px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.user {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-bottom-left-radius: 4px;
}

.chat-msg .chat-time { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* ===== טוסטים ===== */
.toast-container {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 340px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.out { animation: toastOut 0.25s ease forwards; }

@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px); }
}

.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.success svg { stroke: var(--success); }
.toast.error svg { stroke: var(--danger); }

/* ===== שונות ===== */
.text-muted { color: var(--muted); }
.text-small { font-size: 12px; }
.mono { direction: ltr; unicode-bidi: embed; font-family: Consolas, monospace; font-size: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mb-0 { margin-bottom: 0; }

.trig-reply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}

.trig-reply:last-child { border-bottom: none; }
.icon-btn.small { width: 24px; height: 24px; flex-shrink: 0; }
.icon-btn.small svg { width: 11px; height: 11px; }

.note-text {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 480px;
  font-size: 13px;
  color: var(--text-soft);
}

.divider {
  border: none;
  height: 2px;
  margin: 18px 0;
  background-image:
    linear-gradient(90deg, transparent 0 42%, rgba(255, 59, 59, 0.85) 47%, #ffd6d6 50%, rgba(255, 59, 59, 0.85) 53%, transparent 58% 100%),
    linear-gradient(90deg, rgba(225, 29, 46, 0.14), rgba(225, 29, 46, 0.14));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: led-flow 3s linear infinite;
  filter: drop-shadow(0 0 4px rgba(255, 59, 59, 0.5));
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}

.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 210px;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.check-list .checkbox-row { padding: 3px 0; }

/* ===== מובייל ===== */
.menu-toggle { display: none; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }

  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0) !important; }

  .menu-toggle {
    display: inline-flex;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .menu-toggle svg { width: 18px; height: 18px; stroke: currentColor; }

  main.content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.6);
    z-index: 80;
  }
}

/* ===== הפחתת תנועה (נגישות) ===== */
@media (prefers-reduced-motion: reduce) {
  body::after,
  .topbar::after,
  .card::after,
  .brand::after,
  .brand-logo,
  .modal::after,
  .divider,
  .nav-item.active::before,
  .btn::after,
  .stat-card,
  main.content {
    animation: none !important;
  }
}
