/* ==========================================================================
   Design system — shared by the portal and the white-label template.
   Brand colour comes from --brand (set per site in <head>).
   ========================================================================== */
:root {
  --brand: #4f46e5; --brand-rgb: 79, 70, 229;
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f9fafc; --line: #e7e9f0; --line-2: #eef0f5;
  --text: #171b2c; --text-2: #4b5368; --muted: #7c8398;
  --green: #0f9f6e; --green-bg: #e6f7f0; --amber: #b7791f; --amber-bg: #fdf4e3; --red: #d93a49; --red-bg: #fdecee;
  --blue: #2563eb; --blue-bg: #e8f0fe; --violet: #7c3aed; --violet-bg: #f1eafe; --gray-bg: #eef0f4;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -12px rgba(16, 24, 40, .18);
  --sidebar: 256px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
/* Light is the default. Dark applies only when the visitor picks it with the toggle. */
:root[data-theme="dark"] {
  --bg: #0d1017; --surface: #151a24; --surface-2: #1a2030; --line: #262d3d; --line-2: #1f2534;
  --text: #e9ecf3; --text-2: #b5bccb; --muted: #8189a0;
  --green-bg: rgba(15,159,110,.16); --amber-bg: rgba(183,121,31,.18); --red-bg: rgba(217,58,73,.16);
  --blue-bg: rgba(37,99,235,.18); --violet-bg: rgba(124,58,237,.2); --gray-bg: #232a3a;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 32px -12px rgba(0,0,0,.6); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; } h2 { font-size: 1.2rem; font-weight: 650; } h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--gray-bg); padding: .12em .4em; border-radius: 6px; }
pre { background: #0f1422; color: #e3e8f4; padding: 16px 18px; border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.55; margin: 0 0 1.2em; }
pre code { background: none; padding: 0; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: .85em; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.pre-line { white-space: pre-line; } .break { word-break: break-all; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px } .mb-0 { margin-bottom: 0 } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.flex { display: flex; gap: 10px; align-items: center; } .flex-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- app shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease; }
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 700; font-size: 1.02rem; border-bottom: 1px solid var(--line-2); }
.sidebar-head a { color: var(--text); display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), rgba(var(--brand-rgb), .65)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.brand-img { height: 32px; width: auto; border-radius: 6px; }
.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; text-decoration: none; margin-bottom: 2px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: rgba(var(--brand-rgb), .1); color: var(--brand); }
.nav a .count { margin-left: auto; background: var(--brand); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 20px; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line-2); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(var(--brand-rgb), .14); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.user-chip .who { min-width: 0; } .user-chip .who b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .user-chip .who span { font-size: .78rem; color: var(--muted); }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: rgba(var(--brand-rgb), 0); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 30; }
.topbar .title { font-weight: 650; font-size: 1.02rem; }
.topbar .spacer { flex: 1; }
.balance-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: 30px; font-weight: 600; color: var(--text); text-decoration: none; }
.balance-pill:hover { text-decoration: none; border-color: rgba(var(--brand-rgb), .4); }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 26px 28px 48px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; } .page-head p { margin: 4px 0 0; color: var(--muted); }
.backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 12, 20, .45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .balance-pill .lbl { display: none; }
}

/* ---------------------------------------------------------------- cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px 22px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 18px; }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.stat .stat-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: rgba(var(--brand-rgb), .1); color: var(--brand); flex: none; }
.stat .stat-ic.green { background: var(--green-bg); color: var(--green); } .stat .stat-ic.amber { background: var(--amber-bg); color: var(--amber); } .stat .stat-ic.violet { background: var(--violet-bg); color: var(--violet); }
.stat .lbl { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat .val { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat .sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }

.hero-card { background: linear-gradient(135deg, var(--brand), rgba(var(--brand-rgb), .78)); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero-card::after { content: ''; position: absolute; width: 260px; height: 260px; right: -80px; top: -90px; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.hero-card .lbl { opacity: .85; font-size: .85rem; } .hero-card .big { font-size: 2.1rem; font-weight: 750; letter-spacing: -.02em; }
.hero-card .btn { background: #fff; color: var(--brand); border-color: #fff; }
.hero-card .btn-ghost-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

/* ---------------------------------------------------------------- badges & alerts */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-bg); color: var(--green); } .badge-amber { background: var(--amber-bg); color: var(--amber); } .badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); } .badge-violet { background: var(--violet-bg); color: var(--violet); } .badge-gray { background: var(--gray-bg); color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; font-size: .92rem; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: rgba(15, 159, 110, .2); }
.alert-error, .alert-danger { background: var(--red-bg); color: var(--red); border-color: rgba(217, 58, 73, .2); }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: rgba(37, 99, 235, .2); }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: rgba(183, 121, 31, .2); }
.alert b { color: inherit; } .alert .grow { color: var(--text); } .alert .grow strong { color: inherit; }
.notice { border-left: 4px solid var(--brand); }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.field label, label.lbl { display: block; font-weight: 550; font-size: .86rem; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: rgba(var(--brand-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15); }
textarea.input { min-height: 110px; resize: vertical; }
.input-group { display: flex; } .input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); } .input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.input-prefix span { padding: 0 0 0 12px; color: var(--muted); } .input-prefix .input { border: 0; box-shadow: none; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .92rem; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.radio-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--brand); background: rgba(var(--brand-rgb), .05); }
.radio-card input { accent-color: var(--brand); margin-top: 3px; } .radio-card b { display: block; font-size: .9rem; } .radio-card span { font-size: .8rem; color: var(--muted); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.field label.switch, label.switch { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 0; font-weight: 550; }
.switch .track { display: inline-block; width: 38px; height: 22px; border-radius: 20px; background: var(--line); position: relative; transition: .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; left: 3px; top: 3px; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--brand); } .switch input:checked + .track::after { left: 19px; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .25); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { width: auto; min-width: 150px; padding: 8px 10px; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: filter .15s, transform .05s; line-height: 1.3; }
.btn:hover { filter: brightness(1.07); text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); filter: none; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-soft { background: rgba(var(--brand-rgb), .1); color: var(--brand); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: .84rem; } .btn-lg { padding: 12px 22px; font-size: 1rem; } .btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }

/* ---------------------------------------------------------------- tabs, kv, misc */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); } .tabs a:hover { color: var(--text); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; word-break: break-word; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }
.secret-box { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px dashed rgba(var(--brand-rgb), .5); border-radius: var(--radius-sm); padding: 12px 14px; font-family: var(--mono); font-size: .9rem; word-break: break-all; }
.secret-box .grow { min-width: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-2); gap: 10px; flex-wrap: wrap; }
.pager div { display: flex; gap: 8px; }
.message-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; white-space: pre-line; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 82%; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-line; }
.bubble.mine { align-self: flex-end; background: rgba(var(--brand-rgb), .08); border-color: rgba(var(--brand-rgb), .2); }
.bubble .meta { font-size: .76rem; color: var(--muted); margin-top: 6px; }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .9rem; animation: up .2s ease; }
@keyframes up { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }
.progress { height: 8px; background: var(--line); border-radius: 10px; overflow: hidden; } .progress span { display: block; height: 100%; background: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); } .dot.green { background: var(--green); } .dot.red { background: var(--red); } .dot.amber { background: var(--amber); }
.photo-preview { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px; text-align: center; background: var(--surface-2); }
.photo-preview img { max-height: 180px; border-radius: 8px; }

/* ---------------------------------------------------------------- auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--brand), rgba(var(--brand-rgb), .72)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: rgba(255,255,255,.07); right: -200px; bottom: -200px; }
.auth-side h2 { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; max-width: 440px; }
.auth-side p { opacity: .88; max-width: 420px; font-size: 1.02rem; }
.auth-side .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.15rem; color: #fff; }
.auth-side .brand .brand-mark { background: rgba(255,255,255,.18); }
.auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; opacity: .95; }
.auth-main { display: grid; place-items: center; padding: 40px 20px; background: var(--surface); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.55rem; } .auth-card .sub { color: var(--muted); margin-bottom: 24px; }
.auth-card .field { margin-bottom: 14px; }
.auth-single { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-single .card { width: 100%; max-width: 520px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------------------------------------------------------------- public site */
.site-nav { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.82); backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line); }
:root[data-theme="dark"] .site-nav { background: rgba(13,16,23,.8); }
.site-nav .inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 66px; display: flex; align-items: center; gap: 22px; }
.site-nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 750; color: var(--text); font-size: 1.08rem; text-decoration: none; }
.site-nav nav { display: flex; gap: 20px; flex: 1; }
.site-nav nav a { color: var(--text-2); font-weight: 500; }
@media (max-width: 760px) { .site-nav nav { display: none; } }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 84px 0 64px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: -40% -10% auto auto; width: 720px; height: 720px; background: radial-gradient(circle, rgba(var(--brand-rgb), .18), transparent 65%); z-index: -1; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; background: rgba(var(--brand-rgb), .1); color: var(--brand); font-weight: 600; font-size: .82rem; padding: 6px 12px; border-radius: 20px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -.035em; line-height: 1.08; max-width: 780px; font-weight: 800; }
.hero h1 span { color: var(--brand); }
.hero p.lead { font-size: 1.15rem; color: var(--text-2); max-width: 640px; margin: 18px 0 28px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.code-card { background: #0f1422; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid #1d2436; }
.code-card .bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid #1d2436; }
.code-card .bar i { width: 10px; height: 10px; border-radius: 50%; background: #2b3450; display: block; }
.code-card pre { margin: 0; border-radius: 0; font-size: .8rem; }
.section { padding: 64px 0; } .section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2.big { font-size: 1.9rem; letter-spacing: -.02em; font-weight: 750; }
.feature { padding: 22px; } .feature .stat-ic { margin-bottom: 14px; }
.feature h3 { margin-bottom: 6px; } .feature p { color: var(--text-2); margin: 0; font-size: .93rem; }
.price-card { padding: 26px; } .price-card .amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; } .price-card ul { padding-left: 18px; color: var(--text-2); }
.site-foot { padding: 34px 0; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--line); }

/* docs */
.docs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 36px; padding: 32px 0 64px; }
.docs-nav { position: sticky; top: 86px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.docs-nav a { color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-size: .9rem; }
.docs-nav a:hover { background: var(--surface); text-decoration: none; }
.docs-body h2 { margin-top: 42px; padding-top: 12px; font-size: 1.35rem; } .docs-body h2:first-child { margin-top: 0; }
.docs-body h3 { margin-top: 26px; }
.docs-body table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; font-size: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.docs-body th, .docs-body td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.docs-body th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.endpoint { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-family: var(--mono); font-size: .86rem; margin-bottom: 14px; overflow-x: auto; }
.method { font-weight: 700; font-size: .74rem; padding: 3px 8px; border-radius: 6px; color: #fff; }
.method.get { background: var(--green); } .method.post { background: var(--blue); }
@media (max-width: 900px) { .docs { grid-template-columns: 1fr; } .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; } }

/* Label rows with a right-side link (e.g. Password · Forgot password?) */
.field label.flex { display: flex; width: 100%; justify-content: space-between; align-items: baseline; }
.field label.flex a { font-weight: 500; }

/* Embedded UPI checkout */
.checkout-card { max-width: 460px; margin: 16px auto; }
.checkout-amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 14px; }
.qr-box { display: inline-block; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
.qr-box img { display: block; width: 240px; height: 240px; max-width: 100%; }
.waiting { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.waiting .spinner { color: var(--brand); }
.utr-box { text-align: left; border-top: 1px solid var(--line); padding-top: 12px; }
.utr-box summary { cursor: pointer; color: var(--text-2); }
.result-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 14px; }
.result-ic.green { background: var(--green-bg); color: var(--green); } .result-ic.red { background: var(--red-bg); color: var(--red); }
.result-ic.amber { background: var(--amber-bg); color: var(--amber); } .result-ic.blue { background: var(--blue-bg); color: var(--blue); }
.mobile-only { display: none; }
@media (pointer: coarse), (max-width: 720px) { .mobile-only { display: inline-flex; } }

/* Homepage preview card */
.home-preview { box-shadow: var(--shadow-lg); }
.home-wallet { background: linear-gradient(135deg, var(--brand), rgba(var(--brand-rgb), .78)); color: #fff; border-radius: 12px; padding: 16px 18px; }
.home-wallet .big { font-size: 1.8rem; font-weight: 750; letter-spacing: .04em; }
.home-wallet .small { opacity: .85; }
.center { text-align: center; }

/* Brand image upload */
.brand-upload { display: flex; gap: 14px; align-items: flex-start; }
.brand-preview { width: 72px; height: 72px; flex: none; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.brand-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-preview.small-preview { width: 44px; height: 44px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- live chat & presence */
.dot-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); margin-right: 7px; vertical-align: middle; }
.impersonate-bar { background: #fef3c7; color: #7c4a03; border-bottom: 1px solid #f5d98a; padding: 8px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .9rem; }
.impersonate-bar form { margin: 0; margin-left: auto; }
.share-card textarea { white-space: pre; font-size: .85rem; resize: vertical; }
.chat-widget { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.chat-fab { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-lg); position: relative; order: 2; }
.chat-fab:hover { filter: brightness(1.08); }
.chat-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; border-radius: 10px; background: #ef4444; color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--surface); }
.chat-box { width: min(370px, calc(100vw - 32px)); height: min(540px, calc(100vh - 110px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; order: 1; }
.chat-box-head { background: var(--brand); color: #fff; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-box-head .small { opacity: .85; }
.chat-box-head .icon-btn { color: #fff; background: transparent; border-color: rgba(255,255,255,.3); }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.chat-messages .empty { margin: auto 0; }
.chat-msg { display: flex; flex-direction: column; max-width: 82%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; }
.chat-bubble { padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); line-height: 1.45; word-break: break-word; }
.chat-msg.mine .chat-bubble { background: var(--brand); color: #fff; border-color: transparent; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-text { white-space: pre-wrap; }
.chat-file { display: block; margin-top: 4px; color: inherit; text-decoration: underline; font-size: .88rem; }
.chat-file img { display: block; max-width: 220px; max-height: 180px; border-radius: 8px; margin-top: 2px; }
.chat-meta { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.chat-compose { border-top: 1px solid var(--line); padding: 10px; background: var(--surface); margin: 0; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 6px; }
.chat-compose-row textarea { flex: 1; resize: none; min-height: 38px; max-height: 140px; padding: 8px 10px; }
.chat-compose-row .icon-btn { flex: none; cursor: pointer; }
.chat-attach-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 6px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.chat-attach-preview img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.chat-admin { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.chat-list { max-height: 330px; overflow-y: auto; }
.chat-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; border-top: 1px solid var(--line-2); color: var(--text); text-decoration: none; }
.chat-row:hover { background: var(--surface-2); }
.chat-row.active { background: rgba(var(--brand-rgb), .08); }
.chat-row .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .count, .chat-admin .count { background: #ef4444; color: #fff; border-radius: 10px; padding: 0 7px; font-size: .72rem; }
.chat-panel { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 460px; overflow: hidden; }
.chat-panel > .empty { margin: auto; }
@media (max-width: 900px) { .chat-admin { grid-template-columns: 1fr; } .chat-panel { height: 70vh; } }
@media print { .chat-widget { display: none; } }
.pt-0 { padding-top: 0 !important; }
.note-internal{margin-top:3px;font-size:.78rem;color:var(--amber,#b45309);display:flex;gap:4px;align-items:flex-start;white-space:pre-wrap}
/* Live photo cropper */
body.crop-open { overflow: hidden; }
.crop-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(10,14,25,.6); display: flex; align-items: center; justify-content: center; padding: 12px; }
.crop-modal { width: 100%; max-width: 420px; max-height: calc(100vh - 24px); overflow: auto; background: var(--surface,#fff); color: var(--text); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.crop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: linear-gradient(135deg, #1f2f57, #2c4a86); color: #fff; }
.crop-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.crop-x { width: 32px; height: 32px; border-radius: 8px; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.crop-note { padding: 10px 16px; background: var(--amber-bg); color: var(--amber); font-size: .85rem; line-height: 1.45; }
.crop-stage { background: #161a24; padding: 14px; display: flex; justify-content: center; }
.crop-frame { position: relative; width: min(100%, 300px); aspect-ratio: 7 / 9; background: #fff; border: 2px solid var(--brand); border-radius: 4px; overflow: hidden; touch-action: none; cursor: grab; }
.crop-frame:active { cursor: grabbing; }
.crop-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.crop-oval { position: absolute; left: 16%; right: 16%; top: 9%; bottom: 22%; border: 2px dashed var(--brand); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.08); }
.crop-tools { padding: 12px 16px 4px; }
.crop-zoom { display: flex; align-items: center; gap: 10px; }
.crop-zoom span { font-size: .75rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.crop-zoom input { flex: 1; accent-color: var(--brand); }
.crop-zoom button, .crop-btns button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; font: inherit; }
.crop-zoom button { width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.crop-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.crop-btns button { padding: 7px 12px; font-size: .88rem; font-weight: 600; }
.crop-zoom button:hover, .crop-btns button:hover { border-color: var(--brand); color: var(--brand); }
.crop-help { text-align: center; font-size: .78rem; color: var(--muted); margin-top: 10px; }
.crop-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--line); margin-top: 10px; }
.photo-preview img { aspect-ratio: 7 / 9; object-fit: cover; }
/* Services on the dashboard */
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.svc-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.svc-tile { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .1s; min-height: 76px; }
.svc-tile:hover { border-color: rgba(var(--brand-rgb), .45); text-decoration: none; }
.svc-tile:active { transform: scale(.99); }
.svc-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(var(--brand-rgb), .1); color: var(--brand); }
.svc-ic.violet { background: var(--violet-bg); color: var(--violet); }
.svc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.svc-body b { font-size: .98rem; }
.svc-desc { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.svc-price { font-weight: 700; color: var(--brand); white-space: nowrap; background: rgba(var(--brand-rgb), .08); padding: 4px 10px; border-radius: 20px; font-size: .88rem; }
.svc-go { font-size: 1.6rem; line-height: 1; color: var(--muted); }
.hero-body { padding: 24px; }
.stat-mini { gap: 12px; }
.stat-mini .stat { padding: 14px 16px; }
/* LL services: one page with tabs */
.hub-head { margin-bottom: 14px; }
.hub-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 18px; max-width: 640px; }
.hub-tabs a { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border-radius: 10px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; position: relative; }
.hub-tabs a:hover { color: var(--text); text-decoration: none; }
.hub-tabs a.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.hub-tabs .count { background: var(--brand); color: #fff; border-radius: 20px; font-size: .72rem; padding: 1px 7px; }
.hub-toolbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin: -6px 0 14px; }
/* Phones */
@media (max-width: 960px) {
  .content { padding-bottom: 96px; }
  .topbar { gap: 8px; }
  .topbar .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hide-sm { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  h1 { font-size: 1.35rem; }
  .input, select.input, textarea.input { font-size: 16px; }
  .page-head { margin-bottom: 16px; align-items: stretch; }
  .page-head > .flex { width: 100%; flex-wrap: wrap; }
  .page-head > .flex > .btn, .page-head > .flex > form, .page-head > .flex > a { flex: 1 1 auto; }
  .page-head > .flex form .btn { width: 100%; }
  .card-body { padding: 16px; } .card-head { padding: 14px 16px; } .card-foot { padding: 12px 16px; }
  .table th, .table td { padding: 10px 12px; }
  .filters .input { flex: 1 1 140px; min-width: 0; }
  .filters .btn { flex: none; }
  .svc-grid { grid-template-columns: 1fr; gap: 10px; }
  .svc-tile { padding: 14px; }
  .hero-body { padding: 20px; } .hero-card .big { font-size: 1.8rem; }
  .stat-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-mini .stat { padding: 12px; gap: 10px; flex-direction: column; }
  .stat-mini .stat .stat-ic { width: 34px; height: 34px; }
  .stat-mini .stat .val { font-size: 1.25rem; }
  .hub-tabs { gap: 4px; }
  .hub-tabs a { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: .78rem; }
  .hub-tabs .count { position: absolute; top: 4px; right: 8px; }
  .hub-toolbar { justify-content: stretch; margin-top: 0; } .hub-toolbar > * { flex: 1; } .hub-toolbar .btn { width: 100%; }
  .chat-widget { right: 12px; bottom: 12px; }
  .chat-fab { width: 50px; height: 50px; }
}
/* Request tables become cards on phones */
@media (max-width: 720px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "req status" "app charge" "date open"; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: block; padding: 0; border: 0; background: none !important; }
  .table-stack td:nth-child(1) { grid-area: req; } .table-stack td:nth-child(2) { grid-area: app; }
  .table-stack td:nth-child(3) { grid-area: status; justify-self: end; } .table-stack td:nth-child(4) { grid-area: charge; text-align: right; }
  .table-stack td:nth-child(5) { grid-area: date; align-self: center; } .table-stack td:nth-child(6) { grid-area: open; text-align: right; }
}
/* Long names, file names and references never push the page sideways */
.grid > * { min-width: 0; }
.card, .alert, .message-box { overflow-wrap: anywhere; }
.table td, .table th, .btn, .badge, .mono.nowrap { overflow-wrap: normal; }
@media (max-width: 720px) { .stack .flex:has(> .btn) { flex-wrap: wrap; } }
@media (max-width: 720px) {
  .tabs { flex-wrap: wrap; gap: 6px; border-bottom: 0; overflow: visible; margin-bottom: 16px; }
  .tabs a { padding: 7px 12px; border: 1px solid var(--line); border-radius: 20px; margin: 0; font-size: .86rem; background: var(--surface); }
  .tabs a.active { background: rgba(var(--brand-rgb), .1); border-color: rgba(var(--brand-rgb), .35); }
}
@media (max-width: 720px) {
  .table-users thead { display: none; }
  .table-users, .table-users tbody { display: block; }
  .table-users tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "contact wallet" "joined act"; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .table-users td { display: block; padding: 0; border: 0; background: none !important; min-width: 0; }
  .table-users td:nth-child(1) { grid-area: name; } .table-users td:nth-child(2) { grid-area: contact; }
  .table-users td:nth-child(3) { grid-area: wallet; text-align: right; font-weight: 600; } .table-users td:nth-child(4) { display: none; }
  .table-users td:nth-child(5) { grid-area: status; justify-self: end; } .table-users td:nth-child(6) { grid-area: joined; align-self: center; }
  .table-users td:nth-child(7) { grid-area: act; }
}
.docs > * { min-width: 0; }
@media (max-width: 900px) { .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 16px; } .docs-body table { display: block; overflow-x: auto; } }
@media (max-width: 720px) {
  .chat-widget.open .chat-box { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; z-index: 70; }
  .chat-widget.open .chat-fab { display: none; }
  body.chat-sheet-open { overflow: hidden; }
}
.stat-mini .stat { flex-direction: column; gap: 8px; }
.stat-mini .stat .stat-ic { width: 34px; height: 34px; }
.stat-mini .stat .val { font-size: 1.3rem; }
/* Member request list with the latest update inline */
.req-list { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.req-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); }
.req-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.req-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.req-title b { font-size: 1.05rem; letter-spacing: .01em; }
.req-amt { font-weight: 700; text-align: right; white-space: nowrap; }
.req-sub { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.req-sub a { color: inherit; }
.req-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin: 12px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.req-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.req-facts dd { margin: 2px 0 0; font-weight: 600; }
.req-status { margin: 10px 0 0; color: var(--text-2); }
.req-update { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(var(--brand-rgb), .3); background: rgba(var(--brand-rgb), .05); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 8px; }
.req-update .chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; color: var(--brand); border: 1px solid rgba(var(--brand-rgb), .35); border-radius: 20px; padding: 2px 10px; }
.req-files { display: flex; flex-wrap: wrap; gap: 10px; }
.req-thumb { display: block; width: 110px; height: 110px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.req-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.req-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none; max-width: 100%; flex-wrap: wrap; }
.req-file:hover { border-color: var(--brand); text-decoration: none; }
.req-file .fname { font-weight: 600; overflow-wrap: anywhere; }
.req-file b { color: var(--brand); font-weight: 600; }
@media (max-width: 720px) {
  .req-list { padding: 10px; gap: 10px; }
  .req-card { padding: 14px; }
  .req-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .req-thumb { width: 96px; height: 96px; }
}
