:root {
  --bg: #080808;
  --surface: #0E0E0E;
  --surface2: #141414;
  --gold: #C9A84C;
  --ivory: #F5F0E8;
  --silver: #BBBBBB;
  --grey: #666;
  --border: rgba(201, 168, 76, 0.12);
  --red: #E05252;
  --green: #4CAF82;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ivory);
  direction: rtl;
}

.env-badge {
  position: fixed;
  top: 8px;
  left: 8px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 999;
  font-weight: 700;
}
.env-badge.staging { background: var(--red); color: #fff; }
.env-badge.production { background: var(--green); color: #fff; }

.login-card {
  max-width: 360px;
  margin: 20vh auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.login-card h1 {
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 1.2rem;
}
.login-card p {
  color: var(--silver);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.login-card input[type=password],
.login-card input[type=email] {
  width: 100%;
  padding: 10px 12px;
  margin: 8px 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--ivory);
  border-radius: 6px;
  font-family: inherit;
}
.login-card button {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background: var(--gold);
  color: #000;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}
.login-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.login-card .forgot {
  margin-top: 16px;
  display: block;
  color: var(--silver);
  font-size: 0.85rem;
  text-decoration: none;
}
.login-card .forgot:hover { color: var(--gold); }

.error { color: var(--red); margin-top: 12px; font-size: 0.9rem; }
.success { color: var(--green); margin-top: 12px; font-size: 0.9rem; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 16px 0;
}
.sidebar a {
  display: block;
  padding: 10px 20px;
  color: var(--silver);
  text-decoration: none;
  font-size: 0.95rem;
}
.sidebar a.active, .sidebar a:hover {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.06);
}
.content {
  padding: 24px;
  overflow-y: auto;
}
.content h2 {
  color: var(--gold);
  margin-bottom: 12px;
}

/* ───── tables ───── */
.data-table { width:100%; border-collapse:collapse; margin-top:16px; }
.data-table th, .data-table td { padding:8px 12px; border-bottom:1px solid var(--border); text-align:right; }
.data-table th { color:var(--gold); font-weight:700; font-size:.85rem; text-transform:uppercase; letter-spacing:0.04em; }
.data-table tr:hover { background:rgba(201,168,76,0.04); }

/* ───── forms ───── */
.form-field { display:flex; flex-direction:column; margin:12px 0; }
.form-field label { color:var(--silver); font-size:.85rem; margin-bottom:4px; }
.form-field input, .form-field select, .form-field textarea {
  background:var(--surface2); color:var(--ivory);
  border:1px solid var(--border); border-radius:6px; padding:8px 10px; font:inherit;
}
.form-field textarea { min-height:120px; resize:vertical; }
.btn-primary { background:var(--gold); color:#000; border:0; padding:8px 16px; border-radius:6px; cursor:pointer; font-weight:700; font-family:inherit; }
.btn-primary:disabled { opacity:.5; cursor:not-allowed; }
.btn-danger { background:transparent; color:var(--red); border:1px solid var(--red); padding:8px 16px; border-radius:6px; cursor:pointer; font-family:inherit; }
.btn-ghost { background:transparent; color:var(--silver); border:1px solid var(--border); padding:6px 12px; border-radius:6px; cursor:pointer; font-family:inherit; }

/* ───── modal ───── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.7); z-index:1000;
  display:flex; align-items:center; justify-content:center; padding:16px;
}
.modal-card {
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:24px; max-width:560px; width:100%; max-height:80vh; overflow-y:auto;
}
.modal-card h3 { color:var(--gold); margin-bottom:16px; }
.preview-table { width:100%; border-collapse:collapse; margin:12px 0; }
.preview-table th { color:var(--silver); text-align:right; padding:6px 8px; width:140px; font-weight:400; }
.preview-table td { padding:6px 8px; color:var(--ivory); }
.modal-actions { display:flex; gap:12px; justify-content:flex-end; margin-top:20px; }
.modal-msg { margin-top:10px; color:var(--silver); font-size:.85rem; min-height:1.2em; }

.email-sample { background:var(--surface2); padding:12px; border-radius:6px; margin-top:8px; }
.email-sample .subj { color:var(--gold); margin:4px 0; font-weight:700; }
.email-sample pre { color:var(--ivory); white-space:pre-wrap; font:inherit; font-size:.9rem; }

/* ───── KPI cards ───── */
.kpi-row { display:grid; gap:16px; margin-bottom:20px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:20px; }
.kpi-label { color:var(--silver); font-size:.85rem; }
.kpi-value { color:var(--gold); font-size:1.8rem; font-weight:700; margin-top:6px; }
.progress { height:8px; background:var(--surface2); border-radius:4px; overflow:hidden; margin-top:8px; }
.progress > div { height:100%; background:var(--gold); }

/* ───── toggle ───── */
.toggle input { vertical-align:middle; margin-left:8px; }
.toggle span { color:var(--silver); font-size:.85rem; }
.toggle input:checked + span { color:var(--green); }

/* ───── status badges ───── */
.status-active { color:var(--green); font-weight:700; }
.status-inactive { color:var(--grey); }
.status-expired { color:var(--red); }
.status-used-up { color:var(--red); font-style:italic; }

/* ───── linkbio list ───── */
/* ───── linkbio admin rows (Linear/Notion-style) ───── */
.linkbio-list { list-style:none; padding:0; margin:0; }

.lb-row {
  display:grid;
  grid-template-columns: 28px 40px 1fr auto;
  gap:14px;
  align-items:center;
  padding:12px 16px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:10px;
  margin-bottom:6px;
  transition: border-color .15s, background .15s;
}
.lb-row:hover { border-color: rgba(201,168,76,0.28); background: rgba(201,168,76,0.025); }
.lb-row.is-off { opacity:.55; }
.lb-row.is-off:hover { opacity:.85; }

/* drag handle */
.lb-drag {
  display:flex; align-items:center; justify-content:center;
  width:28px; height:28px;
  background:transparent; border:0; border-radius:6px;
  color:var(--grey); cursor:grab;
  opacity:0; transition: opacity .15s, background .15s, color .15s;
}
.lb-row:hover .lb-drag { opacity:1; }
.lb-drag:hover { background:rgba(255,255,255,0.04); color:var(--silver); }
.lb-drag:active { cursor:grabbing; }

/* icon badge */
.lb-icon {
  display:flex; align-items:center; justify-content:center;
  width:40px; height:40px;
  background: rgba(201,168,76,0.08);
  border:1px solid rgba(201,168,76,0.18);
  border-radius:10px;
  color:var(--gold);
  flex-shrink:0;
}
.lb-row:hover .lb-icon { background: rgba(201,168,76,0.12); border-color: rgba(201,168,76,0.32); }
.lb-icon .row-icon-emoji { font-size:18px; line-height:1; }

/* main: title + sub */
.lb-main { min-width:0; overflow:hidden; }
.lb-title {
  color:var(--ivory);
  font-weight:700;
  font-size:.95rem;
  line-height:1.3;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.lb-sub {
  display:flex; gap:6px; align-items:center;
  margin-top:2px;
  font-size:.78rem;
  color:var(--grey);
  min-width:0;
}
.lb-sub-en { color:var(--silver); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex-shrink:0; max-width:40%; }
.lb-dot { color:var(--border); flex-shrink:0; }
.lb-url {
  color:var(--grey);
  text-decoration:none;
  direction:ltr;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0;
  flex:1;
}
.lb-url:hover { color:var(--gold); text-decoration:underline; }

/* side actions */
.lb-side {
  display:flex; align-items:center; gap:4px;
  flex-shrink:0;
}
.lb-stat {
  color:var(--grey);
  font-size:.75rem;
  font-variant-numeric: tabular-nums;
  padding:4px 10px;
  border-radius:12px;
  background:rgba(255,255,255,0.03);
  min-width:36px; text-align:center;
}

/* status pill — Linear-style */
.lb-pill {
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px;
  border-radius:12px;
  border:1px solid;
  background:transparent;
  font:inherit;
  font-size:.72rem;
  font-weight:600;
  letter-spacing:.02em;
  cursor:pointer;
  transition: background .15s, border-color .15s;
}
.lb-pill .lb-dot-indicator {
  width:6px; height:6px; border-radius:50%; background:currentColor;
}
.lb-pill.on  { color:#4CAF82; border-color: rgba(76,175,130,0.35); }
.lb-pill.on:hover  { background: rgba(76,175,130,0.10); }
.lb-pill.off { color:var(--grey); border-color: var(--border); }
.lb-pill.off:hover { background: rgba(255,255,255,0.04); color:var(--silver); }

/* icon-only action buttons (edit, delete) */
.lb-ibtn {
  display:flex; align-items:center; justify-content:center;
  width:32px; height:32px;
  background:transparent;
  border:1px solid transparent;
  border-radius:8px;
  color:var(--grey);
  cursor:pointer;
  opacity:0;
  transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.lb-row:hover .lb-ibtn { opacity:1; }
.lb-ibtn:hover { background:rgba(255,255,255,0.05); color:var(--ivory); border-color:var(--border); }
.lb-ibtn.danger:hover { background:rgba(224,82,82,0.10); color:var(--red); border-color: rgba(224,82,82,0.35); }

/* touch-friendly: always show controls on narrow screens */
@media (max-width: 900px) {
  .lb-drag, .lb-ibtn { opacity:1; }
  .lb-row { grid-template-columns: 28px 40px 1fr; }
  .lb-side { grid-column: 1 / -1; justify-content:flex-end; padding-top:4px; border-top:1px solid var(--border); margin-top:4px; }
}

/* ───── Noor widget ───── */
.noor-fab {
  position:fixed; bottom:24px; left:24px; z-index:100;
  background:var(--gold); color:#000; border:0;
  padding:10px 20px; border-radius:999px; font-weight:700; cursor:pointer;
  box-shadow:0 4px 20px rgba(201,168,76,0.3); font-family:inherit;
}
.noor-panel {
  position:fixed; bottom:80px; left:24px; z-index:100;
  width:360px; max-height:70vh; display:flex; flex-direction:column;
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
}
.noor-panel-head { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid var(--border); color:var(--gold); }
.noor-panel #noor-thread { flex:1; overflow-y:auto; padding:10px; font-size:.9rem; }
.noor-q { background:rgba(201,168,76,0.08); color:var(--gold); padding:8px; border-radius:6px; margin-bottom:8px; }
.noor-a { background:var(--surface2); color:var(--ivory); padding:8px; border-radius:6px; margin-bottom:8px; }
.noor-a pre { white-space:pre-wrap; font:inherit; }

/* ───── course cards (Lessons page) ───── */
.course-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; margin-bottom:12px; overflow:hidden; }
.course-card-head {
  display:flex; align-items:center; gap:12px; width:100%;
  background:transparent; border:0; padding:14px 18px;
  color:var(--ivory); font:inherit; text-align:right; cursor:pointer;
  transition:background .15s;
}
.course-card-head:hover { background:rgba(201,168,76,0.04); }
.course-card-title { flex:1; color:var(--gold); font-weight:700; font-size:1rem; }
.course-card-meta { color:var(--silver); font-size:.85rem; }
.course-card-caret { color:var(--silver); width:16px; }
.course-card-body { padding:0 18px 16px 18px; border-top:1px solid var(--border); }

/* ───── email html preview iframe ───── */
.email-html-preview { width:100%; min-height:240px; max-height:400px; border:0; border-radius:6px; background:#0E0E0E; }

