/* =====================================================================
   WapiFlow — Orange & white SaaS theme
   ===================================================================== */
:root {
  --bg: #fbf8f5;
  --surface: #ffffff;
  --surface-2: #fff9f4;
  --surface-3: #f7f3ef;
  --border: #f0e6dc;
  --border-strong: #e6d8ca;
  --text: #1c1410;
  --text-2: #3f3530;
  --muted: #8a7b70;
  --primary: #f97316;
  --primary-600: #ea580c;
  --primary-700: #c2410c;
  --primary-50: #fff7ed;
  --primary-100: #ffedd5;
  --primary-200: #fed7aa;
  --grad: linear-gradient(135deg, #ffa24c 0%, #f97316 45%, #ea580c 100%);
  --grad-soft: linear-gradient(135deg, #fff7ed, #ffedd5);
  --green: #059669;
  --green-50: #ecfdf5;
  --blue: #0284c7;
  --blue-50: #f0f9ff;
  --amber: #b45309;
  --amber-50: #fffbeb;
  --red: #dc2626;
  --red-50: #fef2f2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-xs: 0 1px 2px rgba(60, 30, 10, .05);
  --shadow: 0 1px 2px rgba(60, 30, 10, .04), 0 6px 20px -10px rgba(234, 88, 12, .14);
  --shadow-lg: 0 2px 6px rgba(60, 30, 10, .05), 0 22px 44px -18px rgba(234, 88, 12, .30);
  --shadow-glow: 0 10px 26px -8px rgba(249, 115, 22, .55);
  --ring: 0 0 0 4px rgba(249, 115, 22, .16);
  --side-w: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.55 "Plus Jakarta Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text); -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 420px at 100% -10%, rgba(255, 162, 76, .16), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(249, 115, 22, .08), transparent 60%),
    radial-gradient(rgba(194, 65, 12, .07) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1 { font-size: 26px; line-height: 1.2; margin: 2px 0; font-weight: 800; letter-spacing: -.025em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 800; }
h3 { font-size: 15.5px; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
code, .mono { font-family: "JetBrains Mono", Consolas, Menlo, monospace; font-size: 12.5px; }
code { background: var(--surface-3); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right !important; }
.err { color: var(--red); }
.link { font-weight: 700; font-size: 13px; }
.masked { letter-spacing: .18em; color: var(--muted); }
.credit { color: var(--primary-700); }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; }
::selection { background: var(--primary-200); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex: none; position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; padding: 18px 14px 14px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(14px) saturate(160%);
  border-right: 1px solid var(--border);
  transition: width .28s var(--ease), transform .28s var(--ease);
}
.sidebar::after { /* soft glow pattern at the top */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 180px; pointer-events: none; z-index: -1;
  background: radial-gradient(260px 140px at 20% 0%, rgba(255, 162, 76, .22), transparent 70%);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font-weight: 800; font-size: 18px; letter-spacing: -.03em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-dark { justify-content: center; padding-bottom: 8px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff;
  background: var(--grad); box-shadow: var(--shadow-glow); position: relative; overflow: hidden;
}
.brand-logo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255, 255, 255, .45), transparent 45%); }
.brand-logo .icon { width: 18px; height: 18px; position: relative; z-index: 1; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 3px; scrollbar-width: thin; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #b3a397; font-weight: 800; padding: 16px 12px 6px; white-space: nowrap; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; white-space: nowrap; transition: background .18s, color .18s, transform .18s var(--ease), box-shadow .18s;
}
.nav-item .icon { color: #a8968a; transition: color .18s; }
.nav-item:hover { background: var(--primary-50); color: var(--primary-700); transform: translateX(2px); }
.nav-item:hover .icon { color: var(--primary); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); }
.nav-item.active .icon { color: #fff; }
.nav-badge { margin-left: auto; font-style: normal; background: #fff; color: var(--primary-700); font-size: 11px; font-weight: 800; border-radius: 99px; padding: 0 7px; line-height: 19px; box-shadow: 0 0 0 1px var(--primary-200); }
.side-wallet {
  display: flex; align-items: center; gap: 11px; padding: 12px; margin: 10px 0 0; border-radius: 14px; color: var(--text);
  background: var(--grad-soft); border: 1px solid var(--primary-100); position: relative; overflow: hidden; white-space: nowrap;
}
.side-wallet::after { content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: rgba(249, 115, 22, .12); }
.side-wallet:hover { color: var(--text); border-color: var(--primary-200); }
.side-wallet-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--primary); box-shadow: var(--shadow-xs); flex: none; }
.side-wallet-text { display: flex; flex-direction: column; line-height: 1.25; }
.side-wallet-text small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.side-wallet-text b { font-size: 14px; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); padding: 4px; border-radius: 12px; }
.me:hover { color: var(--text); background: var(--surface-3); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; white-space: nowrap; }
.me-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 11.5px; }
.avatar { width: 36px; height: 36px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; color: #fff; background: var(--grad); box-shadow: 0 6px 14px -6px rgba(249, 115, 22, .6); }
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 11.5px; }

/* collapsed sidebar (desktop only) */
@media (min-width: 901px) {
.sb-collapsed { --side-w: 84px; }
.sb-collapsed .brand-name, .sb-collapsed .nav-label, .sb-collapsed .nav-item span, .sb-collapsed .me-text,
.sb-collapsed .side-wallet-text, .sb-collapsed .sidebar .logout { display: none; }
.sb-collapsed .sidebar-top { justify-content: center; padding-left: 0; padding-right: 0; }
.sb-collapsed .nav-item { justify-content: center; padding: 12px; }
.sb-collapsed .nav-item:hover { transform: none; }
.sb-collapsed .nav-badge { position: absolute; top: 3px; right: 6px; padding: 0 5px; line-height: 16px; font-size: 10px; }
.sb-collapsed .nav { gap: 6px; padding-top: 8px; }
.sb-collapsed .side-wallet { justify-content: center; padding: 10px; }
.sb-collapsed .sidebar-foot { justify-content: center; }
.sb-collapsed .me { flex: none; }
.sb-collapsed [data-tip]:hover::before {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  box-shadow: var(--shadow-lg); z-index: 60; pointer-events: none;
}
.sb-collapsed .side-wallet, .sb-collapsed .me { position: relative; overflow: visible; }
.sb-collapsed .side-wallet::after { display: none; }
.sb-collapsed .nav { overflow: visible; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 30px; position: sticky; top: 0; z-index: 30;
  background: rgba(251, 248, 245, .72); backdrop-filter: blur(16px) saturate(170%); border-bottom: 1px solid rgba(240, 230, 220, .8);
}
.topbar-title { font-weight: 700; color: var(--text-2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.wallet-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 99px; color: var(--text);
  background: #fff; border: 1px solid var(--primary-100); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s;
}
.wallet-chip:hover { color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.wallet-chip-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: var(--shadow-glow); }
.wallet-chip-ico .icon { width: 16px; height: 16px; }
.wallet-chip-text { display: flex; flex-direction: column; line-height: 1.15; }
.wallet-chip-text small { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.wallet-chip-text b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.wallet-chip.is-empty { border-color: #fecaca; }
.wallet-chip.is-empty .wallet-chip-ico { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 10px 22px -10px rgba(220, 38, 38, .55); }
.wallet-chip.is-empty b { color: var(--red); }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 99px; color: var(--text);
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-xs); transition: border-color .2s, box-shadow .2s;
}
.user-chip:hover { color: var(--text); border-color: var(--primary-200); box-shadow: var(--shadow); }
.user-chip .avatar { border-radius: 50%; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.user-chip-text b { font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { font-size: 11px; color: var(--muted); }
.logout-btn { background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.logout-btn:hover { background: var(--red-50); color: var(--red); border-color: #fecaca; }
/* fade-in uses opacity only: a transform here would trap position:fixed popups inside .content */
.content { padding: 30px; max-width: 1340px; width: 100%; margin: 0 auto; animation: fadein .4s ease both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.backdrop { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.back:hover { color: var(--primary-600); }
.back .icon { width: 15px; height: 15px; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; margin-top: 10px; }
.meta-row > span { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); padding: 4px 10px; border-radius: 99px; box-shadow: var(--shadow-xs); }
.meta-row .icon { width: 14px; height: 14px; color: var(--primary); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form, .acct-actions form, form.inline { margin: 0; display: inline-block; }

/* ---------- Hero (dashboard) ---------- */
.hero {
  position: relative; overflow: hidden; display: flex; gap: 24px; align-items: stretch; justify-content: space-between; flex-wrap: wrap;
  padding: 30px 32px; border-radius: 24px; margin-bottom: 24px; color: #fff; background: var(--grad); box-shadow: var(--shadow-lg);
}
.hero::before { /* dot grid pattern */
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .55) 1.2px, transparent 1.2px); background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(100deg, transparent 20%, #000 75%); mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
}
.hero::after { /* glow orbs */
  content: ""; position: absolute; width: 420px; height: 420px; right: -120px; top: -180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 65%);
}
.hero > * { position: relative; z-index: 1; }
.hero-copy { max-width: 620px; }
.hero h1 { color: #fff; font-size: 28px; margin: 10px 0 6px; }
.hero p { color: rgba(255, 255, 255, .88); font-size: 15px; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28); backdrop-filter: blur(6px); }
.hero-eyebrow .icon { width: 14px; height: 14px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-wallet {
  min-width: 250px; padding: 20px 22px; border-radius: 18px; color: #fff; display: flex; flex-direction: column; justify-content: center;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .32); backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); transition: transform .25s var(--ease), background .25s;
}
a.hero-wallet:hover { color: #fff; transform: translateY(-3px); background: rgba(255, 255, 255, .22); }
.hero-wallet span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; opacity: .92; }
.hero-wallet b { font-size: 38px; letter-spacing: -.03em; line-height: 1.15; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.hero-wallet small { opacity: .85; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 22px;
  box-shadow: var(--shadow); transition: box-shadow .25s var(--ease), border-color .25s;
}
.card.no-pad { padding: 0; overflow: hidden; }
.card.narrow { max-width: 540px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; }
.card-head.pad { padding: 20px 24px 4px; }
.form-card { border-color: var(--primary-200); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.form-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--grad); }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.empty-state { text-align: center; padding: 52px 24px; }
.empty-state h3 { margin: 16px 0 6px; font-size: 17px; }
.empty-state p { max-width: 420px; margin: 0 auto 18px; }
.empty-ico { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary-100), 0 12px 26px -14px rgba(249, 115, 22, .6); }
.empty-ico .icon { width: 28px; height: 28px; }
.banner { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: var(--radius); margin-bottom: 22px; background: #fff; border: 1px dashed var(--primary-200); box-shadow: var(--shadow); }
.banner p { margin: 2px 0 0; color: var(--muted); }
.banner > div:nth-child(2) { flex: 1; }
.banner-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); flex: none; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 700; font-size: 13px; color: var(--text-2); margin-bottom: 7px; }
.field > span em { font-style: normal; font-weight: 500; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
input, select, textarea {
  display: block; width: 100%; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; color: var(--text); background: #fff; transition: border-color .18s, box-shadow .18s, background .18s;
  box-shadow: var(--shadow-xs);
}
input:hover, select:hover, textarea:hover { border-color: #d9c4b0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[readonly], textarea[readonly] { background: var(--surface-2); }
input[type=checkbox], input[type=radio] { width: auto; display: inline-block; accent-color: var(--primary); box-shadow: none; }
textarea { resize: vertical; }
textarea.mono { font-size: 13px; line-height: 1.65; }
textarea.code, pre.code { font-family: "JetBrains Mono", Consolas, Menlo, monospace; font-size: 12.5px; background: #1c1410; color: #fed7aa; border-color: #1c1410; }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ea580c' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; cursor: pointer; font-weight: 500; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.check-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: #fff; transition: border-color .18s, background .18s, box-shadow .18s; }
.check-card:hover { border-color: var(--primary-200); }
.check-card input { margin-top: 3px; }
.check-card span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.check-card small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.perm-card { margin-top: 4px; border-style: dashed; }
.perm-card small { white-space: normal; }
.check-card:has(input:checked) { border-color: var(--primary); background: var(--primary-50); box-shadow: var(--ring); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select { width: auto; min-width: 190px; }
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: -4px; }
.input-sm { padding: 7px 10px; width: 140px; font-size: 13px; }
.dropzone { border: 1.5px dashed var(--primary-200); border-radius: var(--radius-sm); padding: 18px; background: var(--surface-2); margin-bottom: 4px; }
.dropzone .field { margin-bottom: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 2px 0 10px; font-weight: 600; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.step { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step h3 { margin: 0; flex: 1; }
.step > span { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: var(--grad); box-shadow: 0 6px 14px -6px rgba(249, 115, 22, .7); }
.chip { font-style: normal; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 99px; background: var(--primary-50); color: var(--primary-700); border: 1px solid var(--primary-100); }
.segmented { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border); margin-bottom: 18px; }
.segmented input { display: none; }
.segmented span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.segmented span .icon { width: 15px; height: 15px; }
.segmented input:checked + span { background: #fff; color: var(--primary-700); box-shadow: var(--shadow); }
.filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 180px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0 12px; background: #fff; margin: 10px 16px; transition: box-shadow .18s, border-color .18s; }
.search:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.search .icon { color: var(--muted); width: 16px; height: 16px; }
.search input { border: 0; padding: 9px 0; box-shadow: none; width: 200px; }
.search input:focus { box-shadow: none; }
.cost-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; margin-bottom: 16px; border-radius: var(--radius-sm); background: var(--grad-soft); border: 1px solid var(--primary-100); }
.cost-box span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cost-box b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cost-box.short { background: var(--red-50); border-color: #fecaca; }
.cost-box.short #costAfter { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); font: inherit; font-weight: 700; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
  transition: background .18s, border-color .18s, box-shadow .2s, transform .18s var(--ease), color .18s;
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: #dcc7b3; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-primary::after { /* shine sweep */
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); transform: skewX(-20deg); transition: left .6s var(--ease);
}
.btn-primary:hover { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 14px 30px -10px rgba(249, 115, 22, .7); filter: saturate(1.08); }
.btn-primary:hover::after { left: 130%; }
.btn-danger { background: linear-gradient(135deg, #f87171, #dc2626); border-color: transparent; color: #fff; box-shadow: 0 10px 24px -10px rgba(220, 38, 38, .6); }
.btn-danger:hover { color: #fff; background: linear-gradient(135deg, #f87171, #b91c1c); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-white { background: #fff; color: var(--primary-700); border-color: #fff; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .35); }
.btn-white:hover { background: #fff; color: var(--primary-700); border-color: #fff; }
.btn-glass { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .35); backdrop-filter: blur(6px); box-shadow: none; }
.btn-glass:hover { background: rgba(255, 255, 255, .26); color: #fff; border-color: rgba(255, 255, 255, .5); }
.danger { color: var(--red) !important; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent; display: inline-grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; transition: background .18s, color .18s; }
.icon-btn:hover { background: var(--primary-50); color: var(--primary-600); }
.icon-btn.copied { color: var(--green); }
.menu-btn { background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.badge-btn { border: 0; background: none; padding: 0; cursor: pointer; transition: transform .15s; }
.badge-btn:hover:not(:disabled) { transform: scale(1.05); }
.badge-btn:disabled { cursor: default; }

/* ---------- Alerts / badges / tags ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 14px; margin-bottom: 20px; border: 1px solid; font-size: 13.5px; box-shadow: var(--shadow-xs); animation: rise .35s var(--ease) both; }
.alert > .icon { margin-top: 1px; }
.alert > span { flex: 1; min-width: 0; }
.alert-success { background: var(--green-50); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--red-50); border-color: #fecaca; color: #991b1b; }
.alert-warn { background: var(--amber-50); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--blue-50); border-color: #bae6fd; color: #075985; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #f5f0eb; color: #6b5d53; white-space: nowrap; line-height: 1.4; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(0, 0, 0, .04); }
.badge-approved, .badge-completed, .badge-delivered { background: var(--green-50); color: #047857; }
.badge-read { background: #e0f2fe; color: #0369a1; }
.badge-sent { background: var(--primary-50); color: var(--primary-700); }
.badge-sending { background: var(--primary-100); color: var(--primary-700); }
.badge-sending i { animation: pulse 1.1s infinite; }
.badge-scheduled { background: #f5f3ff; color: #6d28d9; }
.badge-pending, .badge-queued, .badge-draft, .badge-paused { background: var(--amber-50); color: var(--amber); }
.badge-rejected, .badge-failed { background: var(--red-50); color: #b91c1c; }
.badge-waiting { background: #eef2ff; color: #4338ca; }
.badge-waiting i { animation: pulse 2s infinite; }
.badge-cancelled { background: #f5f0eb; color: #8a7b70; }
.badge-admin { background: var(--grad); color: #fff; }
.badge-user { background: #f5f0eb; color: #6b5d53; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 7px; background: #f5f0eb; color: #6b5d53; }
.tag-utility { background: #ecfeff; color: #0e7490; }
.tag-marketing { background: #fff1f2; color: #be123c; }
.tag-authentication { background: #f5f3ff; color: #6d28d9; }
.count { font-style: normal; font-size: 11px; background: var(--primary); color: #fff; border-radius: 99px; padding: 0 7px; margin-left: 4px; font-weight: 800; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
  position: relative; overflow: hidden; display: flex; gap: 14px; align-items: flex-start; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.kpi::after { /* corner ring pattern */
  content: ""; position: absolute; right: -36px; bottom: -36px; width: 110px; height: 110px; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(249, 115, 22, .07) 0 2px, transparent 2px 10px); transition: transform .5s var(--ease);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-100); }
.kpi:hover::after { transform: scale(1.25) rotate(20deg); }
.kpi > div:last-child { min-width: 0; position: relative; z-index: 1; }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.3; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; background: #f5f0eb; color: #6b5d53; position: relative; z-index: 1; }
.ico-indigo, .ico-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); }
.ico-green { background: linear-gradient(135deg, #34d399, #059669); color: #fff; box-shadow: 0 10px 22px -10px rgba(5, 150, 105, .6); }
.ico-blue { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; box-shadow: 0 10px 22px -10px rgba(2, 132, 199, .6); }
.ico-red { background: linear-gradient(135deg, #fb7185, #dc2626); color: #fff; box-shadow: 0 10px 22px -10px rgba(220, 38, 38, .55); }

/* ---------- Progress ---------- */
.progress-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.progress { height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(60, 30, 10, .08); }
.progress-bar {
  height: 100%; width: 0; border-radius: 99px; transition: width .6s var(--ease);
  background: linear-gradient(90deg, #ffa24c, #f97316, #ea580c);
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .22) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, .22) 75%, transparent 75%), linear-gradient(90deg, #ffa24c, #f97316, #ea580c);
  background-size: 22px 22px, 100% 100%; animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 22px 0, 0 0; } }
.funnel { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; color: var(--muted); font-weight: 600; }
.funnel b { color: var(--text); margin-left: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot-indigo, .dot-primary { background: var(--primary); }
.dot-soft { background: var(--primary-200); }
.dot-green { background: #10b981; }
.dot-blue { background: #0ea5e9; }
.dot-red { background: #ef4444; }
.mini-progress { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.mini-progress div { height: 100%; background: var(--grad); border-radius: 99px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 20px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-2); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #a08e81; white-space: nowrap; }
.table tbody tr { transition: background .15s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fffaf5; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: #fff; }
.tabs { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 700; border-radius: 10px; white-space: nowrap; transition: all .18s; font-size: 13px; }
.tabs a:hover { color: var(--primary-700); background: var(--primary-50); }
.tabs a.active { color: #fff; background: var(--grad); box-shadow: 0 8px 18px -8px rgba(249, 115, 22, .7); }
.tabs a.active .count { background: #fff; color: var(--primary-700); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); gap: 12px; background: var(--surface-2); }
.pager { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.pager a { font-weight: 800; }
.user-cell { display: flex; gap: 11px; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
pre.code { padding: 14px; border-radius: 12px; overflow: auto; max-height: 360px; white-space: pre-wrap; word-break: break-all; }
details summary { cursor: pointer; }
.tx { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 3px 10px 3px 6px; border-radius: 99px; }
.tx .icon { width: 13px; height: 13px; }
.tx-credit { background: var(--green-50); color: #047857; }
.tx-refund { background: #e0f2fe; color: #0369a1; }
.tx-debit { background: var(--primary-50); color: var(--primary-700); }
.amt { font-weight: 800; }
.amt.pos { color: #047857; }
.amt.neg { color: var(--primary-700); }

/* ---------- Layout grids ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; align-items: start; }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split-dash { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.split-users { grid-template-columns: minmax(0, 1fr) 320px; }
.preview-col { position: sticky; top: 92px; }
.preview-title { text-align: center; font-weight: 800; color: var(--muted); margin-bottom: 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; }

/* ---------- Wallet ---------- */
.wallet-hero {
  position: relative; overflow: hidden; display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  padding: 28px 30px; border-radius: 24px; margin-bottom: 24px; color: #fff; background: var(--grad); box-shadow: var(--shadow-lg);
}
.wallet-hero::before { content: ""; position: absolute; inset: 0; opacity: .3; background-image: linear-gradient(rgba(255, 255, 255, .4) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .4) 1px, transparent 1px); background-size: 28px 28px; -webkit-mask-image: radial-gradient(circle at 85% 30%, #000, transparent 65%); mask-image: radial-gradient(circle at 85% 30%, #000, transparent 65%); }
.wallet-hero > * { position: relative; }
.wallet-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; opacity: .92; }
.wallet-amount { font-size: 46px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.wallet-amount small { font-size: 18px; font-weight: 700; opacity: .85; letter-spacing: 0; }
.wallet-sub { opacity: .85; font-size: 13px; }
.wallet-stats { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 12px; }
.wallet-stats > div { padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); backdrop-filter: blur(8px); }
.wallet-stats span { display: block; font-size: 12px; opacity: .9; font-weight: 600; }
.wallet-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* admin wallet */
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-wallet { grid-template-columns: minmax(0, 1fr) 360px; }
.wallet-side { position: sticky; top: 92px; }
.pad-x { padding: 8px 16px; }
.pad-x select { min-width: 180px; padding-top: 8px; padding-bottom: 8px; }
.seg-full { display: flex; width: 100%; }
.seg-full label { flex: 1; }
.seg-full span { width: 100%; justify-content: center; }
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin: -8px 0 18px; }
.chip-btn { border: 1px solid var(--primary-100); background: var(--primary-50); color: var(--primary-700); font: inherit; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; cursor: pointer; transition: all .15s; }
.chip-btn:hover { background: var(--primary-100); border-color: var(--primary-200); }
.bal-list { list-style: none; margin: 0; padding: 6px 10px 10px; max-height: 420px; overflow-y: auto; }
.bal-list a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; color: var(--text); transition: background .15s; }
.bal-list a:hover, .bal-list a.active { background: var(--primary-50); color: var(--text); }
.bal-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.bal-name b { font-size: 13px; }
.bal-name small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-amt { font-variant-numeric: tabular-nums; color: var(--primary-700); }
.bal-amt.zero { color: var(--red); }

/* ---------- Accounts ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.acct-card { margin: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.acct-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, #34d399, #059669); opacity: .9; }
.acct-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary-100); }
.acct-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.acct-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acct-title b { font-size: 15.5px; }
.acct-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #34d399, #059669); color: #fff; flex: none; box-shadow: 0 10px 22px -10px rgba(5, 150, 105, .65); }
.acct-ico.sm { width: 36px; height: 36px; border-radius: 11px; box-shadow: none; }
.acct-ico.sm .icon { width: 16px; height: 16px; }
.acct-cta { margin-top: auto; align-self: flex-start; }
.hook { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 16px; }
.hook summary { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; list-style: none; }
.hook summary::-webkit-details-marker { display: none; }
.hook summary .icon { width: 15px; height: 15px; color: var(--primary); }
.hook p { margin: 10px 0; }
.copy-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.copy-row span { font-size: 12px; color: var(--muted); width: 88px; flex: none; font-weight: 600; }
.copy-row input { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; padding: 8px 10px; }
.acct-actions { display: flex; gap: 8px; margin-top: auto; }
.acct-actions form:last-child { margin-left: auto; }
.acct-list { list-style: none; margin: 0; padding: 0; }
.acct-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.acct-list li:last-child { border-bottom: 0; }
.acct-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #d6c8bc; flex: none; }
.status-dot.ok { background: #10b981; box-shadow: 0 0 0 4px #d1fae5; }
.status-dot.bad { background: #ef4444; box-shadow: 0 0 0 4px #fee2e2; }

/* ---------- Templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.tpl-card { margin: 0; display: flex; flex-direction: column; transition: box-shadow .25s var(--ease), border-color .25s, transform .25s var(--ease); }
.tpl-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary-200); transform: translateY(-3px); }
.tpl-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tpl-title b { font-size: 15.5px; word-break: break-all; }
.tpl-body {
  background-color: #efeae2; background-image: radial-gradient(rgba(0, 0, 0, .04) 1px, transparent 1px); background-size: 12px 12px;
  border-radius: 14px; padding: 14px; margin: 16px 0; flex: 1; font-size: 13px; color: #111b21; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .03);
}
.tpl-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl-foot > span { display: inline-flex; align-items: center; gap: 6px; }
.tpl-foot .icon { width: 14px; height: 14px; }

/* ---------- Dashboard chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 230px; padding-top: 10px; background-image: linear-gradient(var(--border) 1px, transparent 1px); background-size: 100% 25%; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.bar-col span { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar-stack { flex: 1; width: 100%; max-width: 34px; position: relative; display: flex; align-items: flex-end; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 8px 8px 3px 3px; min-height: 3px; transition: height .5s var(--ease); }
.bar-sent { background: var(--primary-100); }
.bar-del { background: linear-gradient(180deg, #ffa24c, #ea580c); left: 20%; right: 20%; box-shadow: 0 6px 14px -6px rgba(249, 115, 22, .7); }
.bar-col:hover .bar-sent { background: var(--primary-200); }

/* ---------- Static modals ---------- */
.modal, .ui-modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px;
  background: rgba(28, 20, 16, .42); backdrop-filter: blur(6px); opacity: 0; transition: opacity .18s ease;
}
.modal.open, .ui-modal.open { opacity: 1; }
.modal-card, .ui-modal-card {
  width: 100%; max-width: 480px; max-height: calc(100vh - 36px); overflow: auto; background: #fff; border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(60, 30, 10, .45); transform: translateY(14px) scale(.97); transition: transform .25s var(--ease);
}
.modal-lg { max-width: 640px; }
.modal.open .modal-card, .ui-modal.open .ui-modal-card { transform: none; }
.modal-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 6px; }
.modal-head > div:nth-child(2) { flex: 1; min-width: 0; }
.modal-head h3 { margin: 2px 0 2px; font-size: 17px; }
.modal-head p { margin: 0; }
.modal-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); flex: none; }
.modal-body { padding: 16px 22px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--border); margin-top: 10px; background: var(--surface-2); }

/* ---------- Confirm popups ---------- */
.ui-modal-card { max-width: 440px; padding: 28px 26px 22px; text-align: center; position: relative; overflow: hidden; }
.ui-modal-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 120px; background: radial-gradient(260px 120px at 50% 0, rgba(255, 162, 76, .22), transparent 70%); pointer-events: none; }
.ui-modal-ico { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: var(--shadow-glow); position: relative; animation: pop .4s var(--ease) both; }
.ui-modal-ico .icon { width: 26px; height: 26px; }
.tone-danger .ui-modal-ico { background: linear-gradient(135deg, #fb7185, #dc2626); box-shadow: 0 12px 26px -10px rgba(220, 38, 38, .6); }
.tone-warn .ui-modal-ico { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 12px 26px -10px rgba(217, 119, 6, .6); }
.ui-modal-card h3 { font-size: 19px; margin: 0 0 8px; position: relative; }
.ui-modal-msg { color: var(--text-2); font-size: 14px; position: relative; }
.ui-modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.ui-modal-actions .btn { flex: 1; padding: 12px; }
.ui-summary { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; text-align: left; margin: 6px 0 0; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; }
.ui-summary dt { color: var(--muted); font-weight: 600; }
.ui-summary dd { margin: 0; font-weight: 700; word-break: break-word; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 18px 40px -14px rgba(28, 20, 16, .55); transform: translateY(10px); opacity: 0; transition: all .25s var(--ease);
}
.toast.show { transform: none; opacity: 1; }
.toast .icon { color: var(--primary-200); }
.toast-success .icon { color: #6ee7b7; }
.toast-error .icon { color: #fca5a5; }

/* ---------- Auth ---------- */
.auth-body { background: #fff; }
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; padding: 40px 56px; color: #fff; display: flex; flex-direction: column; background: var(--grad); }
.auth-hero::before { content: ""; position: absolute; inset: 0; opacity: .35; background-image: linear-gradient(rgba(255, 255, 255, .35) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .35) 1px, transparent 1px); background-size: 34px 34px; -webkit-mask-image: radial-gradient(circle at 70% 40%, #000, transparent 70%); mask-image: radial-gradient(circle at 70% 40%, #000, transparent 70%); }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 65%); }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .brand { color: #fff; }
.auth-hero .brand-logo { background: #fff; color: var(--primary); }
.auth-hero-copy { margin: auto 0; max-width: 480px; }
.auth-hero h1 { font-size: 44px; line-height: 1.08; letter-spacing: -.035em; margin-bottom: 18px; color: #fff; display: block; }
.auth-hero p { color: rgba(255, 255, 255, .9); font-size: 15.5px; }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-hero li { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.auth-hero li .icon { width: 30px; height: 30px; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .3); }
.hero-float { position: absolute; right: 48px; top: 90px; display: grid; gap: 14px; z-index: 1; }
.float-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, .95); color: var(--text); box-shadow: 0 20px 40px -18px rgba(60, 30, 10, .5); animation: float 6s ease-in-out infinite; }
.float-card b { display: block; font-size: 15px; }
.float-card small { color: var(--muted); font-size: 12px; }
.fc-2 { margin-left: 40px; animation-delay: -3s; }
.fc-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--grad); color: #fff; }
@keyframes float { 50% { transform: translateY(-10px); } }
.auth-panel { display: grid; place-items: center; padding: 32px; background-image: radial-gradient(rgba(194, 65, 12, .07) 1px, transparent 1px); background-size: 22px 22px; }
.auth-form { width: 100%; max-width: 390px; background: #fff; padding: 34px; border-radius: 24px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.auth-form h2 { font-size: 26px; }
.auth-form .muted { margin-bottom: 24px; }
.auth-single { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 440px; }

/* ---------- Phone preview ---------- */
.phone { width: 320px; height: 640px; margin: 0 auto; background: #1c1410; border-radius: 48px; padding: 11px; position: relative; box-shadow: 0 40px 70px -28px rgba(60, 30, 10, .55), 0 0 0 1px #3a2c24, inset 0 0 0 2px #3a2c24; }
.phone::before { content: ""; position: absolute; right: -3px; top: 120px; width: 3px; height: 60px; border-radius: 0 3px 3px 0; background: #3a2c24; }
.phone-notch { position: absolute; top: 11px; left: 50%; transform: translateX(-50%); width: 110px; height: 26px; background: #1c1410; border-radius: 0 0 16px 16px; z-index: 2; }
.phone-screen { height: 100%; border-radius: 38px; overflow: hidden; display: flex; flex-direction: column; background: #efeae2; }
.wa-top { background: #075e54; color: #fff; display: flex; align-items: center; gap: 10px; padding: 36px 12px 10px; }
.wa-back { font-size: 26px; line-height: 1; }
.wa-avatar { width: 34px; height: 34px; border-radius: 50%; background: #dfe5e7; color: #075e54; display: grid; place-items: center; font-weight: 700; }
.wa-name { font-weight: 600; font-size: 14px; }
.wa-verified { display: inline-grid; place-items: center; width: 14px; height: 14px; background: #25d366; color: #fff; border-radius: 50%; font-size: 8px; vertical-align: middle; }
.wa-sub { font-size: 11px; opacity: .8; }
.wa-chat { flex: 1; overflow-y: auto; padding: 12px 10px; background-color: #efeae2; background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px); background-size: 14px 14px; }
.wa-day { margin: 0 auto 10px; width: max-content; background: #fff; color: #54656f; font-size: 11px; padding: 3px 10px; border-radius: 7px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.wa-bubble { background: #fff; border-radius: 0 8px 8px 8px; padding: 4px; max-width: 88%; box-shadow: 0 1px 1px rgba(0, 0, 0, .12); position: relative; font-size: 13.5px; color: #111b21; word-wrap: break-word; animation: rise .3s var(--ease) both; }
.wa-bubble::before { content: ""; position: absolute; left: -8px; top: 0; border-style: solid; border-width: 0 8px 8px 0; border-color: transparent #fff transparent transparent; }
.wa-media { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 6px; background: #ddd; }
.wa-media-ph { height: 140px; border-radius: 6px; background: #d9dee2; display: grid; place-items: center; color: #6b7684; font-size: 14px; }
.wa-doc { display: flex; align-items: center; gap: 10px; background: #f5f6f6; border-radius: 6px; padding: 10px; font-size: 12.5px; word-break: break-all; }
.wa-doc-ico { flex: none; background: #e53935; color: #fff; font-size: 9px; font-weight: 700; padding: 6px 5px; border-radius: 3px; }
.wa-header { font-weight: 700; padding: 4px 6px 0; }
.wa-text { padding: 4px 6px 0; }
.wa-text code { background: #f0f2f5; padding: 0 3px; border-radius: 3px; border: 0; }
.wa-placeholder { color: #9aa4ad; }
.wa-var { background: #fff3c4; border-radius: 3px; padding: 0 2px; }
.wa-link { color: #027eb5; }
.wa-footer { color: #8696a0; font-size: 12px; padding: 4px 6px 0; }
.wa-time { text-align: right; font-size: 10.5px; color: #667781; padding: 2px 6px; }
.wa-ticks { color: #53bdeb; }
.wa-input { display: flex; gap: 6px; padding: 8px; background: #efeae2; }
.wa-input-box { flex: 1; background: #fff; border-radius: 20px; padding: 8px 14px; color: #8696a0; font-size: 13px; }
.wa-mic { width: 36px; height: 36px; border-radius: 50%; background: #00a884; display: grid; place-items: center; font-size: 15px; }

/* ---------- Inbox ---------- */
.page-inbox .content { padding: 0; max-width: none; animation: none; }
.page-inbox .flash { margin: 12px 16px 0; }
.inbox { display: grid; grid-template-columns: 370px minmax(0, 1fr); height: calc(100vh - 68px); height: calc(100dvh - 68px); background: #fff; border-top: 1px solid var(--border); }
.ib-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: #fff; }
.ib-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 18px 10px; }
.ib-list-head h2 { margin: 0; font-size: 21px; }
.ib-list-head select { width: auto; max-width: 170px; padding: 7px 32px 7px 10px; font-size: 13px; }
.ib-search { display: flex; align-items: center; gap: 8px; margin: 0 14px 10px; padding: 0 12px; border-radius: 12px; background: var(--surface-3); border: 1px solid transparent; transition: border-color .18s, background .18s, box-shadow .18s; }
.ib-search:focus-within { background: #fff; border-color: var(--primary); box-shadow: var(--ring); }
.ib-search .icon { width: 16px; height: 16px; color: var(--muted); }
.ib-search input { border: 0; background: transparent; box-shadow: none; padding: 10px 0; }
.ib-search input:focus { box-shadow: none; }
.ib-filters { display: flex; gap: 6px; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.ib-filters button { border: 1px solid var(--border); background: #fff; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 99px; cursor: pointer; transition: all .15s; }
.ib-filters button:hover { color: var(--primary-700); border-color: var(--primary-200); }
.ib-filters button.active { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-200); }
.ib-items { flex: 1; overflow-y: auto; min-height: 0; }
.ib-loading { padding: 32px 22px; text-align: center; color: var(--muted); font-size: 13px; }
.ib-item { display: flex; gap: 12px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left; font: inherit; color: var(--text); cursor: pointer; border-bottom: 1px solid #f6efe8; transition: background .12s; }
.ib-item:hover { background: #fffaf5; }
.ib-item.active { background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.ib-avatar { position: relative; width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; background: var(--grad); }
.ib-live { position: absolute; right: 0; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px #fff; }
.ib-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.ib-item-top, .ib-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ib-item-top b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.ib-item-top time { font-size: 11.5px; color: var(--muted); flex: none; }
.ib-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item.unread .ib-item-top b { font-weight: 800; }
.ib-item.unread .ib-item-top time { color: #16a34a; font-weight: 700; }
.ib-item.unread .ib-preview { color: var(--text-2); font-weight: 600; }
.ib-unread { font-style: normal; flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #22c55e; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.ib-acct { font-size: 11px; color: var(--primary-700); font-weight: 700; }

.ib-chat { position: relative; display: flex; min-width: 0; min-height: 0; background-color: #efeae2; }
.ib-chat::before { /* WhatsApp-like doodle pattern */
  content: ""; position: absolute; inset: 0; opacity: .55; pointer-events: none;
  background-image: radial-gradient(rgba(0, 0, 0, .06) 1px, transparent 1.2px), radial-gradient(rgba(249, 115, 22, .07) 1.5px, transparent 1.8px);
  background-size: 18px 18px, 46px 46px; background-position: 0 0, 9px 14px;
}
.ib-empty { position: relative; margin: auto; text-align: center; max-width: 380px; padding: 24px; }
.ib-empty-ico { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 26px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: var(--shadow-glow); }
.ib-empty-ico .icon { width: 38px; height: 38px; }
.ib-empty h3 { font-size: 20px; margin-bottom: 8px; }
.ib-chat-inner { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ib-chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); z-index: 2; }
.ib-chat-head .ib-avatar { width: 42px; height: 42px; font-size: 14px; }
.ib-back { display: none; }
.ib-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ib-who b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-who small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-window { flex: none; font-size: 12px; font-weight: 800; padding: 6px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ib-window.open { background: #dcfce7; color: #15803d; }
.ib-window.ending { background: var(--amber-50); color: var(--amber); animation: pulse 1.6s infinite; }
.ib-window.closed { background: #f5f0eb; color: var(--muted); }
.ib-messages { flex: 1; overflow-y: auto; min-height: 0; padding: 18px 7% 10px; display: flex; flex-direction: column; gap: 3px; scroll-behavior: auto; }
.ib-day { align-self: center; margin: 12px 0 8px; }
.ib-day span { display: inline-block; background: rgba(255, 255, 255, .95); color: #54656f; font-size: 11.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.ib-row { display: flex; }
.ib-row.out { justify-content: flex-end; }
.ib-row.sending { opacity: .65; }
.ib-bubble { position: relative; max-width: min(72%, 560px); padding: 7px 10px 5px; border-radius: 10px; background: #fff; color: #111b21; font-size: 14px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); word-wrap: break-word; overflow-wrap: anywhere; animation: bubble-in .2s ease; }
@keyframes bubble-in { from { transform: translateY(6px); } } /* movement only, never hides content */
.ib-row.in .ib-bubble { border-top-left-radius: 3px; }
.ib-row.out .ib-bubble { background: #d9fdd3; border-top-right-radius: 3px; }
.ib-bubble.media .ib-text { font-style: italic; color: #3b4a54; }
.ib-text code { background: rgba(0, 0, 0, .06); border: 0; }
.ib-meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 2px; font-size: 11px; color: #667781; }
.ib-by { margin-right: auto; padding-right: 10px; font-weight: 700; color: #5c6f7b; }
.ib-ticks { font-size: 11.5px; letter-spacing: -2px; color: #8696a0; font-weight: 700; }
.ib-ticks.t-read { color: #53bdeb; }
.ib-ticks.t-failed { letter-spacing: 0; color: #fff; background: var(--red); border-radius: 50%; width: 15px; height: 15px; display: inline-grid; place-items: center; font-size: 10px; }
.ib-err { margin-top: 4px; font-size: 12px; color: var(--red); }
.ib-more { align-self: center; margin: 4px 0 10px; border: 0; background: rgba(255, 255, 255, .95); color: var(--primary-700); font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 14px; border-radius: 99px; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.ib-composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 16px; background: #f6f1ec; border-top: 1px solid var(--border); z-index: 2; }
.ib-composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 16px; border-radius: 22px; border: 1px solid var(--border); line-height: 1.4; box-shadow: none; }
.ib-send { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: var(--shadow-glow); cursor: pointer; transition: transform .15s var(--ease); }
.ib-send:hover { transform: scale(1.06); }
.ib-send:disabled { opacity: .6; cursor: default; transform: none; }
.ib-closed { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; background: #f6f1ec; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; z-index: 2; }
.ib-closed .icon { color: var(--primary); }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .split, .split-even, .split-dash, .split-users, .split-wallet { grid-template-columns: 1fr; }
  .preview-col, .wallet-side { position: static; }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-float { display: none; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-105%); box-shadow: var(--shadow-lg); background: #fff; }
  .nav-open .sidebar { transform: none; }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(28, 20, 16, .4); backdrop-filter: blur(3px); z-index: 35; }
  .topbar { padding: 0 16px; height: 62px; }
  .content { padding: 20px 16px; }
  .kpis, .kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  /* login on phones: compact gradient header, form card overlapping it */
  .auth { grid-template-columns: 1fr; min-height: 100dvh; align-content: start; }
  .auth-hero { padding: 22px 20px 70px; }
  .auth-hero::after { width: 300px; height: 300px; right: -90px; bottom: -150px; }
  .auth-hero-copy { margin: 22px 0 0; }
  .auth-hero h1 { font-size: 27px; margin-bottom: 8px; }
  .auth-hero p { font-size: 14px; margin: 0; }
  .auth-hero ul { display: none; }
  .auth-panel { padding: 0 16px 28px; margin-top: -48px; place-items: start center; background-image: none; position: relative; z-index: 2; }
  .auth-form { padding: 26px 22px; border-radius: 22px; max-width: 460px; }
  .auth-form h2 { font-size: 22px; }
  .auth-form .muted { margin-bottom: 18px; }
  .auth-form input { padding: 13px 14px; font-size: 16px; } /* 16px stops iOS zooming into the field */
  /* inbox on phones: list first, chat full screen when opened */
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 62px); height: calc(100dvh - 62px); }
  .inbox .ib-chat { display: none; }
  .inbox.show-chat .ib-list { display: none; }
  .inbox.show-chat .ib-chat { display: flex; }
  .ib-back { display: inline-grid; margin-left: -8px; }
  .ib-chat-head { padding: 8px 12px; gap: 10px; }
  .ib-messages { padding: 12px 10px 8px; }
  .ib-bubble { max-width: 86%; }
  .ib-composer { padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .ib-composer textarea { font-size: 16px; }
  .ib-window { padding: 5px 9px; font-size: 11px; }
  .page-inbox .topbar-title { display: none; }
  .acct-grid, .tpl-grid { grid-template-columns: 1fr; }
  .hide-sm, .wallet-chip-text small, .user-chip-text { display: none; }
  .user-chip { padding: 3px; }
  .topbar-right { gap: 8px; }
  .search input { width: 140px; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 23px; }
  .hero-wallet { min-width: 0; width: 100%; }
  .wallet-stats { grid-template-columns: 1fr 1fr 1fr; width: 100%; }
  .cost-box { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 480px) {
  .auth-hero .brand { font-size: 16px; }
  .ib-who small { display: none; }
  .kpis, .kpis-3 { grid-template-columns: 1fr; }
  .phone { width: 100%; height: 600px; }
  .wallet-stats { grid-template-columns: 1fr; }
  .wallet-amount { font-size: 36px; }
  .topbar-right .btn { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
