:root {
    color-scheme: dark;
    --partner-bg: #080d16;
    --partner-bg-soft: #0d1420;
    --partner-surface: #121a27;
    --partner-surface-2: #182231;
    --partner-surface-3: #1d2838;
    --partner-border: #344055;
    --partner-border-strong: #66718a;
    --partner-primary: #7c3aed;
    --partner-primary-2: #6d28d9;
    --partner-primary-glow: #9a6cff;
    --partner-success: #22c55e;
    --partner-success-2: #16a34a;
    --partner-info: #60a5fa;
    --partner-warning-bg: #201a3b;
    --partner-warning-text: #c7b8ff;
    --partner-danger: #fb7185;
    --partner-text: #f4f7ff;
    --partner-text-muted: #9aa5ba;
    --partner-text-soft: #6f7a91;
    --partner-text-faint: #4f5c73;
    --shadow-card: 0 16px 40px rgba(0, 0, 0, .24);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

/* Author display rules must never override an authentication boundary. */
[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    background: var(--partner-bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, .18), transparent 32rem),
        linear-gradient(140deg, #060a12 0%, #0c1320 48%, #12142a 100%);
    color: var(--partner-text);
    overflow-x: hidden;
}

body.auth-locked {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--partner-primary-glow);
    outline-offset: 3px;
}

svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.partner-app {
    min-height: 100vh;
}

.session-logout-button {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 45;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(18, 26, 39, .88);
    color: var(--partner-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
    backdrop-filter: blur(16px);
}

.session-logout-button:hover {
    color: var(--partner-text);
    border-color: rgba(251, 113, 133, .52);
}

.login-screen {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    display: grid;
    align-items: safe center;
    justify-items: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px;
}

.login-panel {
    width: min(100%, 390px);
    display: grid;
    gap: 14px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(18, 26, 39, .96), rgba(10, 16, 27, .96));
    box-shadow: var(--shadow-card);
}

.login-panel .brand-mark {
    width: 44px;
    height: 44px;
}

.login-panel h1 {
    margin: 0;
    font-size: 26px;
    line-height: 31px;
}

.mobile-frame {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 14px 14px calc(88px + var(--safe-bottom));
    background: linear-gradient(180deg, rgba(13, 20, 32, .94), rgba(8, 13, 22, .98));
}

.screen {
    display: none;
    min-height: calc(100vh - 102px);
}

.screen--active {
    display: block;
    animation: screen-enter .26s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes screen-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.home-header,
.screen-header,
.scanner-header {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.screen-header h1,
.scanner-header h1 {
    margin: 3px 0 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 750;
}

.scanner-header {
    justify-content: center;
}

.scanner-header .icon-button {
    margin-right: auto;
}

.header-spacer {
    width: 40px;
    margin-left: auto;
}

.partner-identity,
.rail-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.partner-identity strong,
.rail-brand strong {
    display: block;
    font-size: 13px;
    line-height: 16px;
    font-weight: 750;
}

.partner-identity small,
.rail-brand small {
    display: block;
    color: var(--partner-text-muted);
    font-size: 11px;
    line-height: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.partner-logo,
.brand-mark {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--partner-primary-glow), var(--partner-primary-2));
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 0 24px rgba(124, 58, 237, .42);
}

.partner-logo--large {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    font-size: 16px;
}

.icon-button,
.round-tool {
    border: 1px solid rgba(255, 255, 255, .09);
    background: rgba(18, 26, 39, .8);
    color: var(--partner-text);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.icon-button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

.icon-button:hover,
.round-tool:hover {
    border-color: rgba(154, 108, 255, .6);
    background: rgba(29, 40, 56, .94);
}

.icon-button:active,
.round-tool:active,
.primary-action:active,
.secondary-action:active {
    transform: scale(.98);
}

.period-row,
.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.period-row::-webkit-scrollbar,
.filter-row::-webkit-scrollbar {
    display: none;
}

.period-row--compact {
    margin: 0;
    justify-content: flex-end;
}

.period-chip,
.filter-chip {
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .09);
    background: rgba(18, 26, 39, .76);
    color: var(--partner-text-muted);
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.period-chip {
    min-width: 86px;
    padding: 9px 10px;
    border-radius: 12px;
    text-align: left;
}

.period-chip span,
.period-chip small {
    display: block;
}

.period-chip span {
    color: var(--partner-text);
    font-size: 12px;
    font-weight: 650;
}

.period-chip small {
    margin-top: 2px;
    font-size: 10px;
}

.filter-chip {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
}

.period-chip.is-active,
.filter-chip.is-active {
    border-color: rgba(154, 108, 255, .78);
    color: #fff;
    background: rgba(124, 58, 237, .22);
}

.period-chip--custom {
    min-width: 108px;
}

.primary-metric-card,
.panel,
.metric-card,
.conversion-card,
.history-item {
    border: 1px solid rgba(255, 255, 255, .075);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0)),
        rgba(18, 26, 39, .88);
    box-shadow: var(--shadow-card);
}

.primary-metric-card {
    min-height: 118px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
    padding: 16px;
    border-radius: 18px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(154, 108, 255, .98), rgba(109, 40, 217, .94)),
        var(--partner-primary);
}

.primary-metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 32px;
    line-height: 36px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.primary-metric-card small {
    display: block;
    margin-top: 8px;
    color: #b8ffc8;
    font-size: 12px;
    font-weight: 650;
}

.metric-label,
.micro-label,
.eyebrow {
    display: block;
    color: var(--partner-text-muted);
    font-size: 11px;
    line-height: 15px;
    font-weight: 650;
}

.primary-metric-card .metric-label {
    color: rgba(255, 255, 255, .84);
}

.mini-bars {
    width: 92px;
    align-self: flex-end;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 6px;
    height: 74px;
    opacity: .74;
}

.mini-bars span {
    width: 8px;
    min-height: 14px;
    border-radius: 999px 999px 0 0;
    background: rgba(255, 255, 255, .32);
}

.kpi-grid,
.conversion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.metric-card,
.conversion-card {
    min-height: 98px;
    padding: 13px;
    border-radius: 14px;
}

.metric-card span,
.conversion-card span {
    display: block;
    min-height: 30px;
    color: var(--partner-text-muted);
    font-size: 11px;
    line-height: 15px;
}

.metric-card strong,
.conversion-card strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
    line-height: 26px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.metric-card small {
    display: block;
    margin-top: 6px;
    color: var(--partner-success);
    font-size: 12px;
    font-weight: 650;
}

.panel {
    margin-bottom: 10px;
    padding: 14px;
    border-radius: 14px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 14px;
    line-height: 18px;
    font-weight: 750;
}

.section-head span {
    color: var(--partner-text-muted);
    font-size: 11px;
}

.text-button,
.ghost-action {
    border: 0;
    background: transparent;
    color: var(--partner-primary-glow);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.chart-panel {
    min-height: 222px;
}

.line-chart {
    width: 100%;
    min-height: 162px;
}

.line-chart svg {
    width: 100%;
    height: 170px;
    overflow: visible;
}

.chart-grid {
    stroke: rgba(255, 255, 255, .08);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--line);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, .24));
}

.line-chart text {
    fill: var(--partner-text-soft);
    stroke: none;
    font-size: 9px;
    font-weight: 650;
}

.chart-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 10px;
}

.chart-toggle {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 999px;
    background: rgba(15, 23, 42, .62);
    color: var(--partner-text-muted);
    cursor: pointer;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 750;
}

.chart-toggle i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--partner-primary-glow);
}

.chart-toggle--hold i {
    background: #f59e0b;
}

.chart-toggle.is-active {
    border-color: rgba(154, 108, 255, .52);
    color: var(--partner-text);
    background: rgba(124, 58, 237, .16);
}

.activity-list,
.history-list,
.settings-list,
.bar-list,
.funnel-list {
    display: grid;
    min-width: 0;
    gap: 8px;
}

.activity-item,
.history-item,
.settings-row,
.user-card {
    display: flex;
    align-items: center;
    gap: 11px;
}

.activity-item {
    width: 100%;
    min-width: 0;
    min-height: 58px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-item div,
.history-item div,
.user-card div {
    min-width: 0;
    flex: 1;
}

.activity-item strong,
.history-item strong,
.user-card strong {
    display: block;
    overflow: hidden;
    color: var(--partner-text);
    font-size: 13px;
    line-height: 17px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-item span,
.history-item span,
.history-item small,
.user-card span,
.user-card small {
    display: block;
    overflow: hidden;
    color: var(--partner-text-muted);
    font-size: 11px;
    line-height: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-item time {
    color: var(--partner-text-soft);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(244, 247, 255, .86), rgba(154, 108, 255, .7)),
        var(--partner-surface-2);
    color: #172033;
    font-size: 11px;
    font-weight: 800;
}

.avatar--large {
    width: 54px;
    height: 54px;
    font-size: 14px;
}

.analytics-grid {
    display: grid;
    gap: 10px;
}

.funnel-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.funnel-index {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(124, 58, 237, .2);
    color: var(--partner-primary-glow);
    font-size: 12px;
    font-weight: 800;
}

.funnel-body {
    min-width: 0;
}

.funnel-body > div:first-child,
.bar-row > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.funnel-body strong,
.bar-row strong {
    color: var(--partner-text);
    font-size: 12px;
}

.funnel-body span,
.bar-row span {
    color: var(--partner-text-muted);
    font-size: 11px;
}

.funnel-body small {
    display: block;
    margin: 4px 0;
    color: var(--partner-success);
    font-size: 11px;
    font-weight: 700;
}

.funnel-track,
.bar-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
}

.funnel-track i,
.bar-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--partner-primary), var(--partner-success));
}

.bar-row {
    display: grid;
    gap: 7px;
}

.finance-hero {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.finance-balance-card,
.finance-kpi {
    border: 1px solid rgba(255, 255, 255, .075);
    box-shadow: var(--shadow-card);
}

.finance-balance-card {
    min-height: 214px;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 18px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(154, 108, 255, .98), rgba(109, 40, 217, .88)),
        var(--partner-primary);
}

.finance-balance-card strong {
    display: block;
    font-size: 36px;
    line-height: 42px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.finance-balance-card small {
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
}

.finance-balance-card .primary-action {
    margin-top: 16px;
    background: rgba(255, 255, 255, .95);
    color: #30145f;
    box-shadow: none;
}

.finance-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.finance-kpi-grid .finance-kpi:first-child {
    grid-column: 1 / -1;
}

.finance-kpi {
    min-height: 102px;
    display: grid;
    align-content: space-between;
    gap: 12px;
    padding: 13px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0)),
        rgba(18, 26, 39, .88);
}

.finance-kpi span {
    color: var(--partner-text-muted);
    font-size: 11px;
    line-height: 15px;
}

.finance-kpi strong {
    font-size: 22px;
    line-height: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.finance-kpi--success strong {
    color: var(--partner-success);
}

.finance-kpi--hold strong {
    color: #fbbf24;
}

.finance-kpi--info strong {
    color: var(--partner-info);
}

.income-source-list,
.finance-transaction-list,
.payout-list {
    display: grid;
    gap: 9px;
}

.income-source {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.income-source:last-child {
    border-bottom: 0;
}

.income-source strong,
.finance-row strong {
    display: block;
    color: var(--partner-text);
    font-size: 13px;
    line-height: 17px;
    font-weight: 750;
}

.income-source span,
.finance-row span {
    display: block;
    color: var(--partner-text-muted);
    font-size: 11px;
    line-height: 15px;
}

.income-source-value {
    text-align: right;
}

.income-source-value small {
    display: block;
    color: var(--partner-success);
    font-size: 11px;
    font-weight: 800;
}

.income-source .bar-track {
    grid-column: 1 / -1;
}

.finance-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px 12px;
    align-items: center;
    min-height: 62px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .065);
    border-radius: 13px;
    background: rgba(15, 23, 42, .38);
}

.finance-row > div:first-child {
    min-width: 0;
}

.finance-row--payout {
    grid-template-columns: minmax(0, 1fr) auto;
}

.finance-row-money {
    text-align: right;
}

.finance-row-money strong {
    font-variant-numeric: tabular-nums;
}

.finance-status {
    justify-self: end;
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 10px !important;
    font-weight: 800;
    white-space: nowrap;
}

.finance-status--success {
    background: rgba(34, 197, 94, .13);
    color: var(--partner-success) !important;
}

.finance-status--hold {
    background: rgba(251, 191, 36, .13);
    color: #fbbf24 !important;
}

.finance-status--info {
    background: rgba(96, 165, 250, .13);
    color: var(--partner-info) !important;
}

.finance-status--danger {
    background: rgba(251, 113, 133, .13);
    color: var(--partner-danger) !important;
}

.finance-status--muted {
    background: rgba(255, 255, 255, .08);
    color: var(--partner-text-muted) !important;
}

.payout-dialog {
    width: min(430px, calc(100vw - 24px));
}

.payout-form,
.dialog-title {
    display: grid;
    gap: 12px;
}

.dialog-title {
    margin-bottom: 4px;
}

.dialog-title h2 {
    margin: 0;
    font-size: 22px;
    line-height: 27px;
}

.dialog-title p {
    margin: 0;
    color: var(--partner-text-muted);
    font-size: 12px;
    line-height: 18px;
}

.form-field {
    display: grid;
    gap: 7px;
    color: var(--partner-text-muted);
    font-size: 11px;
    font-weight: 650;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    background: rgba(15, 23, 42, .88);
    color: var(--partner-text);
    padding: 0 12px;
}

.city-autocomplete {
    position: relative;
}

.city-options {
    position: absolute;
    z-index: 30;
    top: calc(100% + 3px);
    right: 0;
    left: 0;
    max-height: 230px;
    overflow: auto;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: #111827;
    box-shadow: 0 18px 38px rgba(0, 0, 0, .42);
}

.city-options[hidden] {
    display: none;
}

.city-option {
    width: 100%;
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--partner-text);
    text-align: left;
    cursor: pointer;
}

.city-option:hover,
.city-option:focus-visible {
    background: rgba(124, 58, 237, .18);
}

.city-option small,
.city-attribution {
    color: var(--partner-text-muted);
    font-size: 10px;
}

.city-attribution {
    padding: 4px 9px;
    text-align: right;
}

.form-field input,
.form-field select {
    min-height: 44px;
}

.form-field textarea {
    min-height: 82px;
    padding-top: 11px;
    resize: vertical;
}

.date-range-fields,
.document-form {
    display: grid;
    gap: 10px;
}

.document-form {
    grid-template-columns: 1fr;
}

.form-error {
    min-height: 18px;
    margin: 0;
    color: var(--partner-danger);
    font-size: 12px;
    line-height: 18px;
}

.activity-charts {
    display: grid;
    gap: 16px;
}

.column-chart {
    height: 116px;
    display: grid;
    grid-template-columns: repeat(7, minmax(20px, 1fr));
    align-items: end;
    gap: 8px;
    margin-top: 8px;
}

.column {
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    gap: 6px;
}

.column i {
    width: 100%;
    min-height: 12px;
    align-self: end;
    border-radius: 9px 9px 3px 3px;
    background: linear-gradient(180deg, var(--partner-primary-glow), var(--partner-primary-2));
}

.column span {
    color: var(--partner-text-soft);
    font-size: 10px;
    text-align: center;
}

.scanner-screen {
    min-height: calc(100vh - 102px);
}

.scanner-state {
    display: none;
}

.scanner-state--active {
    display: block;
    animation: screen-enter .22s ease both;
}

.camera-surface {
    position: relative;
    min-height: 404px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(10, 15, 25, .68), rgba(21, 32, 48, .52)),
        var(--partner-surface);
}

.camera-preview,
.camera-dim {
    position: absolute;
    inset: 0;
}

.camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .42;
}

.camera-dim {
    background:
        linear-gradient(180deg, rgba(8, 13, 22, .2), rgba(8, 13, 22, .45)),
        radial-gradient(circle at center, rgba(96, 165, 250, .16), transparent 12rem);
    backdrop-filter: blur(2px);
}

.scan-frame {
    position: absolute;
    left: 50%;
    top: 48%;
    width: min(72vw, 272px);
    height: min(72vw, 272px);
    max-width: 272px;
    max-height: 272px;
    transform: translate(-50%, -50%);
}

.scan-frame span {
    position: absolute;
    width: 48px;
    height: 48px;
    border-color: var(--partner-primary-glow);
    filter: drop-shadow(0 0 10px rgba(124, 58, 237, .72));
}

.scan-frame span:nth-child(1) {
    top: 0;
    left: 0;
    border-top: 5px solid;
    border-left: 5px solid;
    border-radius: 10px 0 0 0;
}

.scan-frame span:nth-child(2) {
    top: 0;
    right: 0;
    border-top: 5px solid;
    border-right: 5px solid;
    border-radius: 0 10px 0 0;
}

.scan-frame span:nth-child(3) {
    bottom: 0;
    right: 0;
    border-right: 5px solid;
    border-bottom: 5px solid;
    border-radius: 0 0 10px 0;
}

.scan-frame span:nth-child(4) {
    bottom: 0;
    left: 0;
    border-bottom: 5px solid;
    border-left: 5px solid;
    border-radius: 0 0 0 10px;
}

.scan-copy {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
}

.scan-copy strong {
    font-size: 18px;
    line-height: 24px;
    font-weight: 800;
}

.scan-copy span {
    margin-top: 3px;
    color: var(--partner-text-muted);
    font-size: 12px;
}

.scanner-message {
    min-height: 34px;
    margin: 12px 0;
    color: var(--partner-text-muted);
    font-size: 12px;
    line-height: 17px;
    text-align: center;
}

.scanner-tools {
    display: grid;
    justify-items: center;
    gap: 7px;
    color: var(--partner-text-muted);
    font-size: 11px;
}

.round-tool {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.round-tool:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.round-tool.is-active {
    color: #fff;
    border-color: rgba(154, 108, 255, .9);
    background: var(--partner-primary);
}

.scanner-fallback {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 16px;
}

.manual-qr {
    display: grid;
    gap: 6px;
    color: var(--partner-text-muted);
    font-size: 11px;
}

.manual-qr input {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    background: rgba(18, 26, 39, .9);
    color: var(--partner-text);
    padding: 0 12px;
}

.primary-action,
.secondary-action,
.danger-action {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, filter .18s ease;
}

.primary-action {
    background: linear-gradient(135deg, var(--partner-primary-glow), var(--partner-primary-2));
    color: #fff;
    box-shadow: 0 12px 28px rgba(124, 58, 237, .28);
}

.primary-action--success {
    background: linear-gradient(135deg, var(--partner-success), var(--partner-success-2));
    box-shadow: 0 12px 28px rgba(34, 197, 94, .24);
}

.secondary-action {
    border: 1px solid rgba(255, 255, 255, .09);
    background: rgba(18, 26, 39, .92);
    color: var(--partner-text);
}

.danger-action {
    border: 1px solid rgba(239, 68, 68, .34);
    background: rgba(127, 29, 29, .18);
    color: #fca5a5;
}

.primary-action:disabled,
.secondary-action:disabled,
.danger-action:disabled {
    cursor: not-allowed;
    opacity: .45;
    filter: grayscale(.35);
    box-shadow: none;
}

.scanner-decision-actions,
.dialog-actions {
    display: grid;
    gap: 8px;
}

.scanner-decision-actions {
    margin-top: 12px;
}

.dialog-actions {
    grid-template-columns: 1fr 1fr;
}

.status-badge--warning {
    background: rgba(245, 158, 11, .14);
    color: #fbbf24;
}

.status-badge--danger {
    background: rgba(239, 68, 68, .14);
    color: #fca5a5;
}

.prize-description,
.decision-history-note {
    margin: 0;
    color: var(--partner-text-muted);
    font-size: 12px;
    line-height: 18px;
}

.decision-history-note {
    padding: 10px 12px;
    border-left: 2px solid var(--partner-primary-glow);
    background: rgba(124, 58, 237, .08);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 10px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.status-badge--success {
    background: rgba(34, 197, 94, .92);
    color: #fff;
}

.prize-confirm {
    display: grid;
    gap: 12px;
}

.prize-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
}

.prize-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--partner-primary-glow), var(--partner-primary-2));
}

.prize-icon svg {
    width: 26px;
    height: 26px;
}

.prize-row strong,
.prize-row span {
    display: block;
}

.prize-row strong {
    font-size: 14px;
    line-height: 18px;
}

.prize-row span {
    color: var(--partner-text-muted);
    font-size: 11px;
}

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list > div,
.detail-card > div {
    display: grid;
    gap: 3px;
}

.detail-list--compact {
    gap: 8px;
}

.detail-list dt,
.detail-card dt {
    color: var(--partner-text-soft);
    font-size: 11px;
}

.detail-list dd,
.detail-card dd {
    margin: 0;
    color: var(--partner-text);
    font-size: 13px;
    line-height: 18px;
}

.notice {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 8px 0 12px;
    padding: 12px;
    border: 1px solid rgba(154, 108, 255, .2);
    border-radius: 12px;
    background: rgba(32, 26, 59, .72);
    color: var(--partner-warning-text);
    font-size: 11px;
    line-height: 16px;
}

.notice svg {
    flex: 0 0 auto;
}

.success-visual {
    position: relative;
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    margin: 38px auto 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--partner-success), var(--partner-success-2));
    box-shadow: 0 0 42px rgba(34, 197, 94, .28);
}

#scanner-success[data-action="postpone"] .success-visual {
    background: linear-gradient(135deg, var(--partner-primary-glow), var(--partner-primary-2));
    box-shadow: 0 0 42px rgba(124, 58, 237, .3);
}

#scanner-success[data-action="reject"] .success-visual {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    box-shadow: 0 0 42px rgba(239, 68, 68, .25);
}

.success-visual svg {
    width: 56px;
    height: 56px;
    stroke-width: 2.6;
}

.confetti {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--partner-primary-glow);
}

.confetti--a {
    left: -18px;
    top: 20px;
    background: #facc15;
}

.confetti--b {
    right: -12px;
    top: 35px;
    background: var(--partner-primary-glow);
}

.confetti--c {
    left: 8px;
    bottom: -15px;
    background: var(--partner-info);
}

.confetti--d {
    right: 16px;
    bottom: -20px;
    background: var(--partner-success);
}

#scanner-success h2 {
    margin: 0 0 18px;
    text-align: center;
    font-size: 20px;
}

.success-details {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.empty-state {
    min-height: 360px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.empty-state--compact {
    min-height: 220px;
}

.empty-mark {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 50%;
    background: rgba(124, 58, 237, .18);
    color: var(--partner-primary-glow);
    font-size: 26px;
    font-weight: 800;
}

.empty-state h2 {
    margin: 0 0 6px;
    font-size: 19px;
}

.empty-state p {
    max-width: 260px;
    margin: 0 0 18px;
    color: var(--partner-text-muted);
    font-size: 13px;
    line-height: 19px;
}

.history-item {
    width: 100%;
    min-height: 76px;
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
}

.history-item:hover {
    border-color: rgba(154, 108, 255, .45);
}

.status-dot-label {
    flex: 0 0 auto;
    display: inline-flex !important;
    width: auto;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, .13);
    color: var(--partner-success) !important;
    font-size: 10px !important;
    font-weight: 800;
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 13px;
}

.profile-hero h2 {
    margin: 3px 0 2px;
    font-size: 18px;
    line-height: 23px;
}

.profile-hero p {
    margin: 0;
    color: var(--partner-text-muted);
    font-size: 12px;
}

.settings-row {
    width: 100%;
    min-height: 48px;
    justify-content: space-between;
    padding: 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .055);
    background: transparent;
    color: var(--partner-text);
    text-align: left;
}

.settings-row:last-child {
    border-bottom: 0;
}

.settings-row span {
    font-size: 13px;
    font-weight: 650;
}

.settings-row small {
    max-width: 58%;
    overflow: hidden;
    color: var(--partner-text-muted);
    font-size: 11px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-row--danger span {
    color: var(--partner-danger);
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 20;
    width: min(100%, 430px);
    height: calc(72px + var(--safe-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 8px 8px var(--safe-bottom);
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(12, 19, 30, .92);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
}

.nav-item {
    position: relative;
    min-width: 0;
    min-height: 56px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--partner-text-muted);
    cursor: pointer;
    font-size: 10px;
    line-height: 12px;
    font-weight: 600;
}

.nav-icon {
    display: grid;
    place-items: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

.nav-item.is-active {
    color: var(--partner-primary-glow);
}

.bottom-nav .nav-item--scanner {
    transform: translateY(-20px);
}

.bottom-nav .nav-item--scanner .nav-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border: 4px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--partner-primary-glow), var(--partner-primary-2));
    color: #fff;
    box-shadow: 0 0 28px rgba(124, 58, 237, .5);
}

.bottom-nav .nav-item--scanner span:last-child {
    color: var(--partner-text);
}

.desktop-rail {
    display: none;
}

.rail-footer {
    display: grid;
    gap: 8px;
    color: var(--partner-text-soft);
    font-size: 12px;
}

.rail-footer span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rail-logout {
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    background: rgba(18, 26, 39, .9);
    color: var(--partner-text);
    cursor: pointer;
    font-weight: 800;
}

.rail-logout:hover {
    border-color: rgba(251, 113, 133, .52);
    color: #fecdd3;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--partner-success);
    box-shadow: 0 0 12px rgba(34, 197, 94, .62);
}

.detail-dialog {
    width: min(420px, calc(100vw - 24px));
    max-height: min(680px, calc(100vh - 28px));
    margin: auto;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 22px;
    background: var(--partner-surface);
    color: var(--partner-text);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
}

.detail-dialog::backdrop {
    background: rgba(2, 6, 23, .68);
    backdrop-filter: blur(8px);
}

.dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    color: var(--partner-text);
    cursor: pointer;
}

.sheet-handle {
    width: 46px;
    height: 4px;
    margin: 0 auto 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}

.detail-top {
    display: flex;
    gap: 13px;
    align-items: center;
    margin-bottom: 16px;
}

.detail-top h2 {
    margin: 2px 0;
    font-size: 20px;
}

.detail-top p {
    margin: 0;
    color: var(--partner-text-muted);
    font-size: 13px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(88px + var(--safe-bottom));
    z-index: 50;
    max-width: min(360px, calc(100vw - 28px));
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(18, 26, 39, .96);
    color: var(--partner-text);
    box-shadow: var(--shadow-card);
    font-size: 12px;
    line-height: 17px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity .2s ease, transform .2s ease;
}

.toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 360px) {
    .mobile-frame {
        padding-left: 10px;
        padding-right: 10px;
    }

    .metric-card,
    .conversion-card {
        padding: 11px;
    }

    .primary-metric-card strong {
        font-size: 28px;
        line-height: 32px;
    }

    .scan-frame {
        width: 238px;
        height: 238px;
    }
}

@media (min-width: 700px) {
    .mobile-frame {
        margin-top: 24px;
        margin-bottom: 24px;
        min-height: calc(100vh - 48px);
        border: 1px solid rgba(255, 255, 255, .16);
        border-radius: 28px;
        box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
    }

    .bottom-nav {
        bottom: 24px;
        border: 1px solid rgba(255, 255, 255, .08);
        border-radius: 0 0 28px 28px;
    }
}

@media (min-width: 900px) {
    body {
        background:
            linear-gradient(140deg, #060a12 0%, #0c1320 55%, #151936 100%);
    }

    .partner-app {
        display: grid;
        grid-template-columns: 244px minmax(0, 1fr);
    }

    .desktop-rail {
        position: sticky;
        top: 0;
        height: 100vh;
        display: grid;
        grid-template-rows: auto 1fr auto;
        gap: 28px;
        padding: 24px 18px;
        border-right: 1px solid rgba(255, 255, 255, .08);
        background: rgba(8, 13, 22, .82);
        backdrop-filter: blur(20px);
    }

    .session-logout-button {
        display: none;
    }

    .rail-nav {
        display: grid;
        align-content: start;
        gap: 8px;
    }

    .rail-nav .nav-item {
        min-height: 48px;
        grid-template-columns: 28px 1fr;
        justify-items: start;
        align-content: center;
        padding: 0 12px;
        text-align: left;
        font-size: 13px;
    }

    .rail-nav .nav-item.is-active {
        background: rgba(124, 58, 237, .18);
    }

    .rail-nav .nav-item--scanner {
        color: #fff;
        background: linear-gradient(135deg, rgba(154, 108, 255, .9), rgba(109, 40, 217, .88));
        box-shadow: 0 16px 36px rgba(124, 58, 237, .24);
    }

    .mobile-frame {
        max-width: none;
        min-height: 100vh;
        margin: 0;
        padding: 28px clamp(24px, 4vw, 56px);
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .screen {
        max-width: 1180px;
        min-height: auto;
        padding-bottom: 28px;
    }

    .bottom-nav {
        display: none;
    }

    .home-header {
        margin-bottom: 24px;
    }

    .period-row {
        max-width: 420px;
    }

    .primary-metric-card {
        min-height: 150px;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .analytics-grid,
    .activity-charts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-hero {
        grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr);
        align-items: stretch;
    }

    .finance-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-transaction-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-panel {
        min-height: 288px;
    }

    .line-chart svg {
        height: 230px;
    }

    .scanner-screen {
        max-width: 520px;
        margin: 0 auto;
    }

    .history-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-section,
    .profile-card {
        max-width: 720px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
