:root {
    color-scheme: light;
    --bg: #eef2f8;
    --panel: rgba(255, 255, 255, .88);
    --panel-solid: #fff;
    --soft: #f2f5fa;
    --line: #dfe5ee;
    --text: #182132;
    --muted: #738096;
    --primary: #246bfd;
    --primary-2: #62a0ff;
    --accent: #10a87b;
    --danger: #e34e5b;
    --warning: #d98b16;
    --shadow: 0 24px 70px rgba(38, 55, 86, .13);
    --shadow-soft: 0 12px 32px rgba(38, 55, 86, .09)
}

:root[data-theme-mode="dark"] {
    color-scheme: dark;
    --bg: #101620;
    --panel: rgba(23, 31, 44, .9);
    --panel-solid: #171f2c;
    --soft: #202a39;
    --line: #303b4d;
    --text: #edf3ff;
    --muted: #93a0b4;
    --primary: #5d90ff;
    --primary-2: #78abff;
    --accent: #38c69b;
    --danger: #ff7882;
    --warning: #f3ae45;
    --shadow: 0 25px 70px rgba(0, 0, 0, .34);
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, .24)
}

:root[data-theme-mode="black"] {
    color-scheme: dark;
    --bg: #07090e;
    --panel: rgba(18, 21, 28, .94);
    --panel-solid: #12151c;
    --soft: #1a1e27;
    --line: #2a303c;
    --text: #f4f6fb;
    --muted: #989fad;
    --primary: #9caac1;
    --primary-2: #c0cad9;
    --accent: #70a9a0;
    --danger: #ff7f88;
    --warning: #e8ae5a;
    --shadow: 0 25px 70px rgba(0, 0, 0, .48);
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, .32)
}

:root[data-theme-mode="brown"] {
    color-scheme: dark;
    --bg: #18110e;
    --panel: rgba(38, 27, 22, .92);
    --panel-solid: #261b16;
    --soft: #32241e;
    --line: #4b382f;
    --text: #f9eee7;
    --muted: #bba69a;
    --primary: #ff865a;
    --primary-2: #ffac81;
    --accent: #78cbb8;
    --danger: #ff7e78;
    --warning: #edaa56;
    --shadow: 0 25px 70px rgba(0, 0, 0, .38);
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, .28)
}

:root[data-theme-mode="plum"] {
    color-scheme: dark;
    --bg: #17111f;
    --panel: rgba(34, 25, 45, .92);
    --panel-solid: #22192d;
    --soft: #2d213a;
    --line: #433251;
    --text: #fbf6ff;
    --muted: #b7a7c3;
    --primary: #b57bea;
    --primary-2: #da9cf6;
    --accent: #e677aa;
    --danger: #ff827e;
    --warning: #eeb25c;
    --shadow: 0 25px 70px rgba(0, 0, 0, .38);
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, .28)
}

* {
    box-sizing: border-box
}

html, body {
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Manrope, Arial, sans-serif;
    transition: background .25s, color .25s
}

button, input, select {
    font: inherit
}

button {
    cursor: pointer
}

button:disabled {
    cursor: default;
    opacity: .58
}

[hidden] {
    display: none !important
}

.ambient {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none
}

.ambient span {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    opacity: .7
}

.ambient span:nth-child(1) {
    width: 520px;
    height: 520px;
    left: -180px;
    top: -220px;
    background: radial-gradient(circle, rgba(70, 123, 255, .18), transparent 68%)
}

.ambient span:nth-child(2) {
    width: 480px;
    height: 480px;
    right: -160px;
    top: 80px;
    background: radial-gradient(circle, rgba(34, 201, 162, .12), transparent 68%)
}

.ambient span:nth-child(3) {
    width: 500px;
    height: 500px;
    left: 35%;
    bottom: -350px;
    background: radial-gradient(circle, rgba(119, 96, 255, .11), transparent 68%)
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px)
}

.topbar__inner {
    width: min(1180px, calc(100% - 32px));
    height: 68px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px
}

.brand {
    color: var(--text);
    font-family: Unbounded, sans-serif;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -.04em
}

.brand span {
    color: var(--primary)
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px
}

.topbar-link {
    height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--text);
    background: var(--panel);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--panel);
    display: grid;
    place-items: center
}

.theme-toggle span {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0 50%, var(--text) 50%)
}

.shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 60px
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase
}

.page-head h1, .access-card h1 {
    margin: 0;
    font-family: Unbounded, sans-serif;
    font-size: 38px;
    line-height: 1.05;
    letter-spacing: -.045em
}

.lead {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 15px
}

.refresh-button {
    height: 46px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 0 16px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow-soft);
    transition: transform .18s
}

.refresh-button:hover {
    transform: translateY(-1px)
}

.refresh-button svg, .search-field svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round
}

.stats {
    display: grid;
    grid-template-columns:repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px
}

.stat {
    min-width: 0;
    padding: 17px 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow-soft)
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700
}

.stat strong {
    display: block;
    margin-top: 7px;
    font-family: Unbounded, sans-serif;
    font-size: 27px;
    line-height: 1
}

.stat--active strong {
    color: var(--accent)
}

.stat--danger strong {
    color: var(--danger)
}

.stat--accent strong {
    color: var(--primary)
}

.create-card, .result-card, .list-card {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(15px)
}

.create-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    margin-bottom: 18px
}

.create-card:before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    right: -130px;
    top: -170px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 16%, transparent), transparent 68%)
}

.create-card__head, .list-card__head, .result-card__top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px
}

.create-card h2, .list-card h2, .result-card h2, .modal-head h2, .confirm-card h2 {
    margin: 0;
    font-family: Unbounded, sans-serif;
    font-size: 21px;
    letter-spacing: -.035em
}

.live-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: 999px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    font-size: 11px;
    font-weight: 800
}

.live-chip i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 13%, transparent)
}

.presets {
    position: relative;
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 9px;
    margin-top: 20px
}

.presets button {
    min-width: 0;
    min-height: 63px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--soft);
    color: var(--text);
    text-align: left;
    transition: transform .18s, border .18s, background .18s
}

.presets button:hover {
    transform: translateY(-1px)
}

.presets button.is-active {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
    background: color-mix(in srgb, var(--primary) 11%, var(--panel))
}

.presets span, .presets small {
    display: block
}

.presets span {
    font-size: 13px;
    font-weight: 800
}

.presets small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px
}

.range-grid {
    position: relative;
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 18px;
    margin-top: 22px
}

.range-grid > *, .manage-block, .range-control {
    min-width: 0
}

.reward-presets {
    grid-template-columns:repeat(2, minmax(0, 1fr));
    margin-top: 8px
}

.range-control {
    display: block;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: var(--soft)
}

.range-control__head, .range-control__scale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

.range-control__head {
    font-size: 13px;
    font-weight: 700
}

.range-control__head strong {
    color: var(--primary);
    font-size: 15px
}

.range-control > input[type="range"] {
    width: 100%;
    height: 22px;
    margin: 15px 0 8px;
    padding: 0;
    accent-color: var(--primary)
}

.range-control__scale {
    color: var(--muted)
}

.client-picker {
    position: relative;
    margin: 20px 0 0;
    padding: 0;
    border: 0
}

.client-picker legend {
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800
}

.segmented {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--soft)
}

.segmented label {
    min-width: 0
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none
}

.segmented label span, .segmented button {
    width: 100%;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    transition: background .18s, color .18s, box-shadow .18s
}

.segmented input:checked + span, .segmented button.is-active {
    background: var(--panel-solid);
    color: var(--text);
    box-shadow: 0 5px 15px rgba(38, 55, 86, .1)
}

.create-button {
    position: relative;
    width: 100%;
    min-height: 70px;
    margin-top: 20px;
    display: grid;
    grid-template-columns:42px 1fr 24px;
    align-items: center;
    gap: 13px;
    border: 0;
    border-radius: 20px;
    padding: 11px 18px;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary-2) 80%, var(--primary)));
    color: #fff;
    box-shadow: 0 18px 34px color-mix(in srgb, var(--primary) 27%, transparent);
    text-align: left;
    transition: transform .18s, box-shadow .18s
}

.create-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 21px 38px color-mix(in srgb, var(--primary) 32%, transparent)
}

.create-button:active {
    transform: scale(.99)
}

.create-button__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, .16);
    font-size: 25px
}

.create-button__text strong, .create-button__text small {
    display: block
}

.create-button__text strong {
    font-size: 16px
}

.create-button__text small {
    margin-top: 3px;
    opacity: .78;
    font-size: 11px
}

.create-button > svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round
}

.result-card {
    margin-bottom: 18px;
    padding: 24px;
    border-color: color-mix(in srgb, var(--accent) 30%, var(--line))
}

.result-card__top {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
    justify-content: flex-start
}

.success-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 24px;
    font-weight: 900
}

.status-pill {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800
}

.status-pill--active {
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    color: var(--accent)
}

.status-pill--expired, .status-pill--limited {
    background: color-mix(in srgb, var(--warning) 13%, transparent);
    color: var(--warning)
}

.status-pill--cancelled, .status-pill--disabled {
    background: color-mix(in srgb, var(--danger) 13%, transparent);
    color: var(--danger)
}

.result-card__body {
    display: grid;
    grid-template-columns:260px 1fr;
    gap: 24px;
    padding-top: 22px
}

.qr-panel {
    display: grid;
    gap: 10px
}

.qr-frame {
    aspect-ratio: 1;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff
}

.qr-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain
}

.result-info {
    min-width: 0
}

.result-facts {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 8px
}

.fact {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--soft)
}

.fact span, .fact strong {
    display: block
}

.fact span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700
}

.fact strong {
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px
}

.segmented--compact {
    margin-top: 12px
}

.link-field {
    height: 49px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 0 7px 0 13px;
    background: var(--soft)
}

.link-field span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px
}

.link-field button {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 11px;
    background: var(--panel-solid);
    color: var(--text);
    font-size: 18px
}

.result-actions {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 9px;
    margin-top: 12px
}

.primary-button, .soft-button, .danger-button {
    min-height: 44px;
    border-radius: 14px;
    padding: 0 14px;
    font-weight: 800
}

.primary-button {
    border: 0;
    background: var(--primary);
    color: #fff
}

.soft-button {
    border: 1px solid var(--line);
    background: var(--soft);
    color: var(--text)
}

.danger-button {
    border: 0;
    background: var(--danger);
    color: #fff
}

.list-card {
    padding: 24px
}

.list-card__head {
    align-items: flex-end
}

.sync-time {
    margin: 0;
    color: var(--muted);
    font-size: 11px
}

.filters {
    display: grid;
    grid-template-columns:minmax(180px, 1.6fr) repeat(3, minmax(130px, 1fr)) auto;
    gap: 8px;
    margin-top: 18px
}

.filters input, .filters select, .search-field {
    height: 44px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--soft);
    color: var(--text)
}

.filters > input, .filters select {
    width: 100%;
    padding: 0 11px;
    box-sizing: border-box
}

.search-field {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 11px
}

.search-field svg {
    flex: 0 0 auto;
    color: var(--muted)
}

.search-field input {
    width: 100%;
    height: 38px;
    border: 0;
    background: transparent;
    outline: 0
}

.active-toggle {
    height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--soft);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap
}

.active-toggle input {
    display: none
}

.active-toggle span {
    width: 31px;
    height: 18px;
    position: relative;
    border-radius: 999px;
    background: var(--line);
    transition: background .18s
}

.active-toggle span:after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s
}

.active-toggle input:checked + span {
    background: var(--primary)
}

.active-toggle input:checked + span:after {
    transform: translateX(13px)
}

.trial-table-wrap {
    margin-top: 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px
}

.trial-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse
}

.trial-table th, .trial-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle
}

.trial-table tr:last-child td {
    border-bottom: 0
}

.trial-table th {
    color: var(--muted);
    background: var(--soft);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em
}

.trial-table td {
    font-size: 12px
}

.account-name {
    font-weight: 900
}

.account-id {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px
}

.traffic-cell strong, .traffic-cell span {
    display: block
}

.traffic-cell span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px
}

.row-action {
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 0 10px;
    background: var(--soft);
    color: var(--text);
    font-size: 11px;
    font-weight: 800
}

.empty-state {
    min-height: 180px;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 30px
}

.empty-state strong, .empty-state span {
    display: block
}

.empty-state span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px
}

.pagination button {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 0 12px;
    background: var(--soft);
    color: var(--text);
    font-weight: 800
}

.pagination span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800
}

.access-layer, .modal-layer, .confirm-layer, .loader-layer {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px
}

.access-layer {
    background: var(--bg)
}

.access-card {
    position: relative;
    width: min(420px, 100%);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--panel);
    box-shadow: var(--shadow);
    text-align: center
}

.access-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 17px;
    display: grid;
    place-items: center;
    border-radius: 21px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-family: Unbounded, sans-serif;
    font-size: 25px;
    box-shadow: 0 17px 30px color-mix(in srgb, var(--primary) 24%, transparent)
}

.access-card h1 {
    font-size: 25px
}

.access-card > p:not(.eyebrow) {
    margin: 10px 0 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5
}

.access-card label {
    text-align: left
}

.access-card label span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800
}

.access-card input {
    width: 100%;
    height: 53px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--soft);
    color: var(--text);
    padding: 0 14px;
    text-align: center;
    font-size: 22px;
    letter-spacing: .18em;
    outline: 0
}

.access-card input:focus {
    border-color: var(--primary)
}

.access-card button {
    width: 100%;
    height: 51px;
    margin-top: 10px;
    border: 0;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 800
}

.access-card > small {
    min-height: 18px;
    display: block;
    margin-top: 10px;
    color: var(--danger);
    font-size: 11px
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 18, .55);
    backdrop-filter: blur(4px)
}

.detail-modal {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: calc(100vh - 36px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--panel-solid);
    box-shadow: var(--shadow)
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 19px 21px;
    border-bottom: 1px solid var(--line)
}

.modal-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--soft);
    color: var(--text);
    font-size: 25px
}

.detail-body {
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 20px
}

.detail-grid {
    display: grid;
    grid-template-columns:260px 1fr;
    gap: 20px
}

.detail-meta {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 8px
}

.manage-block {
    margin-top: 14px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--soft)
}

.manage-block h3 {
    margin: 0 0 10px;
    font-size: 13px
}

.quick-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap
}

.quick-actions button {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 0 11px;
    background: var(--panel-solid);
    color: var(--text);
    font-size: 11px;
    font-weight: 800
}

.custom-action {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 7px;
    margin-top: 8px
}

.custom-action input, .custom-action select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    height: 39px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--panel-solid);
    color: var(--text);
    padding: 0 10px
}

.custom-action input[type="date"],
.custom-action input[type="datetime-local"],
.filters input[type="date"],
.filters input[type="datetime-local"] {
    display: block;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%
}

.custom-action input::-webkit-date-and-time-value,
.filters input::-webkit-date-and-time-value {
    min-width: 0;
    text-align: left
}

.custom-action button {
    height: 39px;
    border: 0;
    border-radius: 11px;
    padding: 0 13px;
    background: var(--primary);
    color: #fff;
    font-weight: 800
}

.audit {
    margin-top: 15px
}

.audit h3 {
    font-size: 13px
}

.audit-list {
    display: grid;
    gap: 7px
}

.audit-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--soft);
    font-size: 11px
}

.audit-item span {
    color: var(--muted)
}

.cancel-trial {
    width: 100%;
    height: 44px;
    margin-top: 14px;
    border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
    border-radius: 14px;
    background: color-mix(in srgb, var(--danger) 9%, transparent);
    color: var(--danger);
    font-weight: 800
}

.confirm-card {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel-solid);
    box-shadow: var(--shadow);
    text-align: center
}

.danger-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: color-mix(in srgb, var(--danger) 13%, transparent);
    color: var(--danger);
    font-size: 25px;
    font-weight: 900
}

.confirm-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5
}

.confirm-card > div:last-child {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 8px;
    margin-top: 18px
}

.loader-layer {
    z-index: 100;
    background: rgba(5, 10, 18, .28);
    backdrop-filter: blur(3px)
}

.loader-card {
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-solid);
    box-shadow: var(--shadow);
    font-size: 12px
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .75s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.toast-stack {
    position: fixed;
    z-index: 120;
    top: 16px;
    left: 50%;
    width: min(420px, calc(100% - 20px));
    display: grid;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none
}

.toast {
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--panel-solid);
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 800;
    opacity: 0;
    transform: translateY(-8px);
    transition: .2s
}

.toast.is-visible {
    opacity: 1;
    transform: none
}

.toast--error {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
    color: var(--danger)
}

@media (max-width: 900px) {
    .stats {
        grid-template-columns:repeat(3, 1fr)
    }

    .filters {
        grid-template-columns:1fr 1fr 1fr
    }

    .search-field {
        grid-column: span 2
    }

    .active-toggle {
        justify-content: center
    }

    .result-card__body, .detail-grid {
        grid-template-columns:220px 1fr
    }

    .result-facts, .detail-meta {
        grid-template-columns:1fr 1fr
    }
}

@media (max-width: 650px) {
    .topbar__inner, .shell {
        width: calc(100% - 20px)
    }

    .topbar__inner {
        height: 60px
    }

    .topbar-link {
        display: none
    }

    .shell {
        padding: 22px 0 36px
    }

    .page-head {
        align-items: flex-start
    }

    .page-head h1 {
        font-size: 31px
    }

    .page-head .lead {
        max-width: 240px
    }

    .refresh-button span {
        display: none
    }

    .refresh-button {
        width: 44px;
        padding: 0;
        justify-content: center
    }

    .stats {
        grid-template-columns:repeat(2, 1fr);
        gap: 8px
    }

    .stat {
        padding: 14px;
        border-radius: 17px
    }

    .stat strong {
        font-size: 23px
    }

    .stat:last-child {
        grid-column: 1/-1
    }

    .create-card, .result-card, .list-card {
        padding: 16px;
        border-radius: 22px
    }

    .presets {
        display: flex;
        overflow: auto;
        margin-left: -2px;
        margin-right: -2px;
        padding: 2px;
        scrollbar-width: none
    }

    .presets::-webkit-scrollbar {
        display: none
    }

    .presets button {
        min-width: 144px
    }

    .reward-presets {
        display: grid;
        grid-template-columns:repeat(2, minmax(0, 1fr));
        overflow: visible
    }

    .reward-presets button {
        min-width: 0
    }

    .range-grid {
        grid-template-columns:1fr;
        gap: 10px
    }

    .create-button {
        min-height: 66px
    }

    .result-card__body, .detail-grid {
        grid-template-columns:1fr
    }

    .qr-panel {
        width: min(280px, 100%);
        margin: auto
    }

    .result-facts, .detail-meta {
        grid-template-columns:1fr 1fr
    }

    .result-actions {
        grid-template-columns:1fr
    }

    .filters {
        grid-template-columns:1fr 1fr
    }

    .search-field {
        grid-column: 1/-1
    }

    .active-toggle {
        grid-column: 1/-1
    }

    .list-card__head {
        align-items: flex-start;
        flex-direction: column
    }

    .access-card {
        padding: 24px 18px
    }

    .detail-modal {
        max-height: calc(100vh - 12px);
        border-radius: 22px
    }

    .detail-body {
        padding: 14px;
        max-height: calc(100vh - 95px)
    }

    .modal-head {
        padding: 15px
    }

    .modal-head h2 {
        font-size: 17px
    }

    .result-card__top {
        flex-wrap: wrap
    }

    .result-card__top .status-pill {
        margin-left: 0
    }

    .client-picker {
        margin-top: 16px
    }
}

@media (max-width: 390px) {
    .result-facts, .detail-meta {
        grid-template-columns:1fr
    }

    .create-button__text small {
        display: none
    }

    .presets button {
        min-width: 134px
    }

    .reward-presets button {
        min-width: 0
    }

    .filters {
        grid-template-columns:1fr
    }

    .filters > * {
        grid-column: 1 !important
    }
}

/* Detail modal uses flex only: two columns on desktop and one on mobile. */
.modal-layer {
    display: flex;
    align-items: center;
    justify-content: center
}

.detail-modal {
    display: flex;
    flex-direction: column
}

.modal-head > div {
    min-width: 0
}

.promo-modal-head > div {
    flex: 1 1 auto
}

.promo-modal-head__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-width: 0
}

.promo-modal-head__title-row h2 {
    min-width: 0;
    max-width: 100%
}

.promo-modal-head__title-row .status-pill {
    flex: 0 0 auto;
    margin-left: 0;
    white-space: nowrap
}

.promo-modal-head .modal-close {
    flex: 0 0 40px
}

.modal-head h2 {
    overflow-wrap: anywhere
}

.detail-body {
    min-height: 0;
    flex: 1 1 auto
}

.detail-grid {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    min-width: 0
}

.detail-grid > .qr-panel {
    display: flex;
    flex-direction: column;
    width: 260px;
    flex: 0 0 260px;
    margin: 0
}

.detail-grid > div:last-child {
    min-width: 0;
    flex: 1 1 auto
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.detail-meta > .fact {
    flex: 1 1 calc((100% - 16px) / 3)
}

.detail-body .audit-list {
    display: flex;
    flex-direction: column;
    gap: 7px
}

.custom-action {
    min-width: 0
}

.custom-action input, .custom-action select {
    min-width: 0
}

.custom-action button {
    flex: 0 0 auto
}

@media (max-width: 900px) {
    .detail-grid > .qr-panel {
        width: 220px;
        flex-basis: 220px
    }

    .detail-meta > .fact {
        flex-basis: calc((100% - 8px) / 2)
    }
}

@media (max-width: 650px) {
    .modal-layer {
        padding: 6px
    }

    .detail-modal {
        width: 100%;
        max-height: calc(100vh - 12px);
        max-height: calc(100dvh - 12px);
        border-radius: 20px
    }

    .detail-body {
        max-height: none;
        padding: 14px
    }

    .detail-grid {
        flex-direction: column;
        gap: 16px;
        width: 100%
    }

    .detail-grid > .qr-panel {
        width: min(280px, 100%);
        flex: 0 0 auto;
        align-self: center;
        margin: 0 auto
    }

    .detail-grid > div:last-child {
        width: 100%
    }

    .detail-meta {
        flex-direction: column
    }

    .detail-meta > .fact {
        width: 100%;
        flex: 0 0 auto
    }

    .custom-action {
        flex-direction: column
    }

    .custom-action button {
        width: 100%
    }

    .audit-item {
        flex-direction: column
    }
}

/* Keep Generate controls visually and physically consistent with the Mini App. */
:where(button,.topbar-link) {
    font-family: Manrope, Arial, sans-serif;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
}

.create-button__text strong {
    font-size: 14px;
    font-weight: 800;
}

.create-button__text small {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
}

.row-action,
.quick-actions button,
.pagination button {
    font-size: 12px;
    font-weight: 800;
}

.link-field button {
    font-size: 18px
}

.modal-close {
    font-size: 25px
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    white-space: nowrap
}

.row-action--cancel {
    border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
    background: color-mix(in srgb, var(--danger) 9%, transparent);
    color: var(--danger)
}

.row-action--cancel:hover {
    border-color: color-mix(in srgb, var(--danger) 46%, var(--line));
    background: color-mix(in srgb, var(--danger) 14%, transparent)
}

.confirm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    font-size: 25px;
    font-weight: 900
}

.confirm-icon--primary {
    background: color-mix(in srgb, var(--primary) 13%, transparent);
    color: var(--primary)
}

.confirm-icon--danger {
    background: color-mix(in srgb, var(--danger) 13%, transparent);
    color: var(--danger)
}

/* Keep the admin topbar visible while the page scrolls. */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%
}

.shell {
    padding-top: 102px
}

@media (max-width: 650px) {
    .shell {
        padding-top: 82px
    }
}

:where(button,a[href],label):not(:disabled) {
    -webkit-tap-highlight-color: transparent;
}

.create-button,
.primary-button,
.access-card button,
.custom-action button,
.danger-button {
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 82%, #000) 100%);
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
    transition: transform .2s ease, scale .2s ease, box-shadow .2s ease, opacity .2s ease, filter .2s ease;
}

.create-button:hover,
.primary-button:hover,
.access-card button:hover,
.custom-action button:hover,
.danger-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 28%, transparent);
    filter: saturate(1.04);
}

.soft-button,
.row-action,
.quick-actions button,
.refresh-button,
.topbar-link,
.theme-toggle,
.pagination button,
.modal-close,
.link-field button,
.cancel-trial {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--soft);
    color: var(--text);
    box-shadow: none;
    transition: transform .2s ease, scale .2s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}

.soft-button:hover,
.row-action:hover,
.quick-actions button:hover,
.refresh-button:hover,
.topbar-link:hover,
.theme-toggle:hover,
.pagination button:hover,
.modal-close:hover,
.link-field button:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--soft) 72%, var(--panel-solid));
}

.danger-button {
    background: linear-gradient(180deg, var(--danger), color-mix(in srgb, var(--danger) 82%, #000));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--danger) 22%, transparent);
}

.cancel-trial {
    border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
    background: color-mix(in srgb, var(--danger) 9%, transparent);
    color: var(--danger);
}

.cancel-trial:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}

:where(button,a[href],label):not(:disabled):active {
    transform: translateY(2px);
    scale: .96;
    box-shadow: 0 3px 9px color-mix(in srgb, var(--primary) 13%, transparent);
}

.create-button:active,
.primary-button:active,
.soft-button:active,
.row-action:active,
.quick-actions button:active,
.access-card button:active,
.custom-action button:active,
.danger-button:active,
.cancel-trial:active {
    transform: translateY(2px);
    scale: .96;
    box-shadow: 0 3px 9px color-mix(in srgb, var(--primary) 13%, transparent);
}

.create-button:hover > svg {
    transform: translateX(3px)
}

.create-button > svg {
    transition: transform .2s ease
}

.create-button:active .create-button__icon {
    transform: rotate(8deg) scale(1.06)
}

.create-button__icon {
    transition: transform .2s ease
}

@media (prefers-reduced-motion: reduce) {
    :where(button,a[href],label):not(:disabled),
    .create-button > svg,
    .create-button__icon {
        transition: none
    }

    :where(button,a[href],label):not(:disabled):active {
        scale: 1
    }
}

@media (max-width: 650px) {
    .topbar__actions {
        min-width: 0;
        gap: 7px;
        overflow-x: auto;
        scrollbar-width: none
    }

    .topbar__actions::-webkit-scrollbar {
        display: none
    }

    .topbar__actions > * {
        flex: 0 0 auto
    }

    .topbar-link {
        display: inline-flex;
        padding: 0 7px;
        font-size: 11px
    }
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast__dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: var(--primary);
}

.toast--success .toast__dot {
    background: var(--accent)
}

.toast--error .toast__dot {
    background: var(--danger)
}
