/* ═══════════════════════════════════════════════════════════
   منصة العقل المعرفي — KIP Control Center UX v2.0
   Dark professional dashboard — RTL Arabic-first
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0B1120;
  --bg-soft: #0F172A;
  --card: #1E293B;
  --card-hover: #263449;
  --border: rgba(148, 163, 184, 0.15);
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --accent: #10B981;
  --accent-2: #8B5CF6;
  --accent-3: #3B82F6;
  --accent-4: #F59E0B;
  --danger: #EF4444;
  --font-family: 'Cairo', 'Tajawal', 'Inter', sans-serif;
  --heading-font: 'Cairo', 'Outfit', sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

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

html, body {
  height: 100%;
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

body { overflow-x: hidden; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Layout shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar toggle (collapsible) ── */
.sidebar-toggle {
  position: absolute;
  top: 0.8rem;
  left: 0.6rem; /* RTL: left side of the right-sidebar */
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  z-index: 60;
}
.sidebar-toggle:hover {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.4);
}
.toggle-icon { display: inline-block; transition: transform 0.25s ease; }

/* Collapsed state */
body.sidebar-collapsed .sidebar {
  width: 64px;
  padding: 1rem 0.5rem;
}
body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0.5rem 0 1.1rem;
}
body.sidebar-collapsed .sidebar-brand > div:last-child,
body.sidebar-collapsed .side-nav-label,
body.sidebar-collapsed .side-nav-item .nav-icon + span:not(.nav-step-badge),
body.sidebar-collapsed .side-nav-item .nav-step-badge,
body.sidebar-collapsed .help-link span:last-child,
body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .sidebar-subtitle {
  display: none;
}
body.sidebar-collapsed .side-nav-item {
  justify-content: center;
  padding: 0.55rem;
  font-size: 0;
}
body.sidebar-collapsed .side-nav-item .nav-icon { font-size: 1.15rem; margin: 0; }
body.sidebar-collapsed .sidebar-toggle { left: 0.4rem; }
body.sidebar-collapsed .toggle-icon { transform: rotate(180deg); }
body.sidebar-collapsed .help-link { justify-content: center; padding: 0.55rem; }
body.sidebar-collapsed .sidebar-logo { width: 36px; height: 36px; font-size: 1.1rem; }

/* ═══ SIDEBAR (right in RTL) ═══ */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-left: 1px solid var(--border); /* RTL: border on left side */
  display: flex;
  flex-direction: column;
  padding: 1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: width 0.25s ease, padding 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem 1.1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.8rem;
}
.sidebar-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.sidebar-title { font-weight: 800; font-size: 1rem; line-height: 1.3; }
.sidebar-subtitle { font-size: 0.7rem; color: var(--text-dim); }

.side-nav-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.9rem 0.5rem 0.35rem;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: right;
  margin-bottom: 2px;
}
.side-nav-item .nav-icon { font-size: 1.05rem; width: 22px; text-align: center; }
.side-nav-item:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.side-nav-item.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(139, 92, 246, 0.12));
  color: var(--text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.side-nav-item .nav-step-badge {
  margin-right: auto;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
}
.side-nav-item.active .nav-step-badge { background: var(--accent); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.help-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.help-link:hover { color: var(--text); background: rgba(148,163,184,0.07); }

/* ═══ MAIN AREA ═══ */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.6rem;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-page-title { font-weight: 800; font-size: 1.05rem; }
.header-actions { display: flex; align-items: center; gap: 0.8rem; }

.status-pill {
  display: flex; align-items: center; gap: 0.45rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 30px;
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.lang-toggle { display: flex; align-items: center; gap: 0.2rem; background: rgba(148,163,184,0.1); border: 1px solid var(--border); border-radius: 30px; padding: 0.18rem; }
.lang-btn { background: transparent; border: none; color: var(--text-muted); font-weight: 800; font-size: 0.75rem; padding: 0.28rem 0.6rem; border-radius: 20px; cursor: pointer; }
.lang-btn.active { background: var(--accent); color: #fff; }

.user-chip { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent-3)); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.user-name { font-size: 0.8rem; font-weight: 700; }
.user-role { font-size: 0.68rem; color: var(--text-dim); }

/* Main content */
.app-main {
  padding: 1.4rem 1.6rem;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

/* ── Page intro ── */
.page-intro { margin-bottom: 1.4rem; }
.page-intro h1 { font-size: 1.35rem; font-weight: 800; }
.page-intro p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

/* ── Knowledge Journey (5 steps) ── */
.journey-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem;
}
@media (max-width: 1100px) { .journey-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .journey-grid { grid-template-columns: 1fr; } }

.journey-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.journey-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(16,185,129,0.4); }
.journey-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: var(--jc-color, var(--accent));
}
.journey-card .jc-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.jc-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  background: color-mix(in srgb, var(--jc-color, var(--accent)) 18%, transparent);
  color: var(--jc-color, var(--accent));
}
.jc-step { font-size: 0.66rem; color: var(--text-dim); font-weight: 700; }
.jc-title { font-weight: 800; font-size: 0.95rem; }
.jc-desc { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 0.8rem; min-height: 2.2em; }
.jc-stats { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.jc-stat {
  background: rgba(148,163,184,0.1);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.jc-stat strong { color: var(--text); font-size: 0.9rem; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}
.card h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 0.15rem; }
.card h3 { font-size: 0.92rem; font-weight: 700; margin-bottom: 0.5rem; }
.card .card-sub { color: var(--text-muted); font-size: 0.78rem; margin-bottom: 1rem; }

.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.grid-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
@media (max-width: 900px) { .grid-2col, .grid-3col, .grid-4col { grid-template-columns: 1fr; } }

/* KPI stat cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: all 0.2s ease;
}
.kpi-card:hover { border-color: rgba(16,185,129,0.4); box-shadow: var(--shadow); }
.kpi-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--kpi-bg, rgba(59,130,246,0.15));
  color: var(--kpi-color, var(--accent-3));
  flex-shrink: 0;
}
.kpi-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

/* Charts */
.chart-box { position: relative; width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.6rem; font-size: 0.75rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 0.35rem; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.donut-center { position: relative; width: 170px; height: 170px; flex-shrink: 0; }
.donut-center .center-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.donut-center .center-text .big { font-size: 1.6rem; font-weight: 800; }
.donut-center .center-text .small { font-size: 0.7rem; color: var(--text-muted); }

/* Bar chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 0.5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; height: 100%; justify-content: flex-end; }
.bar {
  width: 70%;
  max-width: 38px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent-3), rgba(59,130,246,0.35));
  transition: height 0.4s ease;
  min-height: 4px;
}
.bar:hover { filter: brightness(1.2); }
.bar-label { font-size: 0.65rem; color: var(--text-dim); }

/* Gauge */
.gauge-wrap { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.gauge-list { flex: 1; min-width: 180px; }
.gauge-row { margin-bottom: 0.8rem; }
.gauge-row .gr-head { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 0.25rem; }
.gauge-row .gr-head .gr-label { color: var(--text-muted); }
.gauge-row .gr-head .gr-val { font-weight: 700; }
.progress-track { height: 7px; background: rgba(148,163,184,0.15); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.5s ease; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  text-align: right;
  padding: 0.6rem 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,0.5);
  white-space: nowrap;
}
.data-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(148,163,184,0.07); vertical-align: middle; }
.data-table tr:hover td { background: rgba(148,163,184,0.04); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.1);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover { background: rgba(148,163,184,0.18); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #059669); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-accent2 { background: linear-gradient(135deg, var(--accent-2), #7C3AED); border: none; color: #fff; }
.btn-accent3 { background: linear-gradient(135deg, var(--accent-3), #2563EB); border: none; color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.btn-success { background: rgba(16,185,129,0.12); color: var(--accent); border-color: rgba(16,185,129,0.3); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 0.35rem; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.8rem;
  outline: none;
  transition: border 0.15s ease;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
input::placeholder, textarea::placeholder { color: var(--text-dim); font-size: 0.78rem; }

/* ── Badges / chips ── */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 20px; font-size: 0.68rem; font-weight: 700; }
.badge-success { background: rgba(16,185,129,0.15); color: var(--accent); }
.badge-primary { background: rgba(59,130,246,0.15); color: var(--accent-3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--accent-4); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-dim { background: rgba(148,163,184,0.12); color: var(--text-muted); }

.chip { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 20px; background: rgba(148,163,184,0.1); border: 1px solid var(--border); font-size: 0.75rem; cursor: pointer; color: var(--text); transition: all 0.15s; }
.chip:hover { border-color: var(--accent); }

/* ── Info boxes ── */
.info-box { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2); border-right: 4px solid var(--accent-3); border-radius: var(--radius-sm); padding: 0.9rem 1rem; font-size: 0.82rem; line-height: 1.7; }

/* ── Activity feed ── */
.activity-list { list-style: none; }
.activity-item {
  display: flex; gap: 0.8rem; align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(148,163,184,0.07);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  background: rgba(148,163,184,0.12);
  flex-shrink: 0;
}
.activity-text { font-size: 0.8rem; }
.activity-time { font-size: 0.68rem; color: var(--text-dim); }

/* ── Prose output ── */
.prose-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem; margin-top: 0.8rem; }
.prose-card pre { white-space: pre-wrap; word-break: break-word; font-family: monospace; font-size: 0.75rem; color: var(--text-muted); }

/* ── Hidden ── */
.hidden { display: none !important; }

/* ── Step wizard (project view) ── */
.step-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.step-pill {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 30px;
  background: rgba(148,163,184,0.08);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.step-pill:hover { color: var(--text); }
.step-pill.active { background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(139,92,246,0.15)); border-color: rgba(16,185,129,0.4); color: var(--text); }
.step-pill .step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(148,163,184,0.2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
}
.step-pill.active .step-num { background: var(--accent); color: #fff; }

/* Source list */
.source-item {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.source-item .src-icon { font-size: 1.2rem; }
.source-item .src-name { flex: 1; font-weight: 700; font-size: 0.85rem; }
.source-item .src-meta { font-size: 0.7rem; color: var(--text-dim); }
.source-item .src-actions { display: flex; gap: 0.35rem; }

/* Rule item */
.rule-item {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.rule-item .rule-icon { font-size: 1.1rem; }
.rule-item .rule-body { flex: 1; }
.rule-item .rule-title { font-weight: 700; font-size: 0.84rem; }
.rule-item .rule-desc { font-size: 0.72rem; color: var(--text-muted); }
.rule-item .rule-actions { display: flex; gap: 0.35rem; }

/* Review queue items */
.review-item {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  margin-bottom: 0.6rem;
}
.review-item .rv-body { flex: 1; }
.review-item .rv-title { font-weight: 700; font-size: 0.85rem; }
.review-item .rv-desc { font-size: 0.72rem; color: var(--text-muted); }
.review-item .rv-actions { display: flex; gap: 0.4rem; }

/* Login modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  width: 380px;
  max-width: 92vw;
  box-shadow: var(--shadow);
}

/* Responsive: keep sidebar vertical & collapsible on small screens */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 2.4rem 0.6rem 0.6rem;
    border-left: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar-toggle { top: 0.5rem; left: 0.5rem; }
  .sidebar-brand { border-bottom: none; margin-bottom: 0; padding: 0.2rem 0.4rem; }
  .side-nav-label { display: none; }
  .side-nav-item { width: auto; padding: 0.4rem 0.7rem; font-size: 0.78rem; }
  .side-nav-item .nav-step-badge { display: none; }
  .sidebar-footer { display: none; }
  .app-main { padding: 1rem; }

  /* Collapsed on mobile: hide everything but toggle */
  body.sidebar-collapsed .sidebar {
    width: 100%;
    padding: 0.5rem 2.4rem 0.5rem 0.5rem;
    min-height: 44px;
  }
  body.sidebar-collapsed .sidebar-brand,
  body.sidebar-collapsed .side-nav-item,
  body.sidebar-collapsed .side-nav-label,
  body.sidebar-collapsed .sidebar-footer {
    display: none;
  }
}

/* RTL tweaks (default is RTL via dir attribute) */
[dir="rtl"] .sidebar { border-left: 1px solid var(--border); border-right: none; }
[dir="rtl"] .side-nav-item .nav-step-badge { margin-right: auto; margin-left: 0; }
