@import url("/shared/tokens.css?v=tl25up");

/* ══════════════════════════════════════════════════════════════════════
   إدارة الدعوات — the organiser's console.

   Same night-ink and brass as the gate, different job: the gate is one huge
   answer read at arm's length in the dark, this is a dense list read at a desk.
   So the type scale drops, the rows tighten, and the verdict colours shrink to
   a chip — present for scanning down a column, never shouting.
   ══════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink-900);
  color: var(--parchment);
  font-family: var(--font-ui);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ─────────────────────────────  login  ───────────────────────────── */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(120% 60% at 50% -10%, rgba(201,116,138,.16), transparent 60%), var(--ink-900);
}

.login__card {
  width: 100%; max-width: 380px;
  background: var(--ink-850);
  border: 1px solid var(--ink-700);
  border-radius: 20px;
  padding: 30px 24px 24px;
  box-shadow: var(--shadow-lg);
}

.eyebrow { margin: 0 0 10px; font-size: 11px; letter-spacing: .22em; color: var(--brass); text-transform: uppercase; }
.login h1 { margin: 0 0 8px; font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.login__sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login__foot { margin: 20px 0 0; text-align: center; font-size: 13px; }

/* ─────────────────────────────  fields  ───────────────────────────── */

.field { display: block; margin-bottom: 14px; }
.inline-form .field, .form-row .field { margin-bottom: 0; }
.field__label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.field__hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted-dim); }

.field__input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius-sm);
  color: var(--parchment);
  font: inherit;
  transition: border-color .15s ease;
}

.field__input:focus { border-color: var(--brass); outline: none; }
.field__input--pin { font-family: var(--font-mono); letter-spacing: .3em; }
.field__input--area { min-height: 84px; padding: 11px 13px; line-height: 1.6; resize: vertical; }
.field__input--color { width: 52px; padding: 4px; cursor: pointer; }
select.field__input, select { appearance: none; padding-inline-end: 30px; }

.form-error {
  margin: 0 0 12px; padding: 10px 13px;
  background: #FDEAEE; border: 1px solid rgba(208,24,64,.35);
  border-radius: var(--radius-sm); color: #8C0F2B; font-size: 14px; line-height: 1.5;
}

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check--row { display: flex; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--brass); flex: none; }

/* ─────────────────────────────  buttons  ───────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; color: var(--parchment);
  background: var(--ink-750); cursor: pointer;
  transition: transform .1s ease, opacity .15s ease;
}

.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn--primary { background: var(--brass); border-color: var(--brass); color: #FFFFFF; }
.btn--ghost { background: transparent; border-color: var(--ink-600); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.btn--danger { background: transparent; border-color: rgba(208,24,64,.45); color: var(--red); }
.btn--danger:hover { background: #FDEAEE; }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  background: transparent; border: 0; border-radius: 10px;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--ink-750); color: var(--parchment); }

/* ─────────────────────────────  shell  ───────────────────────────── */

.shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  background: var(--ink-850);
  border-bottom: 1px solid var(--ink-700);
  box-shadow: inset 0 -1px 0 rgba(201,162,74,.18);
  position: sticky; top: 0; z-index: 20;
}

.topbar__menu { display: none; }
.topbar__identity { flex: 1; min-width: 0; }
.topbar__identity strong {
  display: block; font-family: var(--font-display); font-size: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__identity span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.body { flex: 1; display: grid; grid-template-columns: 220px 1fr; }

.nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px;
  background: var(--ink-850);
  border-inline-start: 1px solid var(--ink-700);
}

.nav__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 42px; padding: 0 13px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--muted); font: inherit; font-size: 14.5px; text-align: start; cursor: pointer;
}
.nav__item:hover { background: var(--ink-800); color: var(--parchment); }
.nav__item.is-active { background: var(--ink-750); color: var(--parchment); font-weight: 600; }
/* brass marker on the leading edge of the active section */
.nav__item.is-active { box-shadow: inset 3px 0 0 var(--brass); }
.nav__count { font-family: var(--font-mono); font-size: 12px; color: var(--muted-dim); }

.main { padding: 22px; min-width: 0; }
.panel__title { margin: 0 0 6px; font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.panel__hint { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 74ch; }
.panel__hint b { color: var(--parchment); }

/* ─────────────────────────────  stats  ───────────────────────────── */

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px; margin-bottom: 20px;
}

.stat {
  padding: 14px 16px;
  background: var(--ink-850);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius);
}
.stat dt { font-size: 12px; color: var(--muted-dim); }
.stat dd {
  margin: 6px 0 0; font-family: var(--font-mono);
  font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.stat--accent dd { color: var(--brass); }

/* ─────────────────────────────  toolbar  ───────────────────────────── */

.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }

.toolbar__search {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 240px; min-width: 200px;
  padding: 0 13px; min-height: 42px;
  background: var(--ink-800); border: 1px solid var(--ink-700); border-radius: var(--radius-sm);
  color: var(--muted);
}
.toolbar__search input {
  flex: 1; min-width: 0; background: none; border: 0; color: var(--parchment); font: inherit; outline: none;
}

.toolbar select {
  min-height: 42px; padding: 0 13px;
  background: var(--ink-800); border: 1px solid var(--ink-700); border-radius: var(--radius-sm);
  color: var(--parchment); font: inherit; font-size: 14px; cursor: pointer;
}

.toolbar__actions { display: flex; gap: 8px; margin-inline-start: auto; }

/* ─────────────────────────────  table  ───────────────────────────── */

.table-wrap {
  overflow-x: auto;
  background: var(--ink-850);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius);
}

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

.table th {
  position: sticky; top: 0;
  padding: 12px 14px;
  background: var(--ink-800);
  border-bottom: 1px solid var(--ink-700);
  font-size: 12.5px; font-weight: 600; color: var(--muted-dim); text-align: start;
  white-space: nowrap;
}

.table td { padding: 12px 14px; border-bottom: 1px solid var(--ink-800); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--ink-800); }
.table__check { width: 44px; }
.table__check input { width: 18px; height: 18px; accent-color: var(--brass); }

.cell-guest { display: grid; gap: 3px; min-width: 190px; }
.cell-guest strong { font-size: 15px; font-weight: 600; }
.cell-guest span { font-size: 12.5px; color: var(--muted-dim); font-family: var(--font-mono); }

.cell-count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-count b { color: var(--parchment); }
.cell-count span { color: var(--muted-dim); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Verdict as a chip: legible scanning down a column, quiet in bulk. */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.chip[data-state="green"]  { color: #86EFAC; background: rgba(22,163,74,.14);  border-color: rgba(22,163,74,.4); }
.chip[data-state="orange"] { color: #FDBA74; background: rgba(249,115,22,.14); border-color: rgba(249,115,22,.42); }
.chip[data-state="red"]    { color: #FDA4AF; background: rgba(225,29,72,.14);  border-color: rgba(225,29,72,.42); }
.chip[data-state="blue"]   { color: #BFDBFE; background: rgba(37,99,235,.16);  border-color: rgba(37,99,235,.45); }
.chip[data-state="black"]  { color: var(--parchment); background: rgba(245,241,232,.07); border-color: rgba(245,241,232,.35); }

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 7px;
  font-size: 12.5px; background: var(--ink-750); color: var(--muted);
  border-inline-start: 3px solid var(--brass-dim);
}

.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }

.bulkbar {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 11px 15px;
  background: var(--ink-750); border: 1px solid var(--ink-600); border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-md);
}
.bulkbar span:first-child { margin-inline-end: auto; }

/* ─────────────────────────────  cards / lists  ───────────────────────────── */

.cards { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }

.card-row {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--ink-850); border: 1px solid var(--ink-700); border-radius: var(--radius);
}
.card-row__main { flex: 1; min-width: 180px; }
.card-row__main strong { display: block; font-size: 15.5px; }
.card-row__main span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.card-row__swatch { width: 14px; height: 34px; border-radius: 5px; flex: none; }

.inline-form { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.inline-form .field__input { width: auto; min-width: 150px; flex: 0 1 auto; }

.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.table-card {
  padding: 15px 16px;
  background: var(--ink-850); border: 1px solid var(--ink-700); border-radius: var(--radius);
}
.table-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.table-card__name { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.table-card__seats { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.table-card__bar { height: 5px; margin: 11px 0 12px; border-radius: 999px; background: var(--ink-700); overflow: hidden; }
.table-card__fill { height: 100%; background: var(--green); border-radius: 999px; }
.table-card__guests { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.table-card__guests b { color: var(--parchment); font-weight: 500; }

.log { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 7px; }

.log li {
  display: flex; gap: 11px; align-items: baseline; flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--ink-850); border: 1px solid var(--ink-700); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--muted);
}
.log b { color: var(--parchment); font-weight: 600; }
.log time { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-dim); margin-inline-start: auto; }
.log code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--ink-800); padding: 2px 7px; border-radius: 6px; color: var(--muted);
}

/* ─────────────────────────────  import  ───────────────────────────── */

.import-actions { display: flex; gap: 9px; margin-bottom: 12px; align-items: center; }
.import-actions label.btn { cursor: pointer; }
.import__text { font-family: var(--font-mono); font-size: 13px; min-height: 200px; }
.import__bar { display: flex; align-items: center; gap: 14px; margin: 14px 0 20px; }
.import__note { font-size: 13.5px; color: var(--muted); }

.row-bad { background: rgba(225,29,72,.07); }
.row-warn { background: rgba(249,115,22,.06); }
.row-msg { display: block; margin-top: 4px; font-size: 12px; }
.row-msg--bad { color: #FDA4AF; }
.row-msg--warn { color: #FDBA74; }

.print-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ─────────────────────────────  drawer  ───────────────────────────── */

.drawer {
  position: fixed; inset: 0; z-index: 50;
  display: flex; justify-content: flex-start;
  background: rgba(5,7,10,.7);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

/* RTL: the drawer enters from the leading (right) edge */
.drawer__panel {
  width: min(560px, 100%);
  margin-inline-start: auto;
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--ink-850);
  border-inline-start: 1px solid var(--ink-700);
  animation: slide .22s cubic-bezier(.22,.8,.28,1);
}

@keyframes slide { from { transform: translateX(-24px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .drawer__panel { animation: none; } }

.drawer__head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 14px 15px 18px;
  border-bottom: 1px solid var(--ink-700);
}
.drawer__head h2 { flex: 1; margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px 18px 40px; }
.drawer__section { margin: 26px 0 0; font-size: 14px; color: var(--muted); font-weight: 600; }

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

.qr-block {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 20px; padding: 16px;
  background: var(--ink-800); border: 1px solid var(--ink-700); border-radius: var(--radius);
}
.qr-block__img { width: 132px; height: 132px; background: #fff; border-radius: 10px; padding: 7px; }
.qr-block__side { display: grid; gap: 8px; align-content: center; }
.qr-block__label { margin: 0 0 2px; font-size: 13px; color: var(--muted); }

.facts { margin: 0; padding: 0; }
.facts__row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--ink-700); }
.facts__row:last-child { border-bottom: 1px solid var(--ink-700); }
.facts dt { flex: none; width: 116px; color: var(--muted-dim); font-size: 13px; }
.facts dd { margin: 0; font-size: 14.5px; }

.danger-zone { display: grid; gap: 8px; margin-top: 12px; }

/* ─────────────────────────────  send  ───────────────────────────── */

.send { display: grid; gap: 10px; margin-top: 12px; }
.send__link { display: flex; gap: 8px; }
.send__link .field__input { font-size: 12.5px; }
.send__hint { margin: 0; font-size: 12.5px; color: var(--muted-dim); line-height: 1.6; }

.send__local {
  margin: 10px 0 0; padding: 11px 14px;
  background: rgba(249, 115, 22, .1);
  border: 1px solid rgba(249, 115, 22, .4);
  border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.65; color: #FDBA74;
}
.send__local code { font-family: var(--font-mono); font-size: 12px; }

/* WhatsApp keeps its own colour: it is a hand-off to another app, and the
   organiser should recognise where the click lands before pressing it. */
.btn--whatsapp { background: #1FA855; border-color: #1FA855; color: #FFFFFF; }
.btn--whatsapp[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ─────────────────────────────  toast  ───────────────────────────── */

.toast {
  position: fixed; inset-inline: 16px; bottom: 20px; z-index: 60;
  margin: 0 auto; max-width: 440px;
  padding: 13px 16px;
  background: var(--ink-700); border: 1px solid var(--ink-600); border-radius: var(--radius);
  font-size: 14.5px; line-height: 1.55;
  box-shadow: var(--shadow-md);
}
.toast[data-tone="success"] { border-color: rgba(21,136,63,.45);  background: #E9F7EE; color: #10592B; }
.toast[data-tone="warn"]    { border-color: rgba(210,96,11,.45); background: #FDF0E4; color: #7C3A0A; }
.toast[data-tone="error"]   { border-color: rgba(208,24,64,.45);  background: #FDEAEE; color: #8C0F2B; }

/* ─────────────────────────────  narrow screens  ───────────────────────────── */

@media (max-width: 860px) {
  .body { grid-template-columns: 1fr; }
  .topbar__menu { display: grid; }
  .topbar__gate { display: none; }

  .nav {
    display: none;
    border-inline-start: 0;
    border-bottom: 1px solid var(--ink-700);
  }
  .nav.is-open { display: flex; }

  .main { padding: 16px 14px 60px; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar__actions { width: 100%; }
  .toolbar__actions .btn { flex: 1; }
}

/* ─────────────────────────  invitation design picker  ───────────────────── */

.panel__subtitle {
  margin: 30px 0 14px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
  padding-top: 22px;
  border-top: 1px solid var(--ink-700);
}

.themes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px;
}

/* Each card previews the design with its own colours rather than describing it
   in words — the choice is visual, so the control should be too. */
.theme {
  position: relative;
  padding: 0; overflow: hidden;
  background: var(--ink-850);
  border: 1.5px solid var(--ink-700);
  border-radius: 16px;
  text-align: start;
  cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.theme:hover { border-color: var(--brass); }
.theme:active { transform: scale(.99); }
.theme[aria-pressed="true"] { border-color: var(--brass); box-shadow: var(--shadow-md); }

/* A miniature of the real invitation: paper, card, foil name, accent rule. */
.theme__preview {
  height: 116px;
  padding: 14px;
  display: grid; align-content: center; justify-items: center; gap: 7px;
  background: var(--t-paper);
}
.theme__card {
  width: 78%; padding: 12px 10px;
  background: var(--t-card);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 9px;
  display: grid; justify-items: center; gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.theme__name {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  color: var(--t-accent);
}
.theme__rule { width: 46px; height: 2px; background: var(--t-accent); border-radius: 2px; opacity: .8; }
.theme__line { width: 60%; height: 4px; border-radius: 2px; background: var(--t-ink); opacity: .18; }

.theme__meta { padding: 13px 15px 15px; }
.theme__title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.theme__desc { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.theme__occasions { margin: 9px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.theme__occasions span {
  padding: 2px 8px; border-radius: 999px;
  background: var(--ink-800); color: var(--muted-dim); font-size: 11px;
}

.theme__check {
  display: grid; place-items: center;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--brass); color: #fff; font-size: 12px; font-weight: 700;
}

.theme[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.theme[aria-disabled="true"] .theme__desc::after {
  content: " — غير متاح في باقتك";
  color: var(--orange);
}

.design-actions { margin-top: 16px; }

.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px;
}
.form-grid .field--wide { grid-column: 1 / -1; }

/* ─────────────────────────────  design studio  ───────────────────────────── */

.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .studio { grid-template-columns: 1fr; } }

.studio__group {
  margin: 26px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--ink-700);
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
}
.studio__group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.studio__note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
/* Not sticky: at this width the save block overlapped the upload sections
   beneath it, hiding half the studio. */
.studio__save {
  margin-top: 26px; display: grid; gap: 9px;
  padding-top: 20px; border-top: 1px solid var(--ink-700);
}

/* The preview is framed as a phone because that is the only device a guest
   will ever open the invitation on. */
.studio__preview { position: sticky; top: 78px; display: grid; gap: 10px; justify-items: center; }

.phone {
  width: 320px; height: 640px;
  padding: 10px;
  background: var(--parchment);
  border: 1px solid var(--ink-600);
  border-radius: 34px;
  box-shadow: var(--shadow-md);
}
.phone__screen { width: 100%; height: 100%; border: 0; border-radius: 26px; background: #fff; }

/* ── colour controls ── */

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

.swatch {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--ink-850);
  border: 1px solid var(--ink-700);
  border-radius: 12px;
}
.swatch input[type="color"] {
  width: 34px; height: 34px; padding: 2px;
  border: 1px solid var(--ink-600); border-radius: 8px;
  background: none; cursor: pointer; flex: none;
}
.swatch span { font-size: 12.5px; color: var(--muted); }
.swatch b { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted-dim); }

/* ── uploaders ── */

.uploader { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.uploader__side { display: grid; gap: 6px; }
.uploader__pick { cursor: pointer; }

.uploader__preview {
  width: 96px; height: 68px; flex: none;
  background: var(--ink-800) center/cover no-repeat;
  border: 1px dashed var(--ink-600);
  border-radius: 10px;
}
.uploader__preview--round { width: 68px; border-radius: 50%; }

.uploader__file {
  flex: 1; min-width: 0;
  padding: 11px 13px;
  background: var(--ink-800);
  border: 1px dashed var(--ink-600);
  border-radius: 10px;
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.uploader.is-busy { opacity: .55; pointer-events: none; }

.range { display: grid; gap: 6px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.range input { width: 100%; accent-color: var(--brass); }
.range b { color: var(--parchment); font-family: var(--font-mono); }
.range__hint { font-size: 11.5px; color: var(--muted-dim); }

/* ── chips ── */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 15px;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: 999px;
  color: var(--muted);
  font: inherit; font-size: 13.5px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--brass); border-color: var(--brass); color: #fff; font-weight: 600;
}
.chip small { display: block; font-size: 11px; opacity: .8; }

/* ─────────────────────────  options & events  ───────────────────────── */

.event-switch {
  max-width: 220px;
  min-height: 38px; padding: 0 30px 0 12px;
  background: var(--ink-800); border: 1px solid var(--ink-700);
  border-radius: var(--radius-sm); color: var(--parchment);
  font: inherit; font-size: 13.5px; cursor: pointer;
}

.options { display: grid; gap: 10px; max-width: 760px; }

.option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 17px;
  background: var(--ink-850);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius);
}
.option__body { flex: 1; min-width: 0; }
.option__name { font-size: 15px; font-weight: 600; }
.option__hint { margin: 5px 0 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.option__locked { margin: 6px 0 0; font-size: 12.5px; color: var(--orange); }
.option[data-locked="true"] { opacity: .62; }

/* A switch rather than a checkbox: this is a setting that takes effect, not a
   form field waiting to be submitted. */
.switch { position: relative; flex: none; width: 48px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0;
  background: var(--ink-600); border-radius: 999px;
  transition: background-color .18s ease;
  pointer-events: none;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s ease;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(-20px); }
.switch input:disabled + span { opacity: .5; }
.switch input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ─────────────────────  artwork placement editor  ───────────────────── */

.place-editor { margin: 14px 0 18px; }

.place-editor .artwork__frame {
  container-type: inline-size;
  position: relative;
  max-width: 340px;
  border: 1px solid var(--ink-700);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink-800);
  user-select: none;
}
.place-editor .artwork__image { display: block; width: 100%; height: auto; }

.place-editor .artwork__name,
.place-editor .artwork__qr {
  position: absolute;
  transform: translate(-50%, -50%);
  outline: 2px dashed var(--rose);
  outline-offset: 4px;
  cursor: grab;
  touch-action: none;
}
.place-editor .artwork__name {
  width: 80%; text-align: center;
  white-space: pre-wrap; overflow-wrap: break-word;
  font-weight: 700; line-height: 1.3;
}
.place-editor .artwork__qr { display: block; }
.place-editor .artwork__qr svg { display: block; width: 100%; height: auto; }
.place-editor .artwork__qr--quiet { padding: 4%; background: #fff; border-radius: 6px; }

.place-editor__hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted-dim); }

/* ══════════════════════════════════════════════════════════════════
   صفحة متكاملة — editing the couple, the quote and the gallery
   ══════════════════════════════════════════════════════════════════ */

.person-edit {
  margin: 0 0 16px;
  padding: 14px;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: 14px;
  display: grid;
  gap: 10px;
}
.person-edit .uploader { margin: 0 0 4px; }
/* Portrait, matching the polaroid the guest actually sees — a landscape
   thumbnail of a portrait crop misleads about what will be cut off. */
.person-edit .uploader__preview { width: 84px; height: auto; aspect-ratio: 3/4; }
.person-edit .field { margin: 0; }

.uploader__count {
  align-self: center;
  font-size: 12px;
  color: var(--muted-dim);
  /* «3 / 12» is two LTR number runs around a neutral slash: on an RTL line the
     bidi algorithm swaps them and it reads «12 / 3». Isolating the counter
     keeps the count before the limit, where it means what it says. */
  direction: ltr; unicode-bidi: isolate;
}

.gallery-edit {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  margin: 10px 0 4px;
}
.gallery-edit:empty { display: none; }

.gallery-edit__item {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ink-700);
  cursor: grab;
}
.gallery-edit__item.is-over { outline: 2px solid var(--brass); outline-offset: 1px; }
.gallery-edit__item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Named rather than numbered: «الأكبر» tells the organiser what the position
   does. A «1» would only tell them it is first, which they can already see. */
.gallery-edit__badge {
  position: absolute; inset-block-end: 4px; inset-inline-start: 4px;
  padding: 1px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 10px; font-weight: 600;
}

.gallery-edit__remove {
  position: absolute; inset-block-start: 4px; inset-inline-end: 4px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer;
}
.gallery-edit__remove:hover { background: var(--red); }

.chip--locked { opacity: .55; }
.chip__lock {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--brass);
}

/* ── برنامج الحفل ── */

.schedule-edit { display: grid; gap: 8px; margin-bottom: 4px; }

.schedule-edit__row {
  display: grid;
  gap: 8px;
  padding: 6px 10px;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: 10px;
}
.schedule-edit__row.is-on { border-color: var(--brass); }

.schedule-edit__head {
  display: grid;
  grid-template-columns: 20px 1fr 128px;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}
.schedule-edit__note { padding: 8px 10px; font-size: 12.5px; margin-bottom: 6px; }
.schedule-edit__head input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brass); }
.schedule-edit__name { font-size: 14px; }
.schedule-edit__time { padding: 7px 9px; font-size: 13px; }
/* A disabled time still has to be readable — it is showing what will come back
   if the row is ticked again, not decoration. */
.schedule-edit__time:disabled { opacity: .4; cursor: not-allowed; }

.theme__premium {
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--foil-gold);
  color: #2A2018;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  vertical-align: middle;
}

/* ── the motif inside a template swatch ──
   Tinted from the swatch's own accent so the preview matches what the guest
   will actually receive, rather than showing every template in the same pink. */

.theme__preview { position: relative; overflow: hidden; }
.theme__preview .theme__card { position: relative; z-index: 1; }

/* Behind the mock card, not over it: the template's own name has to stay
   readable, and it is set on that card. */
.theme__bot {
  position: absolute;
  z-index: 0;
  width: 62%;
  aspect-ratio: 1;
  opacity: .9;
  pointer-events: none;
  --bot-petal: var(--t-accent);
  --bot-petal-1: color-mix(in srgb, var(--t-accent) 78%, white);
  --bot-petal-2: color-mix(in srgb, var(--t-accent) 56%, white);
  --bot-petal-3: color-mix(in srgb, var(--t-accent) 34%, white);
  --bot-leaf: #7E9A72;
  --bot-stem: #6C8A62;
  --bot-core: #C9A24A;
  --bot-fruit: #4C5833;
  --paper: var(--t-paper);
}
.theme__bot svg { width: 100%; height: 100%; display: block; }

.theme__bot--corners { top: -12%; inset-inline-start: -10%; transform: scaleY(-1); }
.theme__bot--side { bottom: -10%; inset-inline-start: -14%; }
.theme__bot--crown { top: -16%; inset-inline-end: -12%; transform: scaleY(-1) scaleX(-1); }
.theme__bot--band { bottom: -14%; inset-inline-end: -12%; transform: scaleX(-1); }

/* ── شرح الأدوار ── */
.roles-legend { margin: 0 0 16px; display: grid; gap: 6px; }
.roles-legend > div { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.roles-legend dt {
  flex: none; min-width: 96px;
  font-weight: 700; color: var(--parchment);
}
.roles-legend dd { margin: 0; color: var(--muted); }

/* ── الهوية في الشريط العلوي ── */
.topbar__logo { flex: none; color: var(--parchment); }
.login__logo { display: block; margin: 0 auto 14px; color: var(--parchment); }

.whoami {
  flex: none;
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 12px;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}
.whoami__hi { color: var(--muted); }
.whoami__name { color: var(--parchment); font-weight: 700; }
.whoami__role {
  padding-inline-start: 6px;
  border-inline-start: 1px solid var(--ink-600);
  color: var(--muted);
  font-size: 11.5px;
}
/* المشرف بلون مختلف: الفرق بين الحسابين يجب أن يُرى، لا أن يُتذكَّر. */
.whoami[data-role="admin"] { border-color: var(--brass); }
.whoami[data-role="admin"] .whoami__role { color: var(--brass); }

/* على الجوال يبقى الاسم ويختفي الدور — المساحة للأهم. */
@media (max-width: 720px) {
  .whoami__hi, .whoami__role { display: none; }
  .whoami { padding: 5px 10px; }
}

/* اختيار الدور داخل صف الموظف */
.staff-role-pick { flex: none; width: 132px; padding: 7px 9px; font-size: 12.5px; }
@media (max-width: 720px) { .staff-role-pick { width: 100%; } }

/* منطقة الحذف الجماعي */
.danger-zone--wipe {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 22px; padding: 14px 16px;
  border: 1px solid rgba(208, 24, 64, .35);
  border-radius: var(--radius-sm);
  background: rgba(208, 24, 64, .04);
}
.danger-zone--wipe strong { display: block; font-size: 13.5px; }
.danger-zone--wipe span { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
@media (max-width: 620px) {
  .danger-zone--wipe { flex-direction: column; align-items: stretch; }
}

/* السطر الصغير تحت كل رقم — يذكّر بالوحدة: بطاقة أم شخص */
.stat dfn {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted-dim);
}

/* المناسبة المُسنَدة تحت اسم المستخدم */
.card-row__event {
  display: block; margin-top: 3px;
  font-style: normal; font-size: 11.5px; color: var(--muted);
}
.card-row__event.is-missing { color: var(--red); font-weight: 600; }
#staff-event { flex: none; width: 150px; }
@media (max-width: 720px) { #staff-event { width: 100%; } }


/* لوحة تخصيص العنصر المنقور في المعاينة */
.style-panel {
  position: fixed;
  z-index: 90;
  inset-inline-end: 18px;
  bottom: 18px;
  width: 240px;
  padding: 14px;
  background: var(--ink-850);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 10px;
}
.style-panel__head { display: flex; justify-content: space-between; align-items: center; }
.style-panel__head b { font-size: 13.5px; }
.style-panel__head button {
  border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted);
}
.style-panel__row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.style-panel__row input[type="range"] { width: 100%; }
.style-panel__row input[type="color"] {
  width: 44px; height: 28px; border: 1px solid var(--ink-600); border-radius: 6px; padding: 0;
  background: none; cursor: pointer;
}
#sp-size-val { font-size: 11.5px; color: var(--muted-dim); min-width: 36px; }


.freebox-add {
  position: fixed;
  z-index: 90;
  bottom: 18px;
  inset-inline-start: 18px;
}
.style-panel__check { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.btn--danger { color: #A8283E; border-color: #E4B6BE; }


/* علامة «أُرسلت» بجانب اسم الضيف */
.sent-check {
  font-style: normal;
  color: var(--green);
  font-weight: 700;
  margin-inline-start: 4px;
}

/* ── جرس التنبيهات ─────────────────────────────────────────────── */
.topbar__bell { position: relative; flex: none; }
.notif-badge {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--ink-850);
}
.notif-panel {
  position: fixed;
  top: 62px;
  inset-inline-end: 10px;
  z-index: 60;
  width: min(360px, calc(100vw - 20px));
  max-height: min(62vh, 480px);
  overflow-y: auto;
  background: var(--ink-850);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.notif-panel__head {
  position: sticky;
  top: 0;
  padding: 12px 16px;
  background: var(--ink-850);
  border-bottom: 1px solid var(--ink-700);
  font-weight: 700;
  color: var(--parchment);
}
.notif-panel__list { list-style: none; margin: 0; padding: 4px 0 8px; }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ink-800);
  font-size: 14px;
  color: var(--parchment);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item--new { background: var(--ink-800); }
.notif-item--empty { color: var(--muted); justify-content: center; padding-block: 22px; }
.notif-item__icon { flex: none; font-size: 17px; line-height: 1.4; }
.notif-item__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-item__body q {
  quotes: "«" "»";
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: break-word;
}
.notif-item__body time { color: var(--muted-dim); font-size: 12px; }
