/* Abnabot Admin Panel (MiniApp web UI) — design system.
   Dark-first, RTL-first, Telegram-theme aware. Shares the palette used across
   the existing miniapp (styles.css / setup.css). */

:root {
    --bg: #0f1115;
    --card: #151823;
    --card2: #1b1f2c;
    --text: #e7ecf3;
    --muted: #a7b1c2;
    --primary: #7c5cff;
    --success: #2ecc71;
    --danger: #ff5c7c;
    --warning: #f1c40f;
    --border: #23283b;
    --accent: #1f2433;
    --info: #3b82f6;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .28);
    --nav-h: 64px;
}

html.light {
    --bg: #f3f5fa;
    --card: #ffffff;
    --card2: #f7f8fc;
    --text: #0c1222;
    --muted: #6b7280;
    --primary: #6d28d9;
    --success: #16a34a;
    --danger: #ef4444;
    --warning: #d97706;
    --border: #e5e7eb;
    --accent: #eef0f6;
    --info: #2563eb;
    --shadow: 0 10px 30px rgba(20, 20, 50, .08);
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px Vazirmatn, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
    min-height: 100vh;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

/* ---------------------------------------------------------------- boot/fatal */
.boot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 70vh;
    color: var(--muted);
}

.fatal {
    text-align: center;
    padding: 80px 24px;
}

.fatal-emoji {
    font-size: 48px;
}

.fatal-title {
    font-size: 20px;
    font-weight: 800;
    margin: 12px 0 6px;
}

.fatal-body {
    color: var(--muted);
    line-height: 1.9;
}

/* ---------------------------------------------------------------- top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand,
.brand-spacer {
    width: 64px;
    display: flex;
    align-items: center;
}

.brand-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 999px;
    padding: 3px 10px;
}

.topbar-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- view */
.view {
    max-width: 760px;
    margin: 0 auto;
    padding: 14px 14px 24px;
}

.page {
    display: block;
}

.section-label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 700;
    margin: 16px 4px 8px;
}

.center-note {
    text-align: center;
    color: var(--muted);
    padding: 28px 12px;
}

.grow {
    flex: 1;
    min-width: 0;
}

.row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------- bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(140%) blur(12px);
    border-top: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex: 1 0 auto;
    min-width: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    background: none;
    border: none;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
    border-radius: 12px;
}

.nav-item .nav-icon {
    font-size: 19px;
    line-height: 1;
    filter: grayscale(.4);
    opacity: .8;
}

.nav-item .nav-label {
    font-size: 10.5px;
    font-weight: 600;
}

.nav-item.active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.nav-item.active .nav-icon {
    filter: none;
    opacity: 1;
}

/* ---------------------------------------------------------------- stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 20px;
    background: color-mix(in srgb, var(--primary) 16%, transparent);
}

.stat-card.accent-success .stat-icon {
    background: color-mix(in srgb, var(--success) 16%, transparent);
}

.stat-card.accent-danger .stat-icon {
    background: color-mix(in srgb, var(--danger) 16%, transparent);
}

.stat-card.accent-warning .stat-icon {
    background: color-mix(in srgb, var(--warning) 18%, transparent);
}

.stat-card.accent-info .stat-icon {
    background: color-mix(in srgb, var(--info) 16%, transparent);
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.stat-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* ---------------------------------------------------------------- card */
.card {
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 10px 0;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
}

.card-icon {
    font-size: 16px;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-body {
    padding: 14px;
}

.two-up {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.two-up .card {
    margin: 0;
}

@media (max-width: 520px) {
    .two-up {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------------- today */
.today-hero {
    text-align: center;
    padding: 6px 0 12px;
}

.today-amount {
    font-size: 24px;
    font-weight: 800;
    color: var(--success);
}

.today-amount-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.today-row {
    display: flex;
    gap: 8px;
}

.mini-stat {
    flex: 1;
    text-align: center;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
}

.mini-icon {
    font-size: 15px;
}

.mini-value {
    font-size: 16px;
    font-weight: 800;
    margin-top: 2px;
}

.mini-label {
    font-size: 10.5px;
    color: var(--muted);
}

/* ------------------------------------------------ today income breakdown */
.today-section-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    margin: 16px 0 7px;
}

.breakdown-list,
.top-users {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.breakdown-row,
.top-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.breakdown-title {
    font-weight: 600;
    font-size: 13px;
}

.breakdown-count {
    font-size: 11px;
    color: var(--muted);
    margin-inline-start: auto;
}

.breakdown-amount,
.top-user-amount {
    font-weight: 800;
    font-size: 13px;
    color: var(--success);
    white-space: nowrap;
}

.top-user-rank {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.top-user-meta {
    min-width: 0;
    flex: 1;
}

.top-user-name {
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-user-sub {
    font-size: 11px;
    color: var(--muted);
}

.top-user-paid {
    text-align: end;
    white-space: nowrap;
}

.top-user-count {
    font-size: 11px;
    color: var(--muted);
}

/* ---------------------------------------------------------------- setup ring */
.setup-prog,
.setup-done {
    display: flex;
    align-items: center;
    gap: 14px;
}

.setup-prog-text .big {
    font-size: 15px;
    font-weight: 700;
}

.setup-done-text {
    font-weight: 700;
    color: var(--success);
}

/* progress ring */
.ring-wrap {
    position: relative;
    display: inline-grid;
    place-items: center;
}

.ring-center {
    position: absolute;
    text-align: center;
}

.ring-value {
    font-size: 16px;
    font-weight: 800;
}

.ring-sub {
    font-size: 10px;
    color: var(--muted);
}

.ring-fg {
    transition: stroke-dashoffset .6s ease;
}

/* linear bar */
.bar {
    height: 8px;
    background: var(--accent);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width .5s ease;
}

/* ---------------------------------------------------------------- panel health */
.panel-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.panel-row:last-child {
    border-bottom: none;
}

.panel-name {
    font-weight: 600;
}

.panel-sub {
    font-size: 12px;
    color: var(--muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--muted);
}

.dot.on {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
}

.dot.off {
    background: var(--danger);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

/* ---------------------------------------------------------------- launcher */
.launch-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.launch-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: start;
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.launch-card:active {
    transform: translateY(1px);
}

.launch-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 22px;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.launch-title {
    font-weight: 700;
}

.launch-desc {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.launch-chevron {
    color: var(--muted);
    font-size: 20px;
}

/* ---------------------------------------------------------------- coming soon */
.soon {
    text-align: center;
    padding: 64px 24px;
}

.soon-icon {
    font-size: 44px;
}

.soon-title {
    font-size: 18px;
    font-weight: 800;
    margin: 10px 0 4px;
}

.soon-body {
    color: var(--muted);
}

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn:disabled {
    opacity: .55;
    cursor: default;
}

.btn.small {
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
}

.btn.ghost {
    background: var(--accent);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.success {
    background: var(--success);
}

.btn.danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* ---------------------------------------------------------------- pill */
.pill {
    font-size: 11px;
    border-radius: 999px;
    padding: 2px 9px;
    border: 1px solid var(--border);
    color: var(--muted);
    white-space: nowrap;
}

.pill.ok {
    color: var(--success);
    border-color: var(--success);
}

.pill.warn {
    color: var(--warning);
    border-color: var(--warning);
}

.pill.danger {
    color: var(--danger);
    border-color: var(--danger);
}

.pill.info {
    color: var(--info);
    border-color: var(--info);
}

/* Switch geometry is owned by style.css. */

/* ---------------------------------------------------------------- fields */
.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px;
    font: inherit;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.field.ltr input,
.field.ltr textarea {
    direction: ltr;
    text-align: left;
}

.field-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* ---- commitment message variable helper (catalog category modal) ---- */
.var-help-row {
    margin: -6px 0 14px;
}

.var-help-link {
    background: none;
    border: none;
    padding: 2px 0;
    color: var(--primary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.var-help-link:hover {
    text-decoration: underline;
}

.var-section {
    margin-top: 14px;
}

.var-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 8px;
}

.var-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.var-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    text-align: right;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    cursor: pointer;
}

.var-row:hover {
    border-color: var(--primary);
}

.var-token {
    flex: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px 7px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--primary);
    white-space: nowrap;
}

.var-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.var-desc {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

.var-ex {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}

.var-ex-v {
    color: var(--text);
}

.var-copy {
    flex: none;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

/* ---------------------------------------------------------------- modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-sheet {
    width: 100%;
    max-width: 560px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(16px);
    transition: transform .25s ease;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.modal-overlay.show .modal-sheet {
    transform: translateY(0);
}

@media (min-width: 560px) {
    .modal-overlay {
        align-items: center;
    }

    .modal-sheet {
        border-radius: 20px;
    }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
}

.modal-title {
    font-weight: 800;
    font-size: 15px;
}

.modal-x {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    padding: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
}

.modal-actions .btn {
    flex: 1;
}

/* ---------------------------------------------------------------- toast */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom, 0px));
    right: 50%;
    transform: translateX(50%);
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 16px;
    max-width: 90%;
    z-index: 80;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
    font-size: 13px;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.hidden {
    display: none !important;
}

/* Section tabs are owned by style.css. */

.toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.group-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin: 14px 2px 8px;
}

.row.two-col>.field {
    flex: 1;
    min-width: 120px;
}

/* ---------------------------------------------------------------- bank card */
.pay-card .card-body {
    padding: 12px;
}

.bank-card {
    position: relative;
    border-radius: 16px;
    padding: 16px;
    color: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
    overflow: hidden;
    aspect-ratio: 1.62;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: default;
}

.bc-shine {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 110% -10%, rgba(255, 255, 255, .22), transparent 60%),
        radial-gradient(80% 60% at -10% 120%, rgba(255, 255, 255, .12), transparent 60%);
    pointer-events: none;
}

.bc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.bc-bank {
    font-weight: 800;
    font-size: 15px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.bc-status {
    font-size: 10.5px;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 9px;
    background: rgba(255, 255, 255, .2);
}

.bc-status.off {
    background: rgba(0, 0, 0, .3);
    opacity: .85;
}

.bc-chip {
    width: 42px;
    height: 30px;
    border-radius: 7px;
    background: linear-gradient(135deg, #e6c878, #b8902f);
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
}

.bc-chip::after {
    content: "";
    position: absolute;
    inset: 6px 8px;
    border: 1px solid rgba(0, 0, 0, .25);
    border-radius: 3px;
}

.bc-number {
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 19px;
    letter-spacing: 2px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    cursor: pointer;
    position: relative;
}

.bc-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    position: relative;
}

.bc-label {
    font-size: 9.5px;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.bc-holder {
    font-weight: 700;
    font-size: 14px;
}

.bc-audience {
    display: flex;
    gap: 4px;
}

.bc-audience .pill {
    color: #fff;
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .12);
}

/* ---------------------------------------------------------------- card usage */
.card-usage {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.usage-ring {
    text-align: center;
    flex: 0 0 auto;
}

.usage-cap {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

.usage-amount {
    flex: 1;
    min-width: 0;
}

.ua-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 6px;
}

.ua-label {
    font-size: 12px;
    color: var(--muted);
}

.ua-val {
    font-size: 13px;
    font-weight: 700;
}

.reset-pill {
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
}

.card-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

/* ---------------------------------------------------------------- kv grid */
.kv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.kv {
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
}

.kv-label {
    font-size: 11px;
    color: var(--muted);
}

.kv-value {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}

/* ---------------------------------------------------------------- cashback */
.cb-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cb-pct {
    font-size: 22px;
    font-weight: 800;
    color: var(--success);
    min-width: 54px;
    text-align: center;
}

.cb-min {
    font-weight: 700;
}

.cb-aud {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

/* ---------------------------------------------------------------- check toggle */
.check-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    cursor: pointer;
}

/* ---------------------------------------------------------------- link rows */
.link-row,
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row.col {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.sr-label {
    font-size: 12.5px;
    color: var(--muted);
}

.setting-row input {
    width: 100%;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px;
    font: inherit;
}

.link-title {
    font-weight: 600;
}

.link-sub {
    margin-top: 3px;
}

.copyable {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

.cp-url {
    flex: 1;
    min-width: 0;
    font-size: 11.5px;
    word-break: break-all;
}

/* ---------------------------------------------------------------- catalog: plans */
.card.dim {
    opacity: .62;
}

.plan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.plan-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.plan-title {
    font-weight: 800;
    font-size: 15px;
}

.cat-name {
    font-size: 11px;
    color: var(--muted);
    direction: ltr;
}

.plan-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.plan-old {
    color: var(--muted);
    text-decoration: line-through;
    font-size: 13px;
}

.plan-final {
    font-size: 22px;
    font-weight: 800;
    color: var(--success);
}

.plan-cur {
    font-size: 12px;
    color: var(--muted);
}

.plan-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.plan-meta .dotsep {
    opacity: .5;
}

/* chip toggles */
.chip-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 8px 4px 4px;
    font-size: 11.5px;
    cursor: pointer;
}

/* category health */
.health-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.health-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    border-radius: 999px;
    padding: 3px 9px;
    border: 1px solid var(--border);
    color: var(--muted);
    max-width: 100%;
}

.health-pill .hp-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    flex: 0 0 auto;
}

.health-pill.ok {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 50%, var(--border));
}

.health-pill.ok .hp-dot {
    background: var(--success);
}

.health-pill.bad {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.health-pill.bad .hp-dot {
    background: var(--danger);
}

.hint {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.9;
    margin: 6px 2px 12px;
}

/* ---------------------------------------------------------------- infra */
.server-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.server-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.server-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
    word-break: break-all;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
}

.check-line input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.check-line .pill {
    margin-inline-start: auto;
}

/* ---------------------------------------------------------------- users */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-box {
    flex: 1;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
}

.user-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: start;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.user-name {
    font-weight: 700;
}

.user-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--info));
    flex: 0 0 auto;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-name {
    font-size: 17px;
    font-weight: 800;
}

.profile-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.user-badges {
    display: flex;
    gap: 5px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.action-grid .btn {
    width: 100%;
}

.seg-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.seg-row .btn {
    flex: 1;
}

.pick-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: start;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    margin-bottom: 8px;
}

.pick-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.confirm-box {
    text-align: center;
    padding: 12px 0 16px;
}

.confirm-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.8;
}

.confirm-bal {
    color: var(--muted);
    margin-top: 8px;
}

/* ---------------------------------------------------------------- spinner */
.spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(127, 127, 127, .35);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: -2px;
    margin-inline-start: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------- Subscription detail / manage ---------------- */
/* clickable subscription rows (rendered as <button> for keyboard access) */
button.link-row {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

button.link-row:active {
    opacity: .7;
}

.sd-name {
    font-weight: 700;
    font-size: 16px;
    margin: 4px 2px 10px;
    word-break: break-all;
}

.sd-kv {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.sd-kv:last-child {
    border-bottom: 0;
}

.sd-kv-k {
    color: var(--muted);
    flex: 0 0 auto;
}

.sd-kv-v {
    text-align: end;
    word-break: break-word;
}

.sd-warn {
    color: var(--warning);
    font-size: 13px;
    line-height: 1.7;
}

/* adjust modal */
.sd-delta {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
}

.sd-delta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.sd-delta-label {
    font-weight: 600;
}

.sd-delta-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-num {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
}

.sd-unit {
    color: var(--muted);
    flex: 0 0 auto;
}

.sd-prev-wrap {
    margin-top: 6px;
}

.sd-prev {
    background: var(--card2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.9;
}

.sd-prev-note {
    color: var(--muted);
}

.sd-warn-inline {
    color: var(--danger);
}

/* history timeline */
.sd-timeline {
    position: relative;
    margin: 8px 0 24px;
    padding-inline-start: 8px;
}

.sd-tl-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 0 0 14px 0;
}

.sd-tl-item::before {
    content: "";
    position: absolute;
    inset-inline-start: 15px;
    top: 30px;
    bottom: -2px;
    width: 2px;
    background: var(--border);
}

.sd-tl-item:last-child::before {
    display: none;
}

.sd-tl-dot {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: var(--card2);
    border: 1px solid var(--border);
    z-index: 1;
}

.sd-tl-ok .sd-tl-dot {
    background: color-mix(in srgb, var(--success) 18%, transparent);
    border-color: color-mix(in srgb, var(--success) 45%, transparent);
}

.sd-tl-danger .sd-tl-dot {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.sd-tl-info .sd-tl-dot {
    background: color-mix(in srgb, var(--info) 18%, transparent);
    border-color: color-mix(in srgb, var(--info) 45%, transparent);
}

.sd-tl-body {
    flex: 1;
    min-width: 0;
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
}

.sd-tl-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.sd-tl-type {
    font-weight: 700;
}

.sd-tl-date {
    color: var(--muted);
    font-size: 12px;
    flex: 0 0 auto;
}

.sd-tl-actor {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.sd-tl-changes {
    margin-top: 7px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
}

.sd-tl-clabel {
    color: var(--muted);
}

.sd-c-ok .sd-tl-cval {
    color: var(--success);
}

.sd-c-danger .sd-tl-cval {
    color: var(--danger);
}

.sd-c-info .sd-tl-cval {
    color: var(--info);
}

/* ---------------------------------------------------------------- activity / jobs */
.muted {
    color: var(--muted);
}

/* clickable bulk-job card in the list (a <button> that also carries .card) */
.act-job-row {
    display: block;
    width: 100%;
    text-align: start;
    padding: 12px 14px;
    color: var(--text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    transition: border-color .15s ease, transform .05s ease;
}

.act-job-row:hover {
    border-color: var(--primary);
}

.act-job-row:active {
    transform: scale(.99);
}

.act-job-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.act-job-title {
    font-weight: 700;
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.act-job-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}

.act-stat {
    white-space: nowrap;
}

.act-job-dates {
    font-size: 11px;
    color: var(--muted);
    margin-top: 10px;
}

/* per-item rows in the job detail */
.act-items-list {
    display: flex;
    flex-direction: column;
}

.act-item-row {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 10px;
    row-gap: 3px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.act-item-row:last-child {
    border-bottom: none;
}

.act-item-name {
    grid-column: 1;
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
}

.act-item-status {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

.act-item-user {
    grid-column: 1;
    font-size: 12px;
}

.act-item-expiry {
    grid-column: 1 / -1;
    font-size: 12px;
}

.act-item-note {
    grid-column: 1 / -1;
    font-size: 12px;
}

/* state-aware lifecycle controls (detail view) */
.act-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

/* ============================================================ payment-condition builder (Rules tab editor) */
.pcx-editor {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow-x: hidden;
}

.pcx-editor hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0 10px;
}

.pcx-section-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin: 2px 0 7px;
}

/* bare <select>/<input> are created outside .field — give them the field look */
.pcx-editor select,
.pcx-editor input[type="number"] {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    font: inherit;
    max-width: 100%;
}

.pcx-editor select:focus,
.pcx-editor input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* advanced (priority) disclosure */
.pcx-editor details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 12px;
    margin-bottom: 12px;
    background: var(--accent);
}

.pcx-editor details>summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    padding: 8px 0;
}

.pcx-editor details[open]>summary {
    margin-bottom: 8px;
}

/* unlocked-methods chips */
.pcx-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.pcx-method {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.pcx-method input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

/* footgun warnings + tester pass/fail notes */
.pcx-warn {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pcx-warn:not(:empty) {
    margin: 8px 0 2px;
}

.warn-note,
.ok-note {
    font-size: 12px;
    line-height: 1.6;
    background: var(--accent);
    border-radius: 10px;
    padding: 8px 10px;
}

.warn-note {
    color: var(--warning);
    border: 1px solid var(--warning);
}

.ok-note {
    color: var(--success);
    border: 1px solid var(--success);
}

/* the logic tree */
.pcx-tree {
    margin-top: 4px;
}

.pcx-group {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--accent);
    padding: 10px;
}

/* connector select acts as the group's header */
.pcx-group>select {
    width: auto;
    min-width: 200px;
    max-width: 100%;
    font-weight: 700;
    margin-bottom: 10px;
}

.pcx-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding-inline-start: 12px;
    border-inline-start: 2px solid var(--border);
    margin-bottom: 10px;
}

/* nested groups sit on the card surface so depth reads clearly */
.pcx-children .pcx-group {
    background: var(--card);
}

/* condition row: align controls, keep value + remove compact */
.pcx-cond {
    align-items: center;
}

.pcx-cond>select {
    flex: 1 1 130px;
    min-width: 96px;
}

.pcx-cond>input[type="number"] {
    flex: 0 0 84px;
    width: 84px;
}

/* compact remove (✕) buttons inside the builder */
.pcx-cond>.btn.danger,
.pcx-group>.row>.btn.danger {
    flex: 0 0 auto;
    padding: 7px 10px;
    min-width: 0;
    line-height: 1;
}

/* live plain-language summary */
.pcx-summary {
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--accent);
    font-size: 12px;
    line-height: 1.8;
}

/* tester output */
.pcx-test-out {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.pcx-test-out:empty {
    display: none;
}

/* ============================================================ revenue analytics */
/* Screen-reader-only content (chart data tables, live readouts). */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- controls ---- */
.rev-controls .card-body {
    padding: 12px;
}

.ctrl {
    margin-bottom: 12px;
}

.ctrl:last-child {
    margin-bottom: 0;
}

.ctrl-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    margin: 0 2px 6px;
}

/* segmented control */
.seg-group {
    display: flex;
    gap: 3px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px;
    overflow-x: auto;
    scrollbar-width: none;
}

.seg-group::-webkit-scrollbar {
    display: none;
}

.seg-btn {
    flex: 1 0 auto;
    white-space: nowrap;
    background: none;
    border: none;
    color: var(--muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 11px;
    border-radius: 9px;
    cursor: pointer;
    min-height: 34px;
}

.seg-btn.active {
    background: var(--primary);
    color: #fff;
}

.seg-btn:focus-visible,
.filter-chip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* multi-select chips */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    background: var(--accent);
    border: 1px solid var(--border);
    color: var(--muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    min-height: 34px;
}

.filter-chip.active {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    border-color: var(--primary);
    color: var(--primary);
}

/* custom date range */
.rev-dates {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.rev-date-field {
    flex: 1;
    min-width: 140px;
}

.rev-date-field input {
    width: 100%;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    padding: 9px 11px;
    min-height: 40px;
}

/* checkboxes */
.ctrl-checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.ctrl-check {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ctrl-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex: 0 0 auto;
}

.ctrl-check label {
    font-size: 13px;
    cursor: pointer;
}

.ctrl-check.is-disabled label {
    color: var(--muted);
    cursor: not-allowed;
}

.ctrl-hint {
    flex: 1 0 100%;
    font-size: 11.5px;
    color: var(--muted);
    padding-inline-start: 26px;
}

.ctrl-actions {
    display: flex;
    justify-content: flex-start;
}

/* ---- meta row / notices ---- */
.rev-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 2px 10px;
}

.rev-notice {
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 12.5px;
    line-height: 1.8;
    margin-bottom: 10px;
}

.rev-note {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.9;
    margin: 14px 4px 4px;
}

/* ---- KPI deltas ---- */
.rev-kpis .stat-value {
    font-size: 17px;
}

/* Total revenue is the hero figure: full width, with the other four beneath
   it in a 2x2 (otherwise a 5-card 2-column grid leaves one card stranded). */
.rev-kpi-hero {
    grid-column: 1 / -1;
}

.rev-kpi-hero .stat-value {
    font-size: 22px;
}

.stat-delta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.stat-delta.up {
    color: var(--success);
}

.stat-delta.down {
    color: var(--danger);
}

.stat-delta.neutral {
    color: var(--muted);
    font-weight: 600;
}

.stat-delta-abs {
    color: var(--muted);
    font-weight: 600;
}

/* ---- charts ---- */
.chart {
    position: relative;
    margin: 0;
}

.chart-plot {
    width: 100%;
    min-height: 200px;
}

.chart-svg {
    display: block;
    width: 100%;
    touch-action: pan-y;
}

.chart-svg:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 8px;
}

.chart-axis-text {
    fill: var(--muted);
    font-size: 10px;
    font-family: inherit;
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--muted);
    text-align: center;
}

.chart-tip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 7px 10px;
    font-size: 11.5px;
    line-height: 1.7;
    white-space: nowrap;
    max-width: 90%;
}

.chart-tip.hidden {
    display: none;
}

.chart-tip-label {
    color: var(--muted);
    font-size: 10.5px;
}

.chart-tip-value {
    font-weight: 800;
}

.chart-tip-compare {
    color: var(--muted);
}

/* donut */
.donut-body {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.donut-ring {
    flex: 0 0 auto;
    margin: 0 auto;
}

.donut-legend {
    flex: 1 1 200px;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    min-width: 0;
}

.donut-swatch {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.donut-legend-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.donut-legend-value {
    font-weight: 700;
    white-space: nowrap;
}

.donut-legend-pct {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---- data tables ---- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.data-table th,
.data-table td {
    padding: 9px 8px;
    text-align: start;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table thead th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.data-table tbody th {
    font-weight: 600;
    white-space: normal;
    min-width: 110px;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td {
    font-variant-numeric: tabular-nums;
}

/* Claw back horizontal space on phones so the 5-column breakdown fits without
   scrolling; it still scrolls inside .table-wrap if the content is wider. */
@media (max-width: 430px) {

    .data-table th,
    .data-table td {
        padding: 8px 5px;
        font-size: 12px;
    }

    .data-table tbody th {
        min-width: 84px;
    }
}

/* dashboard -> revenue link */
.today-analytics-link {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

@media (min-width: 560px) {
    /* 4 columns so the hero spans the row and the other four sit beneath it
       in a single tidy row. */
    .rev-kpis {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ------------------------------------------- card-to-card Safe Mode */
.info-btn {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--info);
    background: none;
    color: var(--info);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-btn:focus-visible {
    outline: 2px solid var(--info);
    outline-offset: 2px;
}

.info-body {
    white-space: pre-line;
    line-height: 1.9;
    font-size: 13.5px;
}

.field-info-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* A field wrapped with its own "!" button must still share a two-column row
   (the base rule only targets bare .field children). */
.row.two-col>.field-info-row {
    flex: 1;
    min-width: 150px;
}

.field-info-row .info-btn {
    margin-top: 26px;    /* aligns with the input, below the field label */
}

.field-info-row > .grow {
    min-width: 0;
}

.sm-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.sm-current {
    font-size: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.sm-current.inactive {
    color: var(--muted);
}

.sm-current-label {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

.sm-note {
    font-size: 12px;
    line-height: 1.8;
    margin-bottom: 8px;
}

.sm-warn {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    border: 1px solid var(--warning);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    font-size: 12.5px;
    line-height: 1.8;
    margin: 8px 0 10px;
}

.sm-next {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
}

.sm-ev {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.sm-ev:last-child {
    border-bottom: none;
}

.sm-ev-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sm-ev-date {
    font-size: 11.5px;
}

.sm-ev-amounts {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 5px;
}

.sm-ev-diff {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sm-ev-diff-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11.5px;
}

.sm-ev-diff-label {
    color: var(--muted);
}

.sm-ev-diff-val {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: left;
    direction: ltr;
}

.sm-ev-reason {
    font-size: 12.5px;
    margin-top: 4px;
    line-height: 1.8;
}

.sm-ev-actor {
    font-size: 11.5px;
    margin-top: 3px;
}
