/* Dashboard (dark) */
body.app { background: var(--bg); font-size: 15px; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; background: var(--bg); }
.side .brand { padding: 4px 8px 18px; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--muted); padding: 8px 10px; border-radius: var(--r-sm); font-weight: 500; }
.side nav a:hover { background: var(--panel); color: var(--text); }
.side nav a[aria-current="page"] { background: var(--panel-2); color: var(--text); }
.side nav a svg { flex: none; opacity: .85; }
.side .foot { margin-top: auto; display: grid; gap: 10px; }
.wallet { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--panel); }
.wallet span { display: block; color: var(--faint); font-size: 12.5px; }
.wallet b { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.userline { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 4px; font-size: 13px; color: var(--faint); }
.userline span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userline button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 4px; }
.userline button:hover { color: var(--text); }
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; z-index: 5; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { padding: 0; margin-right: auto; }
  .side nav { order: 3; width: 100%; display: flex; overflow-x: auto; scrollbar-width: none; }
  .side nav a { white-space: nowrap; }
  .side .foot { margin: 0; display: flex; align-items: center; }
  .wallet { padding: 6px 10px; } .wallet span { display: none; } .wallet b { font-size: 15px; }
  .userline span { display: none; }
}

main.view { padding: 32px clamp(16px, 4vw, 48px) 96px; max-width: 1180px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.head h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.head p { margin: 6px 0 0; color: var(--muted); }
.head .who { display: flex; gap: 14px; align-items: center; }

.card { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 20px; }
.card + .card { margin-top: 14px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; }
.card .sub { color: var(--muted); margin: -8px 0 16px; font-size: 14px; }
.note { border: 1px solid rgba(242, 193, 78, .3); background: var(--turmeric-soft); border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px; font-size: 14px; color: #EADBB0; }
.note b { color: var(--turmeric); font-weight: 600; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 600; color: var(--hue); background: color-mix(in srgb, var(--hue) 14%, transparent); border: 1px solid color-mix(in srgb, var(--hue) 40%, transparent); flex: none; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.live, .status.interested, .status.booked, .status.running, .status.done, .status.completed, .status.active { color: var(--leaf); border-color: var(--leaf-line); }
.status.callback, .status.retry, .status.calling, .status.ringing, .status.in_progress, .status.draft, .status.paused, .status.invite_sent { color: var(--turmeric); border-color: rgba(242, 193, 78, .35); }
.status.not_interested, .status.failed, .status.wrong_number, .status.busy, .status.no_answer, .status.not_connected { color: var(--chilli); border-color: rgba(255, 107, 87, .35); }

/* New-agent composer */
.composer { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel); margin-bottom: 28px; transition: border-color .12s; }
.composer:focus-within { border-color: var(--leaf); }
.composer textarea { border: 0; background: transparent; padding: 16px 18px 6px; font-size: 16px; min-height: 72px; resize: none; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.composer .bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.composer select { width: auto; padding: 7px 30px 7px 10px; font-size: 14px; }
.composer .bar .primary { margin-left: auto; }

.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.agent { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; text-decoration: none; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 16px; transition: border-color .12s; }
.agent:hover { border-color: var(--line-strong); }
.agent h3 { margin: 0; font-size: 15.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.agent p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

/* Agent page */
.steps-row { display: flex; gap: 0; margin: 0 0 24px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.steps-row li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 14px; color: var(--faint); background: var(--bg); }
.steps-row li + li { border-left: 1px solid var(--line); }
.steps-row li i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 600; border: 1px solid var(--line-strong); }
.steps-row li.done { color: var(--muted); }
.steps-row li.done i { background: var(--leaf); border-color: var(--leaf); color: var(--leaf-ink); }
.steps-row li.now { color: var(--text); background: var(--panel); }
.steps-row li.now i { border-color: var(--leaf); color: var(--leaf); }
@media (max-width: 640px) { .steps-row { flex-direction: column; } .steps-row li + li { border-left: 0; border-top: 1px solid var(--line); } }

.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }

.call { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); position: sticky; top: 24px; overflow: hidden; }
@media (max-width: 980px) { .call { position: static; } }
.call .top { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--muted); }
.call .top .timer { font-variant-numeric: tabular-nums; color: var(--text); }
.call .stage { display: grid; justify-items: center; gap: 6px; padding: 26px 18px 18px; }
.call .state { font-weight: 600; margin-top: 8px; }
.call .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; text-align: center; min-height: 20px; }
.convo { display: grid; gap: 10px; max-height: 300px; overflow-y: auto; padding: 0 18px 16px; }
.convo:empty { display: none; }
.msg { font-size: 14px; line-height: 1.5; }
.msg small { display: block; font-size: 12px; color: var(--faint); margin-bottom: 2px; }
.msg.agent { border-left: 2px solid var(--leaf); padding-left: 10px; }
.msg.customer { border-left: 2px solid var(--line-strong); padding-left: 10px; color: var(--muted); }
.ring { border-top: 1px solid var(--line); padding: 14px 18px; }
.ring form { display: flex; gap: 8px; }

details.more { border-top: 1px solid var(--line); }
details.more:first-of-type { border-top: 0; }
details.more summary { cursor: pointer; font-weight: 500; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.more summary::after { content: ''; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin-right: 4px; transition: transform .15s; }
details.more[open] summary::after { transform: rotate(-135deg); }
details.more summary::-webkit-details-marker { display: none; }
details.more > div { padding: 2px 0 18px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; padding: 7px 12px; font-size: 14px; color: var(--muted); }
.seg label + label span { border-left: 1px solid var(--line-strong); }
.seg input:checked + span { background: var(--leaf-soft); color: var(--leaf); }
.seg input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: -2px; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-size: 14px; }

.savebar { position: sticky; bottom: 16px; margin-top: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 10px 10px 16px; background: rgba(17, 24, 21, .92); backdrop-filter: blur(8px); }
.savebar span { color: var(--muted); font-size: 13.5px; }

/* Tables / lists */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--panel); }
.table td .sub { color: var(--faint); font-size: 13px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; background: var(--bg); }
.table-wrap .table tr:last-child td { border-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 20px; }
.stat { background: var(--bg); padding: 16px 18px; }
.stat span { color: var(--faint); font-size: 13px; }
.stat b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.meter { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }

.empty { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 40px 28px; text-align: center; }
.empty h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 46ch; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--faint); }
dl.kv dd { margin: 0; word-break: break-word; }
code.inline { background: var(--bg); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--panel); border-left: 1px solid var(--line); z-index: 21; overflow-y: auto; padding: 22px; }
.drawer .x { float: right; }
.drawer h2 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--text); padding: 10px 16px; border-radius: var(--r-sm); z-index: 50; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.err { border-color: rgba(255, 107, 87, .5); color: #FFD3CC; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { margin-bottom: 32px; }
.auth-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-card > p { color: var(--muted); margin: 0 0 24px; }
.auth-card .switch { color: var(--muted); font-size: 14px; margin-top: 18px; }

.checks { list-style: none; padding: 0; margin: 10px 0 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.checks .ok { color: var(--leaf); }
.checks .no { color: var(--chilli); }
.convo .msg { display: block; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; background: none; }
.userline button { white-space: nowrap; }

/* ---- client access, voices, enhance ---- */
.imp { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border: 1px solid var(--leaf-line); background: rgba(54, 199, 126, .08); border-radius: var(--r); padding: 10px 14px; margin-bottom: 18px; font-size: 14px; }
.imp b { color: var(--leaf); font-weight: 600; }
.note.warn { border-color: rgba(255, 107, 87, .35); background: rgba(255, 107, 87, .08); color: #F4C7BF; }
.note.warn b { color: var(--chilli); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--leaf); }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cardhead h2 { margin: 0; }
.cardhead .muted { font-size: 13px; }
.enh { border: 1px solid var(--leaf-line); background: rgba(54, 199, 126, .06); border-radius: var(--r); padding: 14px; margin-bottom: 16px; font-size: 14px; }
.enh b { color: var(--leaf); font-weight: 600; }
.enh .enh-line { margin: 8px 0; color: var(--text); }
.enh pre { white-space: pre-wrap; font: inherit; color: var(--muted); margin: 0 0 8px; }
.enh ul { margin: 0 0 12px; padding-left: 18px; color: var(--muted); }
.linkbox { margin-top: 16px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 12px 14px; background: var(--panel-2); }
.linkbox p { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.linkrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.linkrow code { flex: 1 1 260px; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 6px; margin-top: 6px; }
.inline-form input { width: 96px; padding: 6px 10px; }
details.card.more { padding-top: 4px; padding-bottom: 4px; }
td select { padding: 6px 10px; }
.clone { border: 1px solid var(--leaf-line); background: rgba(54, 199, 126, .05); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.clone > b { display: block; font-weight: 600; margin-bottom: 4px; }
.clone p { font-size: 14px; margin: 0 0 14px; }
.clone .readme { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font-size: 15.5px; line-height: 1.6; color: var(--text); }
.clone .rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.clone audio { width: 100%; margin-bottom: 12px; }
.vlib-head { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.vlib-head .f { width: 220px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.vitem { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.vitem.sel { border-color: var(--leaf-line); background: rgba(54, 199, 126, .06); }
.vitem p { margin: 0; font-size: 14px; }
.vtop { display: flex; gap: 10px; align-items: center; }
.vtop .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-strong); font-weight: 600; flex: none; }
.vtop b { font-weight: 600; }
.vtop .muted { font-size: 12.5px; }
.vfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.vfoot > span:last-child { display: flex; gap: 6px; }
.vtier { font-size: 12.5px; color: var(--muted); }
.vtier.premium { color: var(--turmeric); }
/* billing */
.wallet small { display: block; color: var(--faint); font-size: 12px; }
.stat small { display: block; font-size: 12.5px; margin-top: 2px; }
.status.approved { color: var(--leaf); border-color: var(--leaf-line); }
.status.pending, .status.expired { color: var(--turmeric); border-color: rgba(242, 193, 78, .35); }
.status.rejected, .status.dnc, .status.do_not_call { color: var(--chilli); border-color: rgba(255, 107, 87, .35); }
.status.hidden, .status.off { color: var(--faint); }
.sec { font-size: 18px; margin: 28px 0 12px; }
.pkgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pkg { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.pkg.cur { border-color: var(--leaf-line); }
.pkg p { margin: 0; font-size: 14px; }
.pkg .btn { margin-top: auto; align-self: flex-start; }
.pkg-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pkg-price { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.pkg-price small { font-size: 13px; font-weight: 400; color: var(--faint); }
.buy { border-color: var(--leaf-line); }
.buy-grid { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
@media (max-width: 760px) { .buy-grid { grid-template-columns: 1fr; } }
.qrwrap { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qrwrap svg { border-radius: 10px; max-width: 100%; height: auto; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0 0 16px; font-size: 14.5px; }
.sum dt { color: var(--muted); } .sum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sum .tot { color: var(--text); font-weight: 600; font-size: 18px; border-top: 1px solid var(--line); padding-top: 6px; }
.paysteps { padding-left: 20px; font-size: 14px; color: var(--muted); margin: 0 0 14px; }
.paysteps li { margin-bottom: 4px; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--turmeric); color: #1a1405; font-size: 12px; font-weight: 700; text-align: center; line-height: 18px; }
.editrow td { background: var(--panel); }
.editrow .card { margin: 0; }
.acts { text-align: right; } .acts .btn { display: block; width: 100%; margin: 0 0 6px auto; white-space: nowrap; }

/* WhatsApp inbox */
.wa-inbox { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; min-height: 520px; background: var(--panel); }
.wa-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 72vh; background: var(--bg); }
.wa-list a { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.wa-list a:hover { background: var(--panel); }
.wa-list a.sel { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--leaf); }
.wa-list b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-list .muted { font-size: 12px; }
.wa-list small { grid-column: 1 / -1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-thread { display: flex; flex-direction: column; min-width: 0; }
.wa-calls { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.wa-calls button { background: none; cursor: pointer; font: inherit; font-size: 12.5px; }
.wa-msgs { flex: 1; overflow-y: auto; max-height: 56vh; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.wa-b { max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.wa-b.in { align-self: flex-start; background: var(--panel-2); border-top-left-radius: 4px; }
.wa-b.out { align-self: flex-end; background: rgba(54, 199, 126, .14); border: 1px solid var(--leaf-line); border-top-right-radius: 4px; }
.wa-b small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--faint); }
.wa-b small.err { color: var(--chilli); }
.wa-reply { border-top: 1px solid var(--line); padding: 12px 16px; display: grid; gap: 8px; }
.wa-reply textarea { width: 100%; resize: vertical; }
.wa-reply select { max-width: 60%; }
.status.connected, .status.sent, .status.delivered, .status.read { color: var(--leaf); border-color: var(--leaf-line); }
@media (max-width: 820px) { .wa-inbox { grid-template-columns: 1fr; } .wa-list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); } }

/* Templates */
.tpl-entry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tpl-door { display: grid; gap: 4px; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); padding: 16px 18px; border-left: 3px solid var(--leaf); transition: border-color .12s; }
.tpl-door.in { border-left-color: #8aa6ff; }
.tpl-door:hover { border-color: var(--line-strong); }
.tpl-door b { font-size: 16px; font-weight: 600; }
.tpl-door span { color: var(--muted); font-size: 14px; }
.tpl-dir, .tpl-ind, .qcmd { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tpl-card { display: grid; gap: 6px; align-content: start; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 14px 16px; }
.tpl-card:hover { border-color: var(--leaf); }
.tpl-card h3 { margin: 2px 0 0; font-size: 15.5px; font-weight: 600; }
.tpl-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.tpl-pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--leaf-soft); color: var(--leaf); margin-right: 4px; }
.tpl-pill.in { background: rgba(138, 166, 255, .14); color: #8aa6ff; }
.tpl-pill.g { background: var(--panel-2); color: var(--muted); font-weight: 500; }
.tpl-form { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.tpl-form .card + .card { margin-top: 0; }
.tpl-prev { position: sticky; top: 16px; font-size: 14.5px; }
.tpl-prev h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 500; margin: 16px 0 6px; }
.tpl-prev ol { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.tpl-prev p { margin: 0 0 8px; }
.tpl-say { background: var(--panel-2); border-left: 3px solid var(--leaf); border-radius: 6px; padding: 10px 12px; margin-bottom: 4px; }
.tpl-say.wa { border-left-color: #8aa6ff; }
.tpl-say code, .tpl-prev code { color: var(--leaf); font-size: 12.5px; }
.tpl-kv span { display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin: 0 4px 4px 0; }
@media (max-width: 880px) { .tpl-entry, .tpl-form { grid-template-columns: 1fr; } .tpl-prev { position: static; } }

/* Light theme fixes for colours tuned on dark */
:root[data-theme="light"] .toast.err { color: #9B2A16; }
:root[data-theme="light"] .note.warn { color: #8A2A18; background: rgba(201, 56, 31, .07); }
:root[data-theme="light"] .drawer-bg { background: rgba(19, 32, 26, .35); }
:root[data-theme="light"] .tpl-door.in, :root[data-theme="light"] .tpl-say.wa { border-left-color: #3A5BB8; }
:root[data-theme="light"] .tpl-pill.in { background: rgba(58, 91, 184, .10); color: #3A5BB8; }
.userline .theme-btn { width: 28px; height: 28px; }

/* Google sign-in, email code, online payment */
.or-line { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 18px 0 14px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gbtn { min-height: 44px; display: flex; justify-content: center; }
.note.verify { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.note.verify input { width: 130px; letter-spacing: 3px; }
.paynow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border: 1px solid var(--leaf-line); background: var(--leaf-soft); border-radius: var(--r); margin-bottom: 10px; }

/* Results */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.bar { flex: 1; min-width: 4px; height: 100%; position: relative; display: flex; align-items: flex-end; }
.bar i, .bar b { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 3px 3px 0 0; }
.bar i { background: var(--panel-2); border: 1px solid var(--line-strong); border-bottom: 0; }
.bar b { background: var(--leaf); left: 25%; right: 25%; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.lg.a { background: var(--panel-2); border: 1px solid var(--line-strong); margin-left: 0; } .lg.b { background: var(--leaf); }
.outs { display: grid; gap: 8px; }
.outs div { display: grid; grid-template-columns: 150px 50px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.outs b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.outs i { height: 8px; border-radius: 99px; background: var(--leaf); opacity: .7; min-width: 2px; }

/* Admin overview */
.ov-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 500; margin: 22px 0 10px; }
.stat.warn b { color: var(--turmeric); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin: 14px 0; }
.ov-grid .card + .card { margin-top: 0; }
.stats.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.spark { width: 100%; height: auto; display: block; }
.spark rect { fill: var(--leaf); opacity: .85; }
.spark text { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.table tr.tot td { border-top: 1px solid var(--line-strong); }
.roles { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.roles b { color: var(--text); }
@media (max-width: 880px) { .ov-grid { grid-template-columns: 1fr; } }
.bills { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.bill { border-bottom: 1px solid var(--line); }
.bill:last-child { border-bottom: 0; }
.bill > summary, .bill.flat, .bill.total { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 11px 14px; }
.bill > summary { cursor: pointer; list-style: none; }
.bill > summary::-webkit-details-marker { display: none; }
.bill > summary span::before { content: '▸'; color: var(--leaf); margin-right: 8px; display: inline-block; transition: transform .12s; }
.bill[open] > summary span::before { transform: rotate(90deg); }
.bill > summary:hover { background: var(--panel-2); }
.bill small { display: block; color: var(--faint); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.bill.flat span, .bill.total span { padding-left: 18px; }
.bill.total { background: var(--panel-2); font-weight: 600; }
.bill[open] { background: var(--panel); }
.bill[open] > :not(summary) { margin: 0 14px; }
.bill .table-wrap { margin-top: 4px; }
.paybtns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 14px 14px !important; }
td.neg { color: var(--chilli); }
.ov-grid .span2 { grid-column: 1 / -1; }
.bill b { font-size: 15px; font-weight: 600; white-space: nowrap; }
.bill.total b { font-size: 17px; }

/* Integrations */
.int-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.int-grid .card + .card { margin-top: 0; }
.int-grid .cardhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.int-grid .cardhead h2 { margin: 0; }
.int-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 880px) { .int-grid { grid-template-columns: 1fr; } }

/* Live admin overview */
.live-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin: 4px 0 6px; font-size: 14px; color: var(--muted); }
.live-strip b { color: var(--text); }
.live-strip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); box-shadow: none; margin-right: 4px; }
.live-strip .dot.on { background: var(--leaf); box-shadow: 0 0 0 4px var(--leaf-soft); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-strip .dot.on { animation: none; } }
#ovAgents h2, #ovClients h2, #ovServer h2 { display: flex; gap: 6px; align-items: baseline; }
.srv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.srv > div { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 4px; }
.srv span { color: var(--faint); font-size: 12.5px; }
.srv b { font-size: 16px; font-weight: 600; }
.srv small { color: var(--muted); font-size: 12.5px; }
.srv .meter { display: block; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.srv .meter i { display: block; height: 100%; background: var(--leaf); }
.srv .meter.warn i { background: var(--turmeric); }
.srv .meter.bad i { background: var(--chilli); }
td.warnc { color: var(--turmeric); }
#ovAgents, #ovClients, #ovServer { margin-top: 14px; }
@media (max-width: 880px) { .srv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
