/* =========================================================
   myengine.io — dashboard. Premium, Stripe-inspired.
   Dual theme: dark (default) + light, driven by
   <html data-theme="dark|light">. Everything reads vars.
   ========================================================= */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Palette from the Claude Design handoff (tokens/colors-dashboard.css):
   warm paper light theme / warm charcoal dark theme, coral accent.
   Dark is the product default. */
:root,
:root[data-theme="light"] {
  --sf: #faf9f5;            /* page — warm paper */
  --sf-2: #f5f4ee;          /* sidebar */
  --card: #ffffff;
  --card-2: #f0eee6;        /* sunken: code, inputs */
  --line: #e8e6dc;
  --line-2: #d9d6c8;
  --ink: #141413;
  --ink-2: #4a4944;
  --muted: #87867f;
  --accent: #d97757;        /* coral */
  --accent-ink: #ffffff;
  --accent-soft: #f7ebe4;
  --green: #788c5d;
  --green-soft: #eef0e7;
  --red: #b4443c;
  --red-soft: #f8e9e7;
  --amber: #966c1e;
  --amber-soft: #f7f0e0;
  --shadow: 0 1px 2px rgba(20, 20, 19, 0.04), 0 8px 24px -18px rgba(20, 20, 19, 0.22);
  --shadow-lg: 0 20px 50px -30px rgba(20, 20, 19, 0.30);
  --chat-bg: #f5f3ec;
  --bubble: #ffffff;
  --bubble-ink: #141413;
  --bubble-line: #e8e6dc;
  --focus-ring: rgba(217, 119, 87, 0.16);
}

:root[data-theme="dark"] {
  --sf: #262624;            /* page — warm charcoal */
  --sf-2: #21201d;          /* sidebar */
  --card: #30302e;
  --card-2: #262624;
  --line: #3f3e3a;
  --line-2: #4c4a45;
  --ink: #faf9f5;
  --ink-2: #c2c0b6;
  --muted: #87867f;
  --accent: #d97757;
  --accent-ink: #ffffff;
  --accent-soft: rgba(217, 119, 87, 0.16);
  --green: #9fb37f;
  --green-soft: rgba(120, 140, 93, 0.18);
  --red: #e77e72;
  --red-soft: rgba(180, 68, 60, 0.18);
  --amber: #d9a95c;
  --amber-soft: rgba(150, 108, 30, 0.20);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -18px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -30px rgba(0, 0, 0, 0.65);
  --chat-bg: #21201d;
  --bubble: #30302e;
  --bubble-ink: #f0efe8;
  --bubble-line: #3f3e3a;
  --focus-ring: rgba(217, 119, 87, 0.28);
}

.hub-body {
  margin: 0;
  font-family: var(--me-sans);
  background: var(--sf);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* icons */
.ic { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 19px; height: 19px; }

/* ================= shell ================= */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  border-right: 1px solid var(--line);
  background: var(--sf-2);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  padding: 4px 10px 2px;
}
.side-brand img { width: 22px; height: 22px; }
.side-brand .tld { color: var(--muted); font-weight: 500; }
.side-biz-wrap {
  position: relative;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  padding-bottom: 8px;
}
.side-biz {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 8px 10px;
  border-radius: 9px;
}
.side-biz:hover { background: var(--card-2); color: var(--ink); border-color: var(--accent); }
.side-biz span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.biz-chev { width: 13px; height: 13px; flex: none; opacity: 0.7; }
.side-biz-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 6px;
  right: 6px;
  z-index: 70;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 5px;
  box-shadow: var(--shadow-lg);
}
.biz-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  padding: 8px 9px;
  border-radius: 8px;
}
.biz-item:hover { background: var(--card-2); }
.biz-item.on { font-weight: 600; }
.biz-item.add { color: var(--accent); font-weight: 600; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 3px; padding-top: 10px; }
.biz-check { width: 13px; flex: none; color: var(--accent); font-size: 11px; }
.biz-cap {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding: 9px;
  border-top: 1px solid var(--line);
  margin-top: 3px;
}
.side-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 10px 5px;
}
.side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 8.5px 10px;
  font-family: var(--me-sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.side-btn:hover { background: var(--card-2); color: var(--ink); }
.side-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-btn .ic { opacity: 0.85; }
.badge {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}
.badge.red { background: var(--red); color: #fff; }
.side-plan {
  margin-top: auto;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}
.side-plan b { font-size: 12.5px; color: var(--ink); }
.side-plan span { font-size: 11.5px; color: var(--muted); }

/* ================= main / topbar ================= */

.main { padding: 0 32px 60px; min-width: 0; }
.plan-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  padding: 9px 18px;
  border: 1px solid rgba(217, 119, 87, 0.3);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 999px;
  font-size: 13.5px;
}
.plan-banner b { font-weight: 700; }
.plan-banner .btn-blue.slim { padding: 6px 14px; font-size: 12.5px; }
.plan-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.plan-buttons .btn-blue { margin-top: 0; }

/* ================= settings: "Your plan" (design handoff) ================= */

.settings-col { max-width: 760px; display: flex; flex-direction: column; gap: 12px; }
.settings-sec {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 16px 0 2px;
}
.settings-col .panel-card { margin-bottom: 8px; }

.pl-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}
.pl-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.pl-ic {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pl-ic.sm { width: 38px; height: 38px; border-radius: 10px; }
.pl-id { flex: 1; min-width: 0; }
.pl-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pl-blurb { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pl-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 3px 10px;
}
.pl-pill.green { background: var(--green-soft); color: var(--green); }
.pl-pill.accent { background: var(--accent-soft); color: var(--accent); }
.pl-pill.red { background: var(--red-soft); color: var(--red); }
.pl-price { text-align: right; flex-shrink: 0; }
.pl-amt { font-family: var(--me-sans); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; color: var(--ink); }
.pl-amt i { font-family: var(--me-mono); font-style: normal; font-size: 12px; color: var(--muted); }
.pl-renews { font-family: var(--me-mono); font-size: 11px; color: var(--muted); margin-top: 2px; }

.pl-meters { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.pl-meter { padding: 16px 24px; }
.pl-meter + .pl-meter { border-left: 1px solid var(--line); }
.pl-meter-lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.pl-meter-num { font-size: 20px; font-weight: 700; margin: 5px 0 8px; font-variant-numeric: tabular-nums; }
.pl-meter-num span { font-size: 12px; font-weight: 500; color: var(--muted); }
.pl-bar { height: 5px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.pl-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.pl-feats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.pl-feat { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.pl-feat .check {
  width: 16px; height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
}

.pl-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 24px; }
.pl-actions .btn-blue { box-shadow: none; }
.pl-help { margin-left: auto; font-size: 12px; color: var(--muted); }
.pl-help a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* plan switcher */
.pl-sw-head { padding: 14px 24px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line); }
.pl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 15px 24px;
  font-family: var(--me-sans);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.12s ease;
}
.pl-row:hover { background: var(--card-2); }
.pl-row.current { background: var(--card-2); }
.pl-radio {
  width: 17px; height: 17px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  position: relative;
}
.pl-radio.on { border-color: var(--accent); }
.pl-radio.on::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.pl-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pl-row-txt b { font-size: 13.5px; font-weight: 700; }
.pl-row-txt b .pl-pop { font-style: normal; color: var(--accent); font-weight: 600; font-size: 12px; }
.pl-row-txt span { font-size: 12.5px; color: var(--muted); }
.pl-row-price { font-family: var(--me-sans); font-size: 15px; font-weight: 600; color: var(--ink); flex-shrink: 0; }
.pl-row-price i { font-family: var(--me-mono); font-style: normal; font-size: 11px; color: var(--muted); }
.pl-sw-foot { padding: 13px 24px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.pl-switcher .secure-row { border: none; border-radius: 0; margin: 0; background: var(--card-2); }

/* billing + danger rows */
.pl-rowcard { display: flex; align-items: center; gap: 14px; padding: 16px 24px; }
.pl-rowcard .pl-row-txt b { font-size: 13.5px; }
.pl-rowcard.danger { border-color: rgba(180, 68, 60, 0.35); }

@media (max-width: 720px) {
  .pl-meters { grid-template-columns: 1fr; }
  .pl-meter + .pl-meter { border-left: none; border-top: 1px solid var(--line); }
  .pl-feats { grid-template-columns: 1fr; }
  .pl-head { flex-wrap: wrap; }
  .pl-help { margin-left: 0; flex-basis: 100%; }
}

/* secure-checkout trust strip */
.secure-row {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: 11px;
}
.secure-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green);
  flex-shrink: 0;
}
.secure-copy { flex: 1; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.secure-copy b { color: var(--ink-2); }
.secure-stripe {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
}
.secure-stripe b {
  color: #635bff; /* Stripe's brand purple — instantly recognizable */
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  background: var(--sf);
  z-index: 10;
}
.topbar h1 {
  font-family: var(--me-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.top-link { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
.top-link:hover { text-decoration: underline; }
.top-email { font-size: 12.5px; color: var(--muted); }
.top-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 9px;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.top-icon:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.top-signout {
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 9px;
  padding: 7px 13px;
  font-family: var(--me-sans);
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.top-signout:hover { border-color: var(--accent); color: var(--accent); }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.view-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.view-head .view-sub { margin: 0; }

/* ================= buttons ================= */

.btn-blue {
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 9px;
  padding: 10px 18px;
  font-family: var(--me-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px -6px rgba(217, 119, 87, 0.45);
  transition: filter 0.12s ease, transform 0.12s ease;
}
.btn-blue:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-blue:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-blue.big { padding: 13px 26px; font-size: 15px; }
.btn-ghost {
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 9px;
  padding: 8px 14px;
  font-family: var(--me-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  border-radius: 9px;
  padding: 9px 15px;
  font-family: var(--me-sans);
  font-size: 13px;
  cursor: pointer;
}
.btn-danger:hover { background: var(--red-soft); }

/* ================= stats & home ================= */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat .lbl { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat .num { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat .num small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat.accent .num { color: var(--accent); }

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.quick { display: flex; flex-direction: column; gap: 10px; }
.quick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 13px;
}
.quick-row .qic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.quick-row .grow { flex: 1; min-width: 0; }
.quick-row b { display: block; font-size: 13px; color: var(--ink); }
.quick-row span { color: var(--muted); font-size: 12px; }
.quick-row code {
  font-family: var(--me-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.mini-row:last-child { border-bottom: none; }
.mini-row .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.mini-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ================= cards ================= */

.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 18px;
  box-shadow: var(--shadow);
}
.card.clickable { cursor: pointer; transition: border-color 0.12s ease, transform 0.12s ease; }
.card.clickable:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.card-title { font-weight: 600; font-size: 14px; }
.card-time { color: var(--muted); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
.card-body { margin-top: 7px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.card-body ul { margin: 5px 0 0; padding-left: 19px; }
.card-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.card-pay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  margin-left: 12px;
  font-size: 12.5px;
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}
.card-pay:hover { text-decoration: underline; }
.card-actions { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.card-actions button {
  border: 1px solid var(--line-2);
  background: transparent;
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--me-sans);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s ease;
}
.card-actions button:hover { border-color: var(--accent); color: var(--accent); }
.card-actions button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.pill-status {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 3px 9px;
}
.pill-status.new { background: var(--accent-soft); color: var(--accent); }
.pill-status.in_progress { background: var(--amber-soft); color: var(--amber); }
.pill-status.done, .pill-status.resolved { background: var(--green-soft); color: var(--green); }
.pill-status.cancelled, .pill-status.seen { background: var(--card-2); color: var(--muted); }
.pill-status.high { background: var(--red-soft); color: var(--red); }
.pill-channel {
  font-size: 10.5px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--card-2);
  color: var(--muted);
  font-weight: 600;
}
.pill-channel.whatsapp { background: var(--green-soft); color: var(--green); }
.pill-channel.telegram { background: var(--accent-soft); color: var(--accent); }

.empty {
  border: 1px dashed var(--line-2);
  border-radius: 13px;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
  background: var(--card);
}

/* ================= channels ================= */

.channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.chan {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.chan-head { display: flex; align-items: center; gap: 11px; }
.chan-ic {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.chan-head h3 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.chan-state {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--card-2);
  color: var(--muted);
}
.chan-state.live { background: var(--green-soft); color: var(--green); }
.chan-state.locked { background: var(--amber-soft); color: var(--amber); }
.chan p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.chan-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chan-row input, .chan-row select {
  flex: 1;
  min-width: 150px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 12px;
  font-family: var(--me-sans);
  font-size: 13px;
  outline: none;
}
.chan-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.chan-row select { flex: 0 0 auto; cursor: pointer; }
.chan code, .snippet {
  font-family: var(--me-mono);
  font-size: 11.5px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--ink-2);
  display: block;
  overflow-x: auto;
  white-space: pre;
}
.chan .qr-wrap { display: flex; gap: 16px; align-items: center; }
.chan .qr-wrap > div { flex: 1; min-width: 0; }
.chan .qr-wrap a.btn-blue { display: inline-block; text-decoration: none; white-space: nowrap; }
.chan .qr-wrap img {
  width: 96px; height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff; /* QR must stay light to scan */
  padding: 4px;
}
.chan-foot { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chan-note { font-size: 12px; color: var(--muted); }
.chan details summary { cursor: pointer; font-size: 12px; color: var(--muted); }

/* ================= panels / settings ================= */

.panel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-sub { font-size: 13px; color: var(--ink-2); line-height: 1.65; margin: -2px 0 14px; }
.panel-card .btn-blue { margin-top: 14px; }
.save-note { margin-left: 12px; color: var(--green); font-size: 13px; font-weight: 600; }

.ob-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.ob-grid label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ob-grid .span2 { grid-column: span 2; }
.hint { font-weight: 400; color: var(--muted); }
.ob-grid input, .ob-grid select, .wiz-body input, .wiz-body select, .wiz-body textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 10px 12px;
  font-family: var(--me-sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--card-2);
  outline: none;
  margin-top: 5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ob-grid input:focus, .ob-grid select:focus,
.wiz-body input:focus, .wiz-body select:focus, .wiz-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
/* custom chevron — the native one sits flush against the border */
.ob-grid select, .wiz-body select, .chan-row select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2387867f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 14px;
  padding-right: 36px;
  cursor: pointer;
}
.wiz-body textarea { font-family: var(--me-mono); font-size: 12.5px; line-height: 1.6; resize: vertical; }

.collect-block { margin-top: 16px; }
.collect-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }

/* ================= chat frame ================= */

.hub-chatframe {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  max-width: 760px;
  box-shadow: var(--shadow-lg);
}
.hub-chatframe .chat { min-height: 440px; background: var(--chat-bg); }
.hub-chatframe .chat-scroll { max-height: 460px; }
.chat-scroll.thread { min-height: 200px; }

/* dark-aware overrides for chat.css bubbles inside the hub */
.hub-chatframe .msg.agent {
  background: var(--bubble);
  border-color: var(--bubble-line);
  color: var(--bubble-ink);
}
.hub-chatframe .msg.customer { background: var(--accent); color: var(--accent-ink); }
.hub-chatframe .chat-inputrow input {
  background: var(--card);
  border-color: var(--line-2);
  color: var(--ink);
}
.hub-chatframe .chat-inputrow input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.hub-chatframe .chat-inputrow button { background: var(--accent); }
:root[data-theme="dark"] .hub-chatframe .msg.event {
  background: var(--accent-soft);
  border-color: var(--line-2);
  color: var(--ink);
}
:root[data-theme="dark"] .hub-chatframe .msg.event .ev-note { color: var(--ink-2); }
:root[data-theme="dark"] .hub-chatframe .msg.event.complaint { background: var(--amber-soft); border-color: rgba(238, 195, 92, 0.35); }

/* ================= sign-in gate ================= */

.hub-gate { display: flex; justify-content: center; padding: 56px 20px 80px; }
.gate-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 38px 40px;
  box-shadow: var(--shadow-lg);
}
.gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 18px;
}
.gate-brand img { width: 24px; height: 24px; }
.gate-brand .tld { color: var(--muted); font-weight: 500; }
.gate-card h1 {
  font-family: var(--me-serif);
  font-weight: 500;
  font-size: 27px;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.gate-card h1 em { font-style: italic; color: var(--accent); }
.gate-card p { color: var(--ink-2); font-size: 14px; line-height: 1.65; margin: 0 0 16px; }
.gate-card input[type="email"] {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--me-sans);
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}
.gate-card input[type="email"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.gate-error { color: var(--red); font-size: 13px; margin-top: 10px; }
.gate-sent { color: var(--ink-2); font-size: 14px; line-height: 1.6; }

/* ================= wizard ================= */

.wizard-gate { padding-top: 40px; }
.wizard {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wiz-head { padding: 26px 34px 0; position: relative; }
.wiz-exit {
  position: absolute;
  top: 26px; right: 34px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
}
.wiz-exit:hover { color: var(--ink); background: var(--card-2); }
.wiz-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--card-2);
  margin: 16px 0 8px;
  overflow: hidden;
}
.wiz-bar {
  height: 100%;
  width: 10%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #e28d70);
  transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.wiz-stepline {
  font-family: var(--me-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.wiz-body { padding: 10px 34px 6px; min-height: 320px; }
.wiz-body h2 {
  font-family: var(--me-serif);
  font-weight: 500;
  font-size: 25px;
  letter-spacing: -0.02em;
  margin: 8px 0 6px;
}
.wiz-body h2 em { font-style: italic; color: var(--accent); }
.wiz-body .wiz-sub { color: var(--ink-2); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.wiz-body label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
.wiz-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}
.type-tile {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  font-family: var(--me-sans);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.type-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.type-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.type-tile .ti { display: flex; justify-content: center; margin-bottom: 8px; color: var(--ink-2); }
.type-tile .ti .ic { width: 21px; height: 21px; stroke-width: 1.6; }
.type-tile.on .ti, .type-tile:hover .ti { color: var(--accent); }
.type-tile .tn { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.check-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.check-chip {
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: var(--card-2);
  padding: 8px 15px;
  font-family: var(--me-sans);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s ease;
}
.check-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wiz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 34px 26px;
}
.wiz-foot-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.wiz-foot .gate-error { margin: 0; }

/* ================= modal + toast ================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 18, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 30px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { font-family: var(--me-serif); font-weight: 500; font-size: 21px; margin: 0 0 14px; }
.modal-close {
  position: absolute;
  top: 12px; right: 15px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
}
.kmodal input, .kmodal textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: var(--me-sans);
  font-size: 14px;
  outline: none;
  margin-bottom: 11px;
}
.kmodal textarea { font-family: var(--me-mono); font-size: 12.5px; line-height: 1.6; resize: vertical; }
.kmodal input:focus, .kmodal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.kmodal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.kmodal-actions .btn-danger { margin-right: auto; }

/* record detail modal (orders / requests / complaints) */
.dmodal { max-width: 620px; }
.dmodal-head .d-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.dmodal-head h3 { margin: 0 0 6px; padding-right: 26px; }
.dmodal-body {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  max-height: min(52vh, 460px);
  overflow-y: auto;
}
.d-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.55;
}
.d-lbl { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.d-val { color: var(--ink); overflow-wrap: anywhere; }
.d-val a { color: var(--accent); text-decoration: none; }
.d-val a:hover { text-decoration: underline; }
.d-dim { color: var(--muted); }
.d-items { margin: 0; padding-left: 18px; }
.d-items li { margin-bottom: 3px; }
.d-para { white-space: pre-wrap; }
.dmodal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 15px;
}
.dmodal-foot .card-actions { margin-top: 0; }
@media (max-width: 560px) {
  .d-row { grid-template-columns: 1fr; gap: 3px; padding: 9px 0; }
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--sf);
  border-radius: 11px;
  padding: 11px 18px;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 80;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= responsive ================= */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow: visible; /* the business-switcher dropdown must escape the bar */
  }
  .side-group, .side-plan { display: none; }
  .side-biz-wrap {
    border-bottom: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 130px;
    order: 10; /* after the icon buttons in the horizontal bar */
  }
  .side-biz { padding: 8px; }
  .side-biz-menu { left: 0; right: auto; min-width: 230px; }
  .side-btn span:not(.badge) { display: none; }
  .side-btn { padding: 10px; width: auto; }
  .main { padding: 0 16px 50px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .home-grid, .channel-grid { grid-template-columns: 1fr; }
  .ob-grid, .wiz-grid2 { grid-template-columns: 1fr; }
  .ob-grid .span2 { grid-column: span 1; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { position: static; }
  .top-email { display: none; }
}
