/* Qawafil media — tokens and components from docs/design/screens (نظام لوحات التحكم, navy frame). */
:root {
  --frame: #17283c;
  --brand: #17283c;
  --accent: #826733;       /* small accents only */
  --accent-soft: #d2b28a;  /* sidebar caption, avatar letter */
  --panel: #f4f6fa;
  --surface: #ffffff;
  --field: #f7f9fc;
  --tint: #e8edf3;         /* table header, icon tiles */
  --line: #e2e7ef;
  --ink: #1b2433;
  --muted: #5a6578;
  --on-frame: #dbe4f0;
  --success: #1f7a52;  --success-tint: #e3f3ea;
  --warning: #8a3a6e;  --warning-tint: #f6e8f2; /* violet, never amber */
  --info: #1f4f8f;     --info-tint: #e6eef9;
  --neutral: #5a6578;  --neutral-tint: #eef1f5;
  --danger: #b23a3a;   --danger-tint: #f8e6e6;
  --shadow-card: 0 1px 2px rgba(23,40,60,.04), 0 6px 18px rgba(23,40,60,.05);
  --font-title: 'Readex Pro', 'IBM Plex Sans Arabic', sans-serif;
  --font-text: 'IBM Plex Sans Arabic', sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--frame); font-family: var(--font-text); color: var(--ink); }
a { color: var(--brand); }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-title); font-variant-numeric: tabular-nums; }

/* Shell: frame, sidebar on the right, floating panel */
.lw-shell { min-height: 100vh; padding: 16px; display: flex; flex-wrap: wrap; gap: 16px; }
.lw-nav { flex: 1 1 220px; max-width: 240px; min-width: 200px; display: flex; flex-direction: column; gap: 6px; padding: 14px 0; }
.lw-brand { font-family: var(--font-title); font-weight: 600; font-size: 20px; color: #fff; margin: 4px 18px 22px 0; text-decoration: none; }
.lw-nav-caption { font-size: 12px; color: var(--accent-soft); padding: 0 18px; margin-bottom: 4px; }
.lw-nav-link { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 18px; border-radius: 999px; color: var(--on-frame); font-size: 15px; text-decoration: none; background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%; }
.lw-nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.lw-nav-link[aria-current="page"] { /* the white «لسان» joined to the panel */
  background: var(--surface); color: var(--brand); font-weight: 600; margin-left: -16px; border-radius: 0 999px 999px 0;
}
.lw-nav-link[aria-current="page"] svg { stroke: var(--accent); }
.lw-nav-spacer { flex: 1; }
.lw-panel { flex: 999 1 640px; min-width: 0; background: var(--panel); border-radius: 28px; padding: 28px; }

/* Top bar */
.lw-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.lw-top h1 { margin: 0; font-family: var(--font-title); font-weight: 600; font-size: 26px; }
.lw-top p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.lw-top-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lw-user { display: flex; align-items: center; gap: 10px; }
.lw-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--frame); color: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-family: var(--font-title); font-weight: 600; }
.lw-user-name { font-size: 14px; font-weight: 600; }
.lw-user-role { font-size: 12px; color: var(--muted); }

/* Cards */
.lw-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-card); padding: 20px; }
.lw-card-title { margin: 0 0 14px; font-family: var(--font-title); font-weight: 600; font-size: 17px; }
.lw-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.lw-kpi-head { display: flex; align-items: center; justify-content: space-between; }
.lw-kpi-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--tint); display: flex; align-items: center; justify-content: center; }
.lw-kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 500; color: var(--success); }
.lw-kpi-delta.is-down { color: var(--warning); }
.lw-kpi-value { font-family: var(--font-title); font-weight: 600; font-size: 32px; margin-top: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.lw-kpi-label { font-size: 14px; color: var(--muted); margin-top: 2px; }

/* Welcome banner */
.lw-welcome { position: relative; overflow: hidden; border-radius: 20px; background: var(--frame); color: #fff; padding: 28px 32px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.lw-welcome h2 { margin: 0; font-family: var(--font-title); font-weight: 600; font-size: 26px; }
.lw-welcome p { margin: 8px 0 0; font-size: 15px; line-height: 1.8; color: var(--on-frame); max-width: 620px; }
.lw-welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.lw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.lw-btn-primary { background: var(--brand); color: #fff; }
.lw-btn-primary:hover { color: #fff; background: #22374f; }
.lw-btn-accent { background: var(--accent); color: #fff; }
.lw-btn-accent:hover { color: #fff; }
.lw-btn-ghost { border-color: rgba(255,255,255,.4); color: #fff; background: none; }
.lw-btn-ghost:hover { color: #fff; background: rgba(255,255,255,.08); }
.lw-btn-line { border-color: var(--line); background: var(--surface); color: var(--ink); }

/* Status badge: icon + colour + word */
.lw-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.lw-badge.is-success { background: var(--success-tint); color: var(--success); }
.lw-badge.is-warning { background: var(--warning-tint); color: var(--warning); }
.lw-badge.is-info { background: var(--info-tint); color: var(--info); }
.lw-badge.is-neutral { background: var(--neutral-tint); color: var(--neutral); }
.lw-badge.is-danger { background: var(--danger-tint); color: var(--danger); }

/* Empty state */
.lw-empty { text-align: center; padding: 48px 20px; }
.lw-empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--tint); display: flex; align-items: center; justify-content: center; }
.lw-empty h3 { margin: 0; font-family: var(--font-title); font-weight: 600; font-size: 18px; }
.lw-empty p { margin: 8px auto 18px; color: var(--muted); font-size: 14px; max-width: 420px; line-height: 1.8; }

/* Forms (auth pages) */
.lw-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lw-auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 28px; padding: 32px; }
.lw-auth-card h1 { margin: 0 0 6px; font-family: var(--font-title); font-weight: 600; font-size: 24px; }
.lw-auth-card .lead { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.lw-field { display: block; margin-bottom: 16px; }
.lw-field span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.lw-input { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); font: inherit; font-size: 15px; color: var(--ink); }
.lw-input:focus { outline: 2px solid var(--brand); outline-offset: 0; background: var(--surface); }
.lw-input.is-code { letter-spacing: .3em; text-align: center; font-family: var(--font-title); direction: ltr; }
.lw-check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 20px; }
.lw-error { background: var(--danger-tint); color: var(--danger); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.lw-note { background: var(--info-tint); color: var(--info); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.lw-qr { display: flex; justify-content: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px; }
.lw-codes { direction: ltr; font-family: monospace; font-size: 14px; background: var(--field); border-radius: 12px; padding: 12px 16px; columns: 2; margin: 0 0 16px; list-style: none; }
.lw-link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--brand); text-decoration: underline; cursor: pointer; }
.w-full { width: 100%; }

/* Phones: the menu becomes a horizontal strip */
@media (max-width: 760px) {
  .lw-shell { padding: 10px; gap: 10px; }
  .lw-nav { max-width: none; flex-basis: 100%; flex-direction: row; overflow-x: auto; padding: 4px 0; gap: 4px; }
  .lw-brand, .lw-nav-caption, .lw-nav-spacer { display: none; }
  .lw-nav-link { width: auto; white-space: nowrap; height: 40px; padding: 0 14px; font-size: 14px; }
  .lw-nav-link[aria-current="page"] { margin-left: 0; border-radius: 999px; }
  .lw-panel { padding: 18px; border-radius: 20px; }
  .lw-welcome { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Connections screen and shared table */
.lw-gap { margin-bottom: 24px; }
.lw-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.lw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lw-facts { margin: 18px 0; display: grid; gap: 10px; }
.lw-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.lw-facts dt { color: var(--muted); }
.lw-facts dd { margin: 0; font-weight: 500; }
.lw-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lw-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.lw-muted { color: var(--muted); font-size: 13px; margin: 0; }
.lw-table-wrap { overflow-x: auto; }
.lw-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lw-table thead { background: var(--tint); }
.lw-table th { text-align: right; padding: 12px 14px; font-weight: 500; color: var(--muted); font-size: 13px; white-space: nowrap; }
.lw-table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }

/* Screens: home, posts, rating, schedule */
.lw-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.lw-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lw-chip.is-facebook { background: var(--info-tint); color: var(--info); }
.lw-chip.is-tiktok { background: #eceef2; color: var(--ink); }
.lw-thumb { border-radius: 10px; object-fit: cover; display: block; flex: none; background: var(--tint); }
.lw-thumb.is-empty { display: flex; align-items: center; justify-content: center; }
.lw-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.lw-card-head h2 { margin: 0; font-family: var(--font-title); font-weight: 600; font-size: 18px; }
.lw-card-head > a { font-size: 13px; }
.lw-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.lw-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lw-legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.lw-legend-dot.is-facebook, .lw-bar.is-facebook { background: var(--brand); }
.lw-legend-dot.is-tiktok, .lw-bar.is-tiktok { background: var(--accent-soft); }
.lw-legend-dot.is-avg { background: #9fb0c4; }
.lw-bars { display: flex; gap: 10px; align-items: flex-end; }
.lw-bars-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.lw-bars-track { height: 200px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.lw-bar { width: 30%; max-width: 22px; border-radius: 6px 6px 2px 2px; }
.lw-bars-label { font-size: 12px; color: var(--muted); }
.lw-split { display: flex; gap: 16px; flex-wrap: wrap; }
.lw-split-main { flex: 2 1 520px; min-width: 0; }
.lw-split-side { flex: 1 1 300px; min-width: 0; }
.lw-list { list-style: none; margin: 0; padding: 0; }
.lw-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lw-datebox { width: 54px; flex: none; text-align: center; border-radius: 12px; background: var(--tint); padding: 6px 0; font-size: 11px; color: var(--muted); }
.lw-datebox .num { font-weight: 600; font-size: 18px; color: var(--brand); }
.lw-list-body { min-width: 0; flex: 1; }
.lw-list-title { font-size: 14px; font-weight: 600; }
.lw-list-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.lw-post { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 500; }
.lw-post-title, .lw-post-type { display: block; }
.lw-post-type { font-size: 12px; color: var(--muted); font-weight: 400; }
.lw-muted-cell { color: var(--muted); white-space: nowrap; }
.lw-table td.num { text-align: right; }
.lw-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lw-segment { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.lw-segment a { padding: 6px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); text-decoration: none; }
.lw-segment a[aria-current="true"] { background: var(--brand); color: #fff; }
.lw-select { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.lw-select select, .lw-comments select { height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 14px; color: var(--ink); padding: 0 10px; }
.lw-push { margin-inline-start: auto; }
.lw-platform-sum { display: grid; gap: 10px; }
.lw-platform-sum .lw-chip { justify-self: start; }
.lw-sum-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.lw-sum-row strong { color: var(--ink); }
.lw-pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 16px; font-size: 14px; }
.lw-pager .is-off { color: var(--muted); }
.lw-foot { margin: 14px 0 0; font-size: 13px; }
.lw-post-head { display: flex; gap: 16px; align-items: flex-start; }
.lw-caption { margin: 10px 0; line-height: 1.8; font-size: 15px; }
.lw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 18px 0; }
.lw-stats div { background: var(--panel); border-radius: 12px; padding: 12px; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.lw-stats strong { font-size: 20px; color: var(--ink); font-family: var(--font-title); }
.lw-score { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.lw-score-num { font-size: 48px; font-weight: 600; color: var(--brand); }
.lw-score-num small { font-size: 16px; color: var(--muted); }
.lw-compare { margin-bottom: 14px; font-size: 14px; }
.lw-meter { height: 8px; border-radius: 999px; background: var(--neutral-tint); margin-top: 6px; overflow: hidden; }
.lw-meter span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.lw-meter.is-avg span { background: #9fb0c4; }
.lw-heat { display: grid; gap: 4px; overflow-x: auto; }
.lw-heat-row { display: grid; grid-template-columns: 56px repeat(6, minmax(32px, 1fr)); gap: 4px; align-items: center; }
.lw-heat-h, .lw-heat-day { font-size: 12px; color: var(--muted); text-align: center; }
.lw-heat-cell { height: 26px; border-radius: 6px; background: var(--neutral-tint); }
.lw-heat-cell.is-1 { background: rgba(23,40,60,.2); } .lw-heat-cell.is-2 { background: rgba(23,40,60,.4); }
.lw-heat-cell.is-3 { background: rgba(23,40,60,.65); } .lw-heat-cell.is-4 { background: rgba(23,40,60,.9); }
.lw-cats { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.lw-cats li { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--panel); font-size: 14px; }
.lw-comments summary { cursor: pointer; color: var(--brand); font-size: 14px; }
.lw-comments ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.lw-comments li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.lw-comments p { margin: 0 0 8px; font-size: 14px; line-height: 1.7; }
.lw-rank { list-style: none; margin: 0; padding: 0; }
.lw-rank li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lw-rank li a { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; }
.lw-rank-n { width: 28px; height: 28px; border-radius: 8px; background: var(--tint); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.lw-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lw-tips li { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--panel); font-size: 14px; }
.lw-tips span { color: var(--muted); }
.lw-week { display: grid; grid-template-columns: repeat(7, minmax(100px, 1fr)); gap: 10px; overflow-x: auto; }
.lw-day { border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 140px; display: flex; flex-direction: column; gap: 8px; }
.lw-day.is-today { border-color: var(--brand); }
.lw-day-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.lw-day-empty { color: var(--muted); font-size: 12px; margin-top: auto; }
.lw-slot { display: grid; gap: 4px; padding: 8px; border-radius: 10px; background: var(--info-tint); font-size: 13px; }
.lw-slot.is-draft { background: var(--neutral-tint); }
.lw-slot-title { font-weight: 600; }
.lw-where { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 8px; justify-items: start; }
.lw-where .lw-row { width: 100%; }
.lw-where-tool { font-weight: 600; }
.lw-draft { flex-wrap: wrap; }
.lw-inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.lw-inline-form .lw-input { width: auto; height: 40px; }
.lw-draft-form { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.lw-draft-form h3 { margin: 0 0 12px; font-family: var(--font-title); font-size: 16px; }
.lw-post > span { min-width: 160px; }
.lw-legal { max-width: 760px; line-height: 1.9; }
.lw-legal h2 { font-family: var(--font-title); font-size: 18px; margin: 24px 0 8px; }
.lw-legal ul { padding-inline-start: 20px; }
.lw-legal-en { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.lw-legal-links { margin: 18px 0 0; text-align: center; font-size: 13px; }
.lw-narrow { max-width: 420px; }
