/* ============================================================
   PURE CARTEL ADMINISTRATION
   ------------------------------------------------------------
   An extension of the storefront's dark membership language, not a new
   system. Every token below is lifted from pure-cartel-theme's onboarding
   sheet and Membership Portal so the admin reads as the same product:

     surface  #0F0F0F          ink      #F3F0EA
     card     linear-gradient(160deg, #171717 0%, #0C0C0C 100%)
     hairline rgba(243,240,234, .09 / .14 / .22)
     easing   cubic-bezier(0.16, 1, 0.3, 1)
     radius   16 sheet · 14 card · 8 field · 999 pill
     type     IBM Plex Mono (labels, numerals, headings)
              Plus Jakarta Sans (prose)  ·  Newsreader italic (accents)

   Deliberately not a dashboard template: no chrome-heavy panels, no
   saturated status colours, one accent (gold) used sparingly.
   ============================================================ */

:root {
  --surface: #0F0F0F;
  --surface-raised: #141414;
  --card: linear-gradient(160deg, #171717 0%, #0C0C0C 100%);
  --ink: #F3F0EA;
  --ink-70: rgba(243, 240, 234, 0.72);
  --ink-60: rgba(243, 240, 234, 0.6);
  --ink-50: rgba(243, 240, 234, 0.5);
  --ink-35: rgba(243, 240, 234, 0.35);
  --line: rgba(243, 240, 234, 0.14);
  --line-soft: rgba(243, 240, 234, 0.09);
  --line-strong: rgba(243, 240, 234, 0.22);

  --gold: #B58A47;
  --sage: #97A489;
  --sage-ink: #B7C4A9;
  --alert: #E6B4A6;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Plus Jakarta Sans", -apple-system, sans-serif;
  --serif: "Newsreader", Georgia, serif;

  --sidebar-w: 236px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- shared type ---------- */
.kicker {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-50);
}
.label {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-50);
}
.num { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.mono { font-family: var(--mono); }

/* ============================================================
   LOGIN
   ============================================================ */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  animation: fade 0.5s var(--ease);
}
.login.is-leaving { animation: loginOut 0.5s var(--ease) forwards; }
@keyframes loginOut { to { opacity: 0; transform: scale(0.985); } }

.login__sheet {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: rise 0.6s var(--ease) both;
}
.login__mark {
  width: 54px; height: 54px;
  margin: 0 auto 1.6rem;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.login__title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.login__sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-50);
  margin-bottom: 1.15rem;
}
.login__rule { width: 46px; height: 1px; background: var(--line-strong); margin: 0 auto 1.75rem; }
.login__form { text-align: left; }
/* step advance — same rise as everything else, so the sheet never jumps */
.login__step { animation: rise 0.45s var(--ease) both; }
.login__hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--ink-60);
  text-align: center;
  margin-bottom: 1.15rem;
}
.login__hint .mono { color: var(--ink); }
/* the code reads as a credential, not a text field */
.login__code {
  text-align: center;
  font-size: 1.25rem !important;
  letter-spacing: 0.42em !important;
  font-weight: 700;
  padding-left: 0.42em !important;
}
.login__aux {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}
.login__link {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-50);
  transition: color 0.2s ease;
}
.login__link:hover:not(:disabled) { color: var(--ink); }
.login__link:disabled { opacity: 0.45; cursor: default; }

.side__signout { margin-top: 0.7rem; }
.side__signout span:first-child { transition: color 0.2s ease; }
.side__signout:hover span:first-child { color: var(--ink); }
#sessionWho { font-size: 0.55rem; color: var(--ink-35); }

.login__foot {
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--ink-35);
  text-align: center;
}

/* ---------- fields ---------- */
.field { margin-bottom: 0.85rem; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-60);
  margin-bottom: 0.4rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(243, 240, 234, 0.16);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.field input::placeholder { color: var(--ink-35); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: rgba(243, 240, 234, 0.5);
  background: rgba(255, 255, 255, 0.07);
}
.field input[readonly] { background: rgba(255,255,255,0.02); color: var(--ink-60); cursor: default; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  background: var(--ink);
  color: #0F0F0F;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  transition: transform 0.12s, background 0.2s ease, opacity 0.2s ease;
}
.btn:hover { background: #FFFFFF; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn--full { width: 100%; }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--ghost:hover { background: rgba(255,255,255,0.05); border-color: var(--line-strong); }
.btn--danger { background: transparent; color: var(--alert); border: 1px solid rgba(230,180,166,0.35); }
.btn--danger:hover { background: rgba(230,180,166,0.08); }
.btn--sm { padding: 0.48rem 0.9rem; font-size: 0.68rem; }

/* loading state — a quiet pulse, never a spinner circus */
.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(15,15,15,0.25), transparent);
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.err {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--alert);
  margin-top: 0.85rem;
  text-align: center;
}
.err[hidden] { display: none; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: none; min-height: 100vh; min-height: 100dvh; }
.app.is-ready { display: grid; grid-template-columns: var(--sidebar-w) 1fr; animation: fade 0.6s var(--ease); }

/* The mobile scrim lives inside .app, so it must be taken out of flow at every
   width — otherwise it becomes a grid item and consumes the sidebar column,
   pushing <main> into an implicit third column off-screen. */
.side__scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(6, 6, 6, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------- sidebar ---------- */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.35rem 0.85rem 1rem;
  border-right: 1px solid var(--line-soft);
  background: #0C0C0C;
}
.side__brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 0.55rem 1.35rem;
}
.side__mark {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono); font-weight: 700; font-size: 0.6rem;
  color: var(--gold);
}
.side__name { font-family: var(--mono); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.side__role { display: block; font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.12em; color: var(--ink-35); text-transform: uppercase; }

.side__nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.side__link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.62rem 0.6rem;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--ink-60);
  transition: background 0.2s ease, color 0.2s ease;
  position: relative;
}
.side__link svg { flex: none; opacity: 0.75; }
.side__link:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
.side__link.is-active { background: rgba(255,255,255,0.06); color: var(--ink); font-weight: 700; }
.side__link.is-active::before {
  content: ""; position: absolute; left: -0.85rem; top: 50%;
  width: 2px; height: 16px; margin-top: -8px;
  background: var(--gold); border-radius: 0 2px 2px 0;
}
.side__foot { padding: 0.85rem 0.6rem 0; border-top: 1px solid var(--line-soft); }
.side__kbd {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; color: var(--ink-35);
}
kbd {
  font-family: var(--mono); font-size: 0.6rem;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink-60);
}

/* ---------- main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(15,15,15,0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.top__burger { display: none; }
.top__title { font-family: var(--mono); font-weight: 700; font-size: 0.92rem; letter-spacing: 0.04em; }
.top__spacer { flex: 1; }
.top__search {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-50);
  transition: border-color 0.2s ease, color 0.2s ease;
  min-width: 190px;
}
.top__search:hover { border-color: var(--line); color: var(--ink-70); }

.view { padding: 1.75rem; flex: 1; }
.view__head { margin-bottom: 1.5rem; }
.view__title { font-family: var(--mono); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.02em; }
.view__sub { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-50); margin-top: 0.3rem; }

/* page transition */
.view.is-entering { animation: viewIn 0.42s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.stagger > * { opacity: 0; animation: rise 0.5s var(--ease) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(7) { animation-delay: 300ms; }
.stagger > *:nth-child(n+8) { animation-delay: 350ms; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 1.15rem 1.2rem;
}
.card--flat { background: rgba(255,255,255,0.02); }
.card__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.card__title { font-family: var(--mono); font-weight: 700; font-size: 0.86rem; letter-spacing: 0.03em; }

/* ---------- daily brief ---------- */
.brief {
  position: relative; overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem 1.8rem;
  margin-bottom: 1.5rem;
}
.brief::after {
  content: ""; position: absolute; top: -60%; right: -20%;
  width: 55%; height: 220%;
  background: radial-gradient(ellipse at center, rgba(181,138,71,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.brief__greet {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  letter-spacing: 0.02em;
}
.brief__greet em { font-family: var(--serif); font-style: italic; font-weight: 500; }
.brief__sub { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-50); margin: 0.35rem 0 1.25rem; }
.brief__list { display: grid; gap: 0.6rem; margin-bottom: 1.35rem; }
.brief__item {
  display: flex; align-items: flex-start; gap: 0.7rem;
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.01em; color: var(--ink-70);
}
.brief__dot { flex: none; width: 5px; height: 5px; border-radius: 50%; margin-top: 0.55em; background: var(--ink-35); }
.brief__item[data-tone="positive"] .brief__dot { background: var(--sage); }
.brief__item[data-tone="alert"] .brief__dot { background: var(--alert); }
.brief__item[data-tone="warn"] .brief__dot { background: var(--gold); }
.brief__rec {
  border-top: 1px solid var(--line-soft);
  padding-top: 1.1rem;
}
.brief__rec-label { display: block; margin-bottom: 0.4rem; }
.brief__rec-text { font-family: var(--mono); font-size: 0.88rem; font-weight: 700; letter-spacing: 0.01em; }

/* ---------- KPI grid ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.kpi { position: relative; overflow: hidden; }
.kpi__label { display: block; margin-bottom: 0.6rem; }
.kpi__value { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.6rem; }
.delta { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; }
.delta--up { color: var(--sage-ink); }
.delta--down { color: var(--alert); }
.kpi__spark { width: 62px; height: 22px; opacity: 0.7; }

/* ---------- chart ---------- */
.chart__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.segmented { display: inline-flex; gap: 1px; padding: 2px; border: 1px solid var(--line-soft); border-radius: 999px; }
.segmented button {
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-50);
  transition: background 0.2s ease, color 0.2s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: rgba(255,255,255,0.08); color: var(--ink); }
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart__line { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chart__area { fill: url(#pcArea); }
.chart__grid { stroke: var(--line-soft); stroke-width: 1; }
.chart__axis { font-family: var(--mono); font-size: 9px; fill: var(--ink-35); letter-spacing: 0.06em; }
.chart__dot { fill: var(--gold); }

/* ---------- activity ---------- */
.feed { display: grid; gap: 0; }
.feed__row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.feed__row:last-child { border-bottom: none; }
.feed__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-35); }
.feed__row[data-tone="positive"] .feed__dot { background: var(--sage); }
.feed__row[data-tone="alert"] .feed__dot { background: var(--alert); }
.feed__row[data-tone="warn"] .feed__dot { background: var(--gold); }
.feed__text { flex: 1; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.01em; color: var(--ink-70); min-width: 0; }
.feed__text strong { color: var(--ink); font-weight: 700; }
.feed__when { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-35); white-space: nowrap; }

/* ============================================================
   TABLES
   ============================================================ */
.tablewrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(255,255,255,0.02); }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
thead th {
  text-align: left;
  padding: 0.8rem 1rem;
  font-family: var(--mono); font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-50);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
tbody td {
  padding: 0.85rem 1rem;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.01em; color: var(--ink-70);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
tbody tr { transition: background 0.18s ease; animation: rowIn 0.4s var(--ease) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
tbody tr:hover { background: rgba(255,255,255,0.03); cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }
td .strong, .t-strong { color: var(--ink); font-weight: 700; }

.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar__search {
  flex: 1; min-width: 180px;
  padding: 0.55rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-family: var(--mono); font-size: 0.76rem;
}
.toolbar__search:focus { outline: none; border-color: var(--line-strong); }
.chips { display: inline-flex; gap: 1px; padding: 2px; border: 1px solid var(--line-soft); border-radius: 999px; flex-wrap: wrap; }
.chips button {
  padding: 0.32rem 0.7rem; border-radius: 999px;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-50);
  transition: background 0.2s, color 0.2s;
}
.chips button:hover { color: var(--ink); }
.chips button.is-active { background: rgba(255,255,255,0.08); color: var(--ink); }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  font-family: var(--mono); font-weight: 700; font-size: 0.58rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.26rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-70);
  white-space: nowrap;
}
.badge--active, .badge--delivered, .badge--secured, .badge--live, .badge--on, .badge--healthy, .badge--sent {
  border-color: rgba(151,164,137,0.5); color: var(--sage-ink);
}
/* --sending joins the in-progress group. Without it a campaign mid-flight
   rendered an unstyled badge — the one state an administrator watches most
   closely was the only one with no colour. */
.badge--pending, .badge--processing, .badge--scheduled, .badge--low, .badge--draft,
.badge--sending {
  border-color: rgba(181,138,71,0.5); color: var(--gold);
}
.badge--failed, .badge--cancelled, .badge--suspended, .badge--returned {
  border-color: rgba(230,180,166,0.45); color: var(--alert);
}
/* Shipping completeness and fulfilment readiness. Deliberately reuse the
   existing sage/gold pair rather than introducing a colour: "complete" reads
   like "active", and "missing" is an outstanding task, not a failure — gold,
   the in-progress colour, not the alert red. */
.badge--ok   { border-color: rgba(151,164,137,0.5); color: var(--sage-ink); }
.badge--warn { border-color: rgba(181,138,71,0.5);  color: var(--gold); }

/* Second filter row under the status chips. Shipping status is an independent
   axis from member status, so it gets its own line rather than more chips in
   the same strip. */
.toolbar--sub { margin-top: -0.35rem; }
.toolbar__label {
  font-family: var(--mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-35);
}
.toolbar__label--right { margin-left: auto; }

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.panel { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.panel.is-open { visibility: visible; }
.panel__scrim {
  position: absolute; inset: 0;
  background: rgba(6,6,6,0.72);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.35s ease;
}
.panel.is-open .panel__scrim { opacity: 1; }
.panel__sheet {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(520px, 100%);
  background: #0F0F0F;
  border-left: 1px solid var(--line);
  padding: 1.5rem 1.5rem 2.5rem;
  overflow-y: auto;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 0.42s var(--ease), opacity 0.32s ease;
}
.panel.is-open .panel__sheet { transform: none; opacity: 1; }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.panel__title { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em; }
.panel__meta { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-50); margin-top: 0.25rem; }
.panel__close { width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-50); border-radius: 8px; transition: color 0.2s, background 0.2s; }
.panel__close:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.panel__section { margin-bottom: 1.6rem; }
.panel__section > .label { display: block; margin-bottom: 0.8rem; }
.panel__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }

/* definition rows */
.dl { display: grid; gap: 0.7rem; }
.dl__row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-family: var(--mono); font-size: 0.76rem; color: var(--ink-60); }
.dl__val { color: var(--ink); font-weight: 700; text-align: right; }

/* timeline (same component language as the Membership Portal journey) */
.tl { position: relative; }
.tl__step { position: relative; padding: 0 0 1.15rem 1.7rem; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-50); }
.tl__step:last-child { padding-bottom: 0; }
.tl__step::before {
  content: ""; position: absolute; left: 0; top: 0.3em;
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--ink-35); background: transparent;
}
.tl__step::after {
  content: ""; position: absolute; left: 4px; top: calc(0.3em + 11px); bottom: 2px;
  width: 1px; background: var(--line);
}
.tl__step:last-child::after { display: none; }
.tl__step.is-done { color: var(--ink); }
.tl__step.is-done::before { background: var(--ink); border-color: var(--ink); }
.tl__step.is-current { color: var(--ink); }
.tl__step.is-current::before { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(243,240,234,0.12); }
.tl__step.is-cancelled::before { border-color: var(--alert); }
.tl__when { display: block; margin-top: 0.18rem; font-size: 0.66rem; color: var(--ink-35); }

/* notes */
.note { padding: 0.85rem 0.95rem; border: 1px solid var(--line-soft); border-radius: 10px; margin-bottom: 0.6rem; }
.note__meta { font-family: var(--mono); font-size: 0.62rem; color: var(--ink-35); margin-bottom: 0.35rem; }
.note__text { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-70); }

/* ============================================================
   MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 1.5rem; visibility: hidden; opacity: 0; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
.modal.is-open { visibility: visible; opacity: 1; transition: opacity 0.3s ease; }
.modal__scrim { position: absolute; inset: 0; background: rgba(6,6,6,0.82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal__sheet {
  position: relative;
  width: 100%; max-width: 420px;
  background: #0F0F0F;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.9rem 1.6rem 1.5rem;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.45s var(--ease);
}
.modal.is-open .modal__sheet { transform: none; }
.modal__title { font-family: var(--mono); font-weight: 700; font-size: 1.02rem; letter-spacing: 0.02em; margin-bottom: 0.7rem; }
/* pre-line so a confirmation can put subject, recipients and count on their
   own lines. Modal bodies are set with textContent, so newlines would
   otherwise collapse into one run-on sentence at the moment an administrator
   most needs to read carefully. Existing single-line bodies are unaffected. */
.modal__body { font-family: var(--mono); font-size: 0.8rem; line-height: 1.6; color: var(--ink-70); margin-bottom: 1.5rem; white-space: pre-line; }
.modal__actions { display: flex; gap: 0.6rem; }
.modal__actions .btn { flex: 1; }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmd { position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center; padding: 12vh 1.25rem 1.25rem; visibility: hidden; opacity: 0; transition: opacity 0.24s ease, visibility 0s linear 0.24s; }
.cmd.is-open { visibility: visible; opacity: 1; transition: opacity 0.24s ease; }
.cmd__scrim { position: absolute; inset: 0; background: rgba(6,6,6,0.78); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cmd__sheet {
  position: relative; width: 100%; max-width: 560px;
  background: #121212;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.65);
  transform: translateY(-10px) scale(0.99);
  transition: transform 0.3s var(--ease);
}
.cmd.is-open .cmd__sheet { transform: none; }
.cmd__input {
  width: 100%;
  padding: 1.05rem 1.2rem;
  background: transparent;
  border: none; border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 0.92rem; letter-spacing: 0.01em;
}
.cmd__input:focus { outline: none; }
.cmd__input::placeholder { color: var(--ink-35); }
.cmd__results { max-height: 46vh; overflow-y: auto; }
.cmd__row {
  display: flex; align-items: center; gap: 0.9rem;
  width: 100%; text-align: left;
  padding: 0.72rem 1.2rem;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s ease;
}
.cmd__row:last-child { border-bottom: none; }
.cmd__row:hover, .cmd__row.is-cursor { background: rgba(255,255,255,0.06); }
.cmd__type {
  flex: none; min-width: 82px;
  font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-35);
}
.cmd__title { flex: 1; font-family: var(--mono); font-size: 0.8rem; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd__meta { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-35); white-space: nowrap; }
.cmd__empty { padding: 2rem 1.2rem; text-align: center; font-family: var(--mono); font-size: 0.76rem; color: var(--ink-35); }
.cmd__foot { display: flex; gap: 1rem; padding: 0.6rem 1.2rem; border-top: 1px solid var(--line-soft); font-family: var(--mono); font-size: 0.6rem; color: var(--ink-35); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty { padding: 3rem 1.5rem; text-align: center; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(255,255,255,0.02); }
.empty__mark { width: 36px; height: 36px; margin: 0 auto 1rem; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-35); }
.empty__title { font-family: var(--mono); font-weight: 700; font-size: 0.88rem; letter-spacing: 0.03em; margin-bottom: 0.5rem; }
.empty__copy { font-family: var(--mono); font-size: 0.76rem; line-height: 1.55; color: var(--ink-50); max-width: 34ch; margin: 0 auto; }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.grid { display: grid; gap: 0.75rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stack { display: grid; gap: 1.5rem; }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.spacer { flex: 1; }

/* progress meter */
.meter { height: 4px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; margin-top: 0.75rem; }
.meter__fill { height: 100%; background: var(--gold); border-radius: 999px; width: 0; transition: width 1s var(--ease); }
.meter__fill--sage { background: var(--sage); }

/* toggle (reused from the Membership Portal settings) */
.switch {
  flex: none; position: relative; width: 40px; height: 23px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.03);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%;
  background: rgba(243,240,234,0.55);
  transition: transform 0.28s var(--ease), background 0.25s ease;
}
.switch[aria-checked="true"] { background: rgba(243,240,234,0.9); border-color: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(17px); background: #0F0F0F; }
.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line-soft); }
.switchrow:last-child { border-bottom: none; }
.switchrow__name { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-70); }

/* placeholder-data marker */
.stub {
  margin-top: 2rem;
  padding: 0.65rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; line-height: 1.5;
  color: var(--ink-35); text-align: center;
}

/* ============================================================
   RESPONSIVE — desktop is the workspace, but every width works
   ============================================================ */
@media (max-width: 1080px) {
  :root { --sidebar-w: 200px; }
  .view { padding: 1.5rem 1.25rem; }
  .top { padding: 0.9rem 1.25rem; }
}

@media (max-width: 860px) {
  .app.is-ready { grid-template-columns: 1fr; }
  .side {
    position: fixed; z-index: 50; left: 0; top: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.38s var(--ease);
    box-shadow: 0 0 60px rgba(0,0,0,0.6);
  }
  .side.is-open { transform: none; }
  .side__scrim { transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
  .side__scrim.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s ease;
  }
  .top__burger {
    display: grid; place-items: center;
    width: 34px; height: 34px; margin-left: -0.35rem;
    border-radius: 8px; color: var(--ink-60);
  }
  .top__burger:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
  .top__search { min-width: 0; }
  .top__search span { display: none; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpi__value { font-size: 1.3rem; }
  .brief { padding: 1.4rem 1.25rem; }
  .panel__sheet { width: 100%; border-left: none; }
}

@media (max-width: 560px) {
  .view { padding: 1.25rem 1rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .kpi__spark { display: none; }
  .field--row { grid-template-columns: 1fr; }
  .cmd { padding-top: 6vh; }
  .modal__actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .stagger > * { opacity: 1; }
}

/* ============================================================
   COMMUNICATIONS — Email Center additions
   ------------------------------------------------------------
   Two rules. Everything else in Compose and Drafts uses components that
   already existed: .card, .field, .btn, .chips, .tablewrap, .dl, .panel.
   ============================================================ */

/* Row action buttons in the Drafts table. Wrap on narrow screens rather than
   forcing the table wider — .tablewrap already scrolls, but actions should
   stay reachable without scrolling sideways to find them. */
.rowacts { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

/* The rendered email, in an iframe.
   A campaign is a complete HTML document with its own body background; pasted
   into the panel with innerHTML its styles would fight the dashboard's. The
   iframe gives it its own document, which is also exactly how a mail client
   will render it. */
.mailpreview {
  width: 100%;
  height: 520px;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #F6F2EB;
  display: block;
}
@media (max-width: 720px) { .mailpreview { height: 420px; } }

/* ============================================================
   BRAND MARK
   ------------------------------------------------------------
   The "PC" initials in the login sheet and the sidebar are now the real
   Pure Cartel logo — the SAME file the emails use, served by the backend at
   /email/logo.png. One asset, so the storefront, member portal, emails and
   this dashboard can never drift apart. No copy lives in admin/.

   The artwork is dark, drawn for the cream email ground. This dashboard sits
   on #0F0F0F, so it is inverted here exactly as the storefront's dark
   onboarding sheet does it (.onb__logo in pure-cartel.css). Same asset, same
   treatment, opposite background.

   The bordered boxes keep their existing dimensions, radius and alignment —
   only their contents changed.
   ============================================================ */
.login__mark img,
.side__mark img {
  display: block;
  width: auto;
  height: auto;
  filter: invert(1) brightness(1.9) contrast(1.05);
}
.login__mark img { max-width: 30px; max-height: 30px; }
.side__mark img  { max-width: 18px; max-height: 18px; }

/* ============================================================
   BULK MEMBER ACTIONS
   ------------------------------------------------------------
   Sits beside the status chips in the existing .toolbar. No new component:
   the buttons are .btn--ghost .btn--sm, exactly as used in the campaign
   tables, and the count pill reuses the chip idiom.
   ============================================================ */
.bulkbar { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Count pill on the status chips and the bulk buttons. Tabular numerals so
   the tabs do not shift width as counts change after a bulk action. */
.chip__n {
  font-variant-numeric: tabular-nums;
  color: var(--ink-35);
  margin-left: 0.3rem;
}
.chips button.is-active .chip__n { color: var(--ink-60); }
.btn--ghost .chip__n { color: var(--ink-50); }

/* The toolbar already wraps; on narrow screens the bulk bar drops to its own
   row and stretches, rather than crushing the chips. */
@media (max-width: 700px) {
  .bulkbar { width: 100%; }
  .bulkbar .btn { flex: 1; }
}
