/* ============ Disable zoom on touch devices ============ */
html {
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* {
  -webkit-touch-callout: none;
}
input, textarea, select {
  font-size: 16px !important;
}

/* ============================================
   ForexBro - Dashboard Styles
   Client Dashboard + Admin Panel
   ============================================ */

:root {
  --bg-primary: #0A0E1A;
  --bg-secondary: #0F1320;
  --bg-tertiary: #151A2E;
  --bg-card: #131829;
  --bg-hover: #1A2038;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text-primary: #FFFFFF;
  --text-secondary: #A0A8C0;
  --text-muted: #5C6480;
  --accent-gold: #FFB800;
  --accent-gold-dim: rgba(255, 184, 0, 0.12);
  --accent-green: #00FF87;
  --accent-green-dim: rgba(0, 255, 135, 0.12);
  --accent-red: #FF3B5C;
  --accent-red-dim: rgba(255, 59, 92, 0.12);
  --accent-blue: #4D7FFF;
  --accent-blue-dim: rgba(77, 127, 255, 0.12);
  --accent-purple: #A855F7;
  --font-display: 'Space Grotesk', 'Tajawal', sans-serif;
  --font-body: 'Inter', 'Tajawal', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-arabic: 'Tajawal', sans-serif;
  --sidebar-width: 260px;
}

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body {
  font-family: var(--font-arabic);
}

/* ============== APP LAYOUT ============== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ============== SIDEBAR ============== */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  z-index: 50;
}

html[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-subtle);
  left: auto;
  right: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-logo svg {
  width: 36px;
  height: 36px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 12px 8px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  text-align: inherit;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}

html[dir="rtl"] .sidebar-badge {
  margin-left: 0;
  margin-right: auto;
}

.sidebar-user {
  margin-top: auto;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  bottom: 0;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), #FF8A00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--bg-primary);
  flex-shrink: 0;
  font-family: var(--font-display);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-plan {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 500;
}

/* ============== MAIN CONTENT ============== */
.main {
  grid-column: 2;
  padding: 0;
  min-width: 0;
}

html[dir="rtl"] .main {
  grid-column: 2;
}

.topbar {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(20px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.topbar-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

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

.topbar-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.topbar-btn-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.topbar-search {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  width: 280px;
  font-family: inherit;
  transition: all 0.15s;
}

.topbar-search:focus {
  outline: none;
  border-color: var(--accent-gold);
  background: var(--bg-hover);
}

.lang-switch {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 3px;
  font-size: 12px;
  font-weight: 600;
}

.lang-switch span {
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 7px;
  color: var(--text-muted);
  transition: all 0.15s;
}

.lang-switch span.active {
  background: var(--accent-gold);
  color: var(--bg-primary);
}

.content {
  padding: 32px;
}

/* ============== STAT CARDS ============== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.stat-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon.gold { background: var(--accent-gold-dim); color: var(--accent-gold); }
.stat-card-icon.green { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-card-icon.blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.stat-card-icon.red { background: var(--accent-red-dim); color: var(--accent-red); }

.stat-card-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1.1;
}

.stat-card-value .currency {
  font-size: 18px;
  color: var(--text-secondary);
  margin-right: 2px;
}

.stat-card-change {
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.stat-card-change.up { color: var(--accent-green); }
.stat-card-change.down { color: var(--accent-red); }

/* ============== CONTENT CARDS ============== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-head.no-border {
  border: none;
  padding-bottom: 0;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), #FF8A00);
  color: var(--bg-primary);
  box-shadow: 0 4px 14px -4px rgba(255, 184, 0, 0.5);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -4px rgba(255, 184, 0, 0.7);
}

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

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(255, 59, 92, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 59, 92, 0.2);
}

.btn-success {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 135, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* ============== TABLES ============== */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: inherit;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.15s;
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

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

.table-pair {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-pair-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.table-pair-icon.fx {
  background: linear-gradient(135deg, var(--accent-blue), #6366F1);
  color: white;
}

.table-pair-name {
  font-weight: 600;
}

.table-pair-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.table-num {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.badge-buy {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.badge-sell {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.badge-open {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

.badge-tp {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.badge-sl {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.badge-pending {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
}

.badge-gold {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
}

.badge-active {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  position: relative;
  padding-left: 18px;
}

.badge-active::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============== FORMS ============== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  background: var(--bg-hover);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============== TOGGLE ============== */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}

.toggle input:checked + .toggle-slider::before {
  left: 22px;
  background: var(--bg-primary);
}

/* ============== TABS ============== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: 7px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--bg-hover);
  color: var(--accent-gold);
  font-weight: 600;
}

/* ============== CHART CONTAINER ============== */
.chart-wrap {
  height: 280px;
  position: relative;
}

/* ============== SIGNAL CARD (live preview) ============== */
.live-signal {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--accent-gold);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.live-signal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  animation: sweep 3s linear infinite;
}

@keyframes sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.live-signal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.signal-pair-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signal-rows {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.signal-row-mini {
  background: var(--bg-secondary);
  padding: 10px;
  border-radius: 8px;
}

.signal-row-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.signal-row-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

/* ============== SUBSCRIPTION CARD ============== */
.sub-card {
  background: linear-gradient(135deg, var(--accent-gold-dim) 0%, transparent 50%), var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: 14px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.sub-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.sub-plan-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-gold);
}

.sub-plan-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.sub-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.sub-detail-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.sub-detail-value {
  font-weight: 600;
  font-size: 15px;
}

/* ============== MODAL ============== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ============== GRID LAYOUTS ============== */
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ============== NOTIFICATIONS ============== */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  transition: all 0.15s;
  cursor: pointer;
}

.notif-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.notif-item.unread {
  border-left: 3px solid var(--accent-gold);
}

html[dir="rtl"] .notif-item.unread {
  border-left: 1px solid var(--border-subtle);
  border-right: 3px solid var(--accent-gold);
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.notif-text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.notif-time {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
}

/* ============== PROGRESS BAR ============== */
.progress {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 100px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), #FF8A00);
  border-radius: 100px;
  transition: width 0.3s;
}

.progress-fill.green { background: linear-gradient(90deg, var(--accent-green), #00C46A); }

/* ============== EMPTY STATE ============== */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-tertiary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

/* ============== RESPONSIVE ============== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open { transform: translateX(0); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  html[dir="rtl"] .sidebar.open { transform: translateX(0); }

  .app { grid-template-columns: 1fr; }
  .main { grid-column: 1; }

  .topbar { padding: 14px 16px; }
  .topbar-search { display: none; }
  .topbar-title { font-size: 18px; }

  .content { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
}

/* ============ Security / MFA Card ============ */
.mfa-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.mfa-card-info { flex: 1; min-width: 0; }

.mfa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.mfa-status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.mfa-status-badge.enabled {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.mfa-status-badge.disabled {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.mfa-admin-warning {
  background: var(--accent-gold-dim);
  border: 1px solid rgba(255, 184, 0, 0.3);
  color: var(--accent-gold);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mfa-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mfa-setup-box {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.mfa-qr-panel {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.mfa-qr-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.mfa-qr-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mfa-qr-frame {
  display: inline-block;
  background: #fff;
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  margin-bottom: 16px;
  position: relative;
}

.mfa-qr-frame::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-md) + 2px);
  background: linear-gradient(135deg, var(--accent-gold), #FF8A00);
  z-index: -1;
}

.mfa-qr-frame img {
  width: 180px;
  height: 180px;
  display: block;
}

.mfa-secret-wrap {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-subtle);
}

.mfa-secret-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mfa-secret-code {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
  color: var(--accent-gold);
  user-select: all;
}

.mfa-verify-section {
  margin-top: 20px;
}

.mfa-success-box {
  margin-top: 24px;
  padding: 24px;
  background: var(--accent-green-dim);
  border: 1px solid rgba(0, 255, 135, 0.25);
  border-radius: var(--radius-lg);
  text-align: center;
}

.mfa-success-box .fb-success-icon {
  margin: 0 auto 12px;
  width: 56px;
  height: 56px;
}

.mfa-success-box .fb-success-icon svg { width: 28px; height: 28px; }

.mfa-success-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--accent-green);
}

.mfa-success-msg {
  color: var(--text-secondary);
  font-size: 13px;
}

@media (max-width: 520px) {
  .mfa-card-head { flex-direction: column; align-items: flex-start; }
  .mfa-qr-frame img { width: 160px; height: 160px; }
}
