/* Mafaza Social Hub — dashboard styles. Dark is the default; [data-theme="light"] switches. */
:root {
  --bg: #0F1012; --bg-glow: #1E1A13;
  --panel: #16171A; --panel-2: #1C1D21; --inset: #111214;
  --line: #26272B; --line-2: #34353B;
  --text: #EDE9E1; --soft: #BDB9B0; --muted: #A39F97; --faint: #8B877F;
  --gold: #E7C98A; --gold-hi: #F3DDA6; --gold-lo: #C9A257; --gold-ink: #1D170B;
  --gold-tint: #1E1B15; --gold-line: #4B3F25; --hero-a: #221C11; --hero-b: #17181B;
  --ok: #7CCB9B; --warn: #E3C16F; --bad: #EBA59C;
  --bar: #8E7A4E; --track: #232427; --shadow: 0 12px 30px rgba(201, 162, 87, .18);
  --tile-a: #2B2416; --tile-b: #16171A;
}
:root[data-theme="light"] {
  --bg: #F4F1EA; --bg-glow: #FBF3DF;
  --panel: #FFFFFF; --panel-2: #F8F5EF; --inset: #F3EFE7;
  --line: #E6E0D5; --line-2: #D3CCBF;
  --text: #1B1A17; --soft: #45423D; --muted: #6C6963; --faint: #7B776F;
  --gold: #7A5C18; --gold-hi: #6B5013; --gold-lo: #B38A36; --gold-ink: #1D170B;
  --gold-tint: #FBF3DF; --gold-line: #E3CF9C; --hero-a: #FBF1D9; --hero-b: #FFFFFF;
  --ok: #1E6B3F; --warn: #8A691C; --bad: #A32A1F;
  --bar: #CDB582; --track: #ECE7DD; --shadow: 0 10px 26px rgba(158, 120, 33, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, var(--bg-glow) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  font-size: 15px; line-height: 1.7; min-height: 100vh;
}
a { color: var(--gold); }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.num, .ltr { font-family: "IBM Plex Sans", sans-serif; direction: ltr; unicode-bidi: isolate; }
h1 { margin: 0; font-size: 30px; line-height: 1.35; font-weight: 700; }
h2 { margin: 0; font-size: 19px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); }
.kicker { font-size: 13px; color: var(--gold); }
.hidden { display: none !important; }

/* shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 0 256px; max-width: 256px; padding: 24px 16px; display: flex; flex-direction: column; gap: 26px; border-left: 1px solid var(--line); }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 36px 48px; display: flex; flex-direction: column; gap: 26px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.tile { width: 44px; height: 44px; flex: none; border-radius: 14px; background: linear-gradient(145deg, var(--tile-a), var(--tile-b)); border: 1px solid #4B3F25; display: grid; place-items: center; }
.tile img { width: 26px; height: 24px; }
.brand b { font-family: "IBM Plex Sans", sans-serif; font-size: 15px; font-weight: 600; display: block; line-height: 1.35; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-group > span { padding: 0 12px 6px; font-size: 13px; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 14px; text-decoration: none; color: var(--soft); border: 1px solid transparent; }
.nav a:hover { background: var(--panel); }
.nav a[aria-current="page"] { color: var(--gold-hi); font-weight: 600; background: var(--gold-tint); border-color: var(--gold-line); }
.nav a .count { margin-inline-start: auto; min-width: 24px; padding: 0 8px; border-radius: 99px; background: var(--gold-lo); color: var(--gold-ink); font-size: 12px; font-weight: 700; text-align: center; font-family: "IBM Plex Sans", sans-serif; }
.me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #F3DDA6, #C9A257); color: #1D170B; font-weight: 700; display: grid; place-items: center; }
.avatar.sm { width: 24px; height: 24px; font-size: 12px; background: var(--gold-tint); color: var(--gold); border: 1px solid var(--gold-line); }
.me .who { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; flex: 1; }
.me .who b { font-size: 14px; font-weight: 600; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--soft); cursor: pointer; display: grid; place-items: center; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 11px; background: transparent; }

/* building blocks */
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 22px; align-items: stretch; }
.grow { flex: 999 1 520px; min-width: 0; }
.side { flex: 1 1 300px; max-width: 400px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { padding: 28px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.card.hero { background: linear-gradient(120deg, var(--hero-a) 0%, var(--hero-b) 62%); border-color: var(--gold-line); }
.kpi { padding: 26px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.kpi .label { font-size: 14px; color: var(--muted); }
.kpi .value { font-family: "IBM Plex Sans", sans-serif; font-size: 40px; font-weight: 600; line-height: 1.2; }
.kpi .value small { font-size: 18px; font-weight: 500; color: var(--muted); font-family: "IBM Plex Sans Arabic", sans-serif; }
.kpi.gold { background: linear-gradient(160deg, var(--hero-a) 0%, var(--panel) 70%); border-color: var(--gold-line); }
.kpi.gold .value { color: var(--gold-hi); }
.note { padding: 14px 18px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; color: var(--soft); }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-gold { color: var(--gold-hi); } .t-muted { color: var(--muted); }
.empty { padding: 36px 20px; border-radius: 18px; border: 1px dashed var(--line-2); text-align: center; color: var(--muted); font-size: 14px; }

/* buttons + fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 24px; border-radius: 16px; font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid var(--gold-line); background: transparent; color: var(--gold-hi); text-decoration: none; }
.btn.primary { border: none; background: linear-gradient(135deg, #F3DDA6 0%, #C9A257 100%); color: #1D170B; font-weight: 700; box-shadow: var(--shadow); }
.btn.quiet { border-color: var(--line-2); color: var(--soft); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
label.f { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.input, textarea.input, select.input { width: 100%; min-height: 52px; background: var(--inset); color: var(--text); border: 1px solid var(--line-2); border-radius: 16px; padding: 0 18px; }
textarea.input { padding: 16px 18px; line-height: 1.8; resize: vertical; min-height: 140px; }
.seg { display: flex; padding: 4px; border-radius: 14px; background: var(--inset); border: 1px solid var(--line); }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 10px; border: none; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--text); font-weight: 600; }
.types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.types button { min-height: 84px; border-radius: 18px; background: var(--panel-2); border: 1px solid var(--line); color: var(--soft); font-size: 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.types button[aria-pressed="true"] { background: var(--gold-tint); border-color: var(--gold-lo); color: var(--gold-hi); font-weight: 600; }
.drop { padding: 32px 24px; border-radius: 20px; background: var(--inset); border: 1.5px dashed var(--line-2); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--gold-lo); background: var(--gold-tint); }
.choice { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
.choice:has(input:checked) { background: var(--gold-tint); border-color: var(--gold-line); }
.choice input { width: 18px; height: 18px; accent-color: #C9A257; }
.choice .end { margin-inline-start: auto; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding-top: 24px; border-top: 1px solid var(--line); }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); font-size: 13px; }

/* data */
.bars { display: flex; flex-direction: column; gap: 18px; }
.bar-row { display: flex; flex-direction: column; gap: 8px; }
.bar-row .top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.bar-row .top b { font-weight: 600; }
.bar-row .top .v { font-family: "IBM Plex Sans", sans-serif; font-size: 18px; font-weight: 600; }
.track { height: 8px; border-radius: 99px; background: var(--track); }
.track i { display: block; height: 8px; border-radius: 99px; background: var(--bar); }
.track i.best { background: linear-gradient(90deg, #C9A257, #F3DDA6); }
.chart { position: relative; direction: ltr; }
.chart svg { display: block; width: 100%; height: 260px; }
.chart .tip { position: absolute; top: 2px; transform: translate(14px, 0); padding: 8px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 13px; white-space: nowrap; direction: rtl; }
.axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); direction: ltr; }
.cols { display: grid; gap: 12px; align-items: end; height: 150px; }
.cols > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.cols i { display: block; width: 100%; border-radius: 12px; background: var(--line-2); }
.cols i.best { background: linear-gradient(180deg, #F3DDA6, #C9A257); }
table.t { width: 100%; min-width: 620px; border-collapse: separate; border-spacing: 0 8px; font-size: 14px; }
table.t th { text-align: start; font-weight: 500; font-size: 13px; color: var(--muted); padding: 0 16px 4px; }
table.t td { padding: 14px 16px; background: var(--panel-2); }
table.t td:first-child { border-radius: 0 16px 16px 0; } table.t td:last-child { border-radius: 16px 0 0 16px; }
table.t tr.best td { border-top: 1px solid var(--gold-line); border-bottom: 1px solid var(--gold-line); }
.scroll-x { overflow-x: auto; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line-2); color: var(--soft); white-space: nowrap; }
.tag.gold { border-color: var(--gold-line); color: var(--gold-hi); background: var(--gold-tint); }
.tag.ok { border-color: transparent; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.bad { border-color: transparent; background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.tag.warn { border-color: transparent; background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 16px; min-width: 1100px; }
.kanban.four { grid-template-columns: repeat(4, minmax(210px, 1fr)); min-width: 900px; }
.lane { padding: 14px; border-radius: 20px; background: var(--inset); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; min-height: 160px; }
.lane.over { border-color: var(--gold-lo); }
.lane header { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; font-size: 14px; font-weight: 600; }
.lead { padding: 16px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; cursor: grab; }
.lead .phone { font-family: "IBM Plex Sans", sans-serif; font-size: 16px; font-weight: 600; direction: ltr; text-align: end; }
.lead .foot { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.lead select { background: transparent; border: none; color: var(--soft); font-size: 13px; cursor: pointer; }

/* connections map */
.map { position: relative; height: 270px; direction: ltr; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map .hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 26px; background: linear-gradient(145deg, #2E2616, #17181B); border: 1px solid #5A4C2C; box-shadow: 0 0 0 10px rgba(201, 162, 87, .07); display: grid; place-items: center; }
.map .hub img { width: 46px; height: 43px; }
.map .node { position: absolute; transform: translate(-50%, -50%); padding: 9px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--gold-line); font-size: 13px; white-space: nowrap; direction: rtl; }
.map .node.off { border-style: dashed; border-color: var(--line-2); }
.team { display: flex; flex-direction: column; gap: 4px; }
.team > div { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 10px; border-radius: 14px; }
.team > div.lead-row { background: var(--panel-2); }
.team b { font-size: 15px; font-weight: 600; display: block; line-height: 1.4; }

/* login */
.login { display: flex; flex-wrap: wrap; gap: 24px; min-height: 100vh; padding: 24px; }
.login .pitch { flex: 999 1 520px; min-width: 0; padding: 56px 64px; border-radius: 32px; background: linear-gradient(150deg, #221C11 0%, #15161A 62%); border: 1px solid #3F3521; color: #EDE9E1; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; position: relative; overflow: hidden; }
.login .pitch .motif { position: absolute; left: 64px; bottom: -20px; width: 300px; height: 525px; opacity: .16; }
.login .pitch h1 { font-size: 50px; line-height: 1.3; }
.login .pitch p { margin: 0; font-size: 18px; line-height: 1.8; color: #BDB9B0; }
.login .form { flex: 1 1 420px; max-width: 520px; padding: 56px 48px; border-radius: 32px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 26px; }
.login form { display: flex; flex-direction: column; gap: 20px; }
.msg { padding: 12px 16px; border-radius: 14px; font-size: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.msg.bad { border-color: var(--bad); color: var(--bad); } .msg.ok { border-color: var(--ok); color: var(--ok); }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 24px; z-index: 50; }
.modal { width: min(520px, 100%); padding: 30px; border-radius: 24px; background: var(--panel); border: 1px solid var(--gold-line); display: flex; flex-direction: column; gap: 18px; }
.toast { position: fixed; bottom: 24px; left: 24px; max-width: 420px; padding: 14px 18px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--gold-line); z-index: 60; font-size: 14px; }
.toast.bad { border-color: var(--bad); }
pre.out { margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--inset); border: 1px solid var(--line); font-family: "IBM Plex Sans", monospace; font-size: 13px; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }

@media (max-width: 860px) {
  .nav { max-width: none; flex-basis: 100%; border-left: none; border-bottom: 1px solid var(--line); }
  .me { margin-top: 0; }
  .main { padding: 20px 16px 40px; }
  .types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login .pitch { padding: 36px 28px; } .login .pitch h1 { font-size: 34px; } .login .form { padding: 36px 24px; max-width: none; }
}
