/* Shared portal components. */

.card {
    margin: 0 0 var(--space-lg);
    padding: var(--space-md);
    border: 1px solid color-mix(in oklch, var(--line), white 24%);
    border-radius: var(--radius-card);
    background: var(--surface-raised);
    box-shadow: none;
    overflow: hidden;
}

.card-title {
    margin: 0 0 var(--space-sm);
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.section-head .card-title {
    margin-bottom: 0;
}

.section-meta {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.app-hero {
    display: grid;
    gap: var(--space-sm);
    padding: 18px var(--space-md);
    background: var(--surface-raised);
}

.app-kicker {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 700;
}

.app-kicker.centered {
    margin-inline: auto;
}

.app-title {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: 0;
}

.app-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.home-hero,
.profile-hero {
    align-items: start;
}

.profile-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-md);
}

.farm-chip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-xs);
    min-height: 44px;
    padding: 0 12px;
    border: none;
    border-radius: var(--radius-card);
    background: color-mix(in oklch, var(--brand-soft), white 30%);
    color: var(--brand-strong);
    text-decoration: none;
}

.farm-chip span {
    color: var(--muted);
    font-size: 12px;
}

.farm-chip strong {
    min-width: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.status-line {
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.status-subline {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.feature-tile {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 12px;
    border: none;
    border-radius: var(--radius-card);
    background: var(--page-bg);
    color: inherit;
    text-decoration: none;
    box-shadow: none;
    transition: transform 0.12s ease, background 0.16s ease;
}

.feature-tile::after {
    content: "chevron_right";
    color: var(--subtle);
    font-family: "Material Symbols Outlined";
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}

.feature-tile.is-static {
    grid-template-columns: 42px minmax(0, 1fr);
}

.feature-tile.is-static::after {
    content: none;
}

a.feature-tile:active {
    transform: scale(0.985);
    background: color-mix(in oklch, var(--brand-soft), white 40%);
}

.feature-tile.is-static {
    background: color-mix(in oklch, var(--brand-soft), white 62%);
}

.feature-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.feature-tile strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.feature-tile small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.feature-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: none;
    border-radius: 10px;
    background: color-mix(in oklch, var(--brand-soft), white 40%);
    color: var(--brand-strong);
}

.feature-icon .material-symbols-outlined {
    display: block;
    font-size: 23px;
    font-weight: 400;
    line-height: 1;
}

.feature-icon.is-garden {
    border: none;
    background: color-mix(in oklch, var(--brand-soft), white 30%);
    color: var(--brand-strong);
}

.feature-icon.is-accent {
    border: none;
    background: color-mix(in oklch, var(--accent-soft), white 30%);
    color: oklch(45% 0.052 88);
}

.feature-icon.is-blue {
    border: none;
    background: color-mix(in oklch, var(--blue-soft), white 30%);
    color: oklch(39% 0.082 246);
}

.feature-icon.is-profile {
    border: none;
    background: color-mix(in oklch, var(--brand-soft), white 30%);
    color: oklch(38% 0.042 148);
}

.compact-list,
.product-list {
    display: grid;
    gap: var(--space-xs);
}

.compact-row,
.product-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-sm);
    min-height: 50px;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid color-mix(in oklch, var(--line), white 60%);
    color: inherit;
    text-decoration: none;
}

.compact-row:last-child,
.product-row:last-child {
    border-bottom: 0;
}

.compact-row span,
.product-title {
    min-width: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.compact-row strong,
.product-price strong {
    color: var(--brand-strong);
    font-size: 15px;
    white-space: nowrap;
}

.account-snapshot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-md);
}

.quick-links {
    display: grid;
    gap: var(--space-xs);
    justify-items: end;
}

.quick-links a {
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.product-row {
    align-items: start;
    min-height: 64px;
}

.product-meta {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.product-price {
    display: grid;
    justify-items: end;
    gap: 3px;
}

.product-price span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.hero-note,
.state-note {
    margin-top: var(--space-sm);
    padding: 9px 11px;
    border: 1px solid color-mix(in oklch, var(--line), white 24%);
    border-radius: var(--radius-card);
    background: var(--brand-soft);
    color: var(--text);
    font-size: 12px;
    line-height: 1.65;
}

.state-note {
    margin-top: 0;
}

.state-note.is-warning,
.hero-note.is-warning {
    border: none;
    background: var(--warning-soft);
    color: oklch(36% 0.085 58);
}

.state-note.is-danger,
.hero-note.is-danger {
    border: none;
    background: var(--danger-soft);
    color: oklch(36% 0.1 29);
}

.state-note.is-info,
.hero-note.is-info {
    border: none;
    background: var(--blue-soft);
    color: oklch(36% 0.075 242);
}

.rule-link {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    color: var(--brand-strong);
    font-weight: 700;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.rule-link:focus-visible {
    outline: 2px solid color-mix(in oklch, var(--brand), transparent 50%);
    outline-offset: 3px;
    border-radius: 4px;
}

.rule-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: var(--page-bg);
}

.rule-overlay-header {
    flex-shrink: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in oklch, var(--surface-raised), transparent 4%);
}

.rule-overlay-header-inner {
    display: grid;
    max-width: 480px;
    margin: 0 auto;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    padding: 14px 16px;
}

.rule-overlay-header h2 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.rule-overlay-close {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 0;
    background: none;
    color: var(--brand-strong);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.rule-overlay-body {
    display: grid;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    flex: 1;
    gap: var(--space-lg);
    overflow: auto;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}

.action-list {
    display: grid;
    gap: var(--space-xs);
}

.action-item {
    display: grid;
    grid-template-columns: 44px 1fr 28px;
    align-items: center;
    gap: var(--space-sm);
    min-height: 68px;
    padding: var(--space-sm);
    border: none;
    border-radius: var(--radius-card);
    background: var(--page-bg);
    color: inherit;
    text-decoration: none;
    touch-action: manipulation;
    transition: transform 0.12s ease, background 0.18s ease;
}

.action-item:active {
    transform: scale(0.992);
    background: color-mix(in oklch, var(--brand-soft), white 40%);
}

.action-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    border: none;
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.action-icon.is-accent {
    border: none;
    background: var(--accent-soft);
    color: oklch(39% 0.09 86);
}

.action-icon.is-blue {
    border: none;
    background: var(--blue-soft);
    color: oklch(36% 0.09 242);
}

.action-title {
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.action-desc {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.action-arrow {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xs);
}

.metric-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.mini-card {
    min-width: 0;
    padding: var(--space-sm);
    border: none;
    border-radius: 10px;
    background: var(--page-bg);
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.metric-value {
    margin-top: 5px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    word-break: break-word;
}

.metric-value.primary {
    color: var(--brand);
    font-size: 28px;
}

.metric-value.success {
    color: var(--brand);
}

.metric-value.warning {
    color: var(--warning);
}

.metric-value.large {
    font-size: 40px;
}

.account-overview-card .metric-value,
.account-overview-card .metric-value.primary,
.account-overview-card .metric-value.success {
    color: var(--brand);
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    line-height: 1.12;
}

.account-overview-card .metric-grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-overview-card .metric-card-spend {
    grid-column: 1 / -1;
}

.account-overview-card .metric-card-spend .metric-value {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

.account-overview-card .metric-card {
    display: grid;
    align-content: center;
    min-height: 82px;
}

.detail-list {
    display: grid;
    gap: var(--space-xs);
}

.detail-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid color-mix(in oklch, var(--line), white 60%);
}

.detail-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.detail-label {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.detail-value {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    text-align: right;
    word-break: break-word;
}

.form-group {
    display: grid;
    gap: 6px;
    margin-bottom: var(--space-md);
}

.form-group label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.form-group input,
.form-group textarea,
.form-group select,
.form-control {
    width: 100%;
    min-height: var(--tap);
    padding: 0 13px;
    border: 1px solid color-mix(in oklch, var(--line-strong), white 28%);
    border-radius: var(--radius-control);
    outline: none;
    background: color-mix(in oklch, var(--surface-raised), var(--page-bg) 16%);
    color: var(--ink);
    font-size: 16px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
    appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.form-control::placeholder {
    color: var(--subtle);
    opacity: 1;
}

.form-group textarea {
    min-height: 96px;
    padding-top: 12px;
    padding-bottom: 12px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.form-control:focus {
    border-color: color-mix(in oklch, var(--brand), white 8%);
    box-shadow: var(--shadow-focus);
}

.form-group input:disabled,
.form-group textarea:disabled,
.form-group select:disabled,
.form-control:disabled {
    color: var(--subtle);
    background: color-mix(in oklch, var(--surface), var(--line) 30%);
    cursor: not-allowed;
}

.amount-input {
    min-height: 64px;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
}

.mode-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    padding: 0;
}
.mode-tab {
    flex: 1;
    min-height: 40px;
    padding-bottom: 8px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: color .2s ease;
}
.mode-tab.active {
    background: transparent;
    color: var(--brand-strong);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--brand);
}

.btn {
    display: inline-flex;
    width: 100%;
    min-width: 120px;
    min-height: var(--tap);
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.18s ease, background 0.18s ease;
    appearance: none;
    -webkit-appearance: none;
}

.btn:focus-visible,
.nav-back:focus-visible,
.header-action:focus-visible,
.pay-header-home:focus-visible,
.pay-header-more:focus-visible,
.tabbar-item:focus-visible,
.action-item:focus-visible,
.auth-guest-button:focus-visible,
.product-card:focus-visible,
.product-dropdown-trigger:focus-visible,
.me-stat:focus-visible,
.me-row:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
}

.btn:active {
    transform: scale(0.992);
}

.btn:disabled,
.btn.is-disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--brand);
    color: white;
    box-shadow: none;
}

.btn-primary:active {
    opacity: 0.85;
}

.btn-success,
.btn-wechat {
    background: var(--brand);
    color: white;
}

.btn-alipay {
    background: var(--blue);
    color: var(--surface-raised);
}

.btn-outline {
    border-color: var(--line-strong);
    background: transparent;
    color: var(--brand-strong);
}

.btn-sm {
    width: auto;
    min-width: 76px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
}

.btn-fit {
    width: auto;
    min-width: 96px;
    align-self: start;
}

.btn-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xs);
}

.button-stack {
    display: grid;
    gap: var(--space-xs);
}

.bottom-actions {
    position: sticky;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 40;
    margin: var(--space-sm) -14px 0;
    padding: var(--space-sm) 14px calc(var(--space-sm) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface-raised);
    backdrop-filter: none;
}

.no-tabbar .bottom-actions {
    bottom: 0;
}

.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: min(100%, 480px);
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface-raised);
    box-shadow: none;
    backdrop-filter: none;
}

.tabbar-item {
    display: grid;
    min-width: 0;
    min-height: 54px;
    place-items: center;
    align-content: center;
    gap: 3px;
    border-radius: var(--radius-control);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease, transform 0.1s ease;
}

.tabbar-item:active {
    transform: scale(0.96);
    background: color-mix(in oklch, var(--brand-soft), white 34%);
}

.tabbar-item.active {
    color: var(--brand-strong);
    background: color-mix(in oklch, var(--brand-soft), white 44%);
}

.tabbar-icon {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
}

.tabbar-icon svg {
    width: 23px;
    height: 23px;
}

.amount-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    padding: var(--space-md) 0;
}

.amount-display .symbol {
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
}

.amount-display .value {
    color: var(--ink);
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
}

.error-msg {
    margin-bottom: var(--space-sm);
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-card);
    background: var(--danger-soft);
    color: oklch(36% 0.1 29);
    font-size: 13px;
    line-height: 1.55;
}

.field-error {
    color: var(--danger);
    font-size: 12px;
    line-height: 1.45;
}

.success-icon {
    display: grid;
    width: 72px;
    height: 72px;
    margin: var(--space-lg) auto var(--space-sm);
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 12px 24px color-mix(in oklch, var(--brand), transparent 78%);
}

.success-icon svg {
    width: 36px;
    height: 36px;
    fill: white;
}

.meta-card {
    display: grid;
    gap: 0;
    margin-top: var(--space-sm);
    padding: 2px var(--space-sm);
    border: none;
    border-radius: var(--radius-card);
    background: var(--page-bg);
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 9px 0;
    border-bottom: 1px solid color-mix(in oklch, var(--line), white 55%);
    color: var(--muted);
    font-size: 13px;
    min-width: 0;
}

.meta-row:last-child {
    border-bottom: 0;
}

.meta-value {
    color: var(--text);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
    min-width: 0;
    overflow-wrap: break-word;
}

.mono,
.meta-value.mono,
.order-no,
.points-ledger-code,
.ledger-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0;
}

.ledger-balance {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.text-link {
    border: 0;
    background: transparent;
    color: var(--brand);
    font: inherit;
    font-weight: 700;
    padding: 0 0 0 6px;
}

.order-item,
.ledger-item,
.points-ledger-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid color-mix(in oklch, var(--line), white 60%);
}

.order-item:last-child,
.ledger-item:last-child,
.points-ledger-item:last-child {
    border-bottom: 0;
}

.order-info {
    min-width: 0;
}

.order-info .order-no,
.order-no {
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.order-info .order-channel,
.order-channel,
.order-points,
.points-ledger-meta,
.ledger-meta {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.order-amount {
    display: block;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.order-amount.paid,
.points-change.positive,
.ledger-change.positive {
    color: var(--brand);
}

.order-amount.pending,
.points-change.negative,
.ledger-change.negative {
    color: var(--warning);
}

.status-tag,
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    margin-top: 5px;
    padding: 0 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.status-tag.paid,
.pill.paid,
.pill.success {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.pill.default {
    background: color-mix(in oklch, var(--surface), var(--muted) 8%);
    color: var(--muted);
}

.pill.danger {
    background: color-mix(in oklch, var(--warning-soft), #fde8e8 40%);
    color: oklch(42% 0.12 25);
}

.status-tag.pending,
.pill.pending,
.pill.warning {
    background: var(--warning-soft);
    color: oklch(38% 0.09 58);
}

.points-change,
.ledger-change {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.points-balance,
.ledger-balance {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.empty-state {
    display: grid;
    gap: var(--space-xs);
    padding: var(--space-lg) var(--space-md);
    place-items: center;
    border: none;
    border-radius: var(--radius-card);
    background: var(--page-bg);
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.empty-state strong {
    color: var(--text);
    font-size: 15px;
}

.signature-image {
    max-width: 100%;
    max-height: 112px;
}

.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: 13px; }
.mt-12 { margin-top: var(--space-sm); }
.mt-16 { margin-top: var(--space-md); }
.mt-24 { margin-top: var(--space-lg); }
.mb-8 { margin-bottom: var(--space-xs); }

.task-panel {
    display: grid;
    gap: var(--space-sm);
    padding: var(--space-lg) 0;
    border: 0;
    border-radius: var(--radius-card);
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.task-panel + .task-panel,
.task-panel + .button-stack,
.button-stack + .task-panel {
    margin-top: 0;
}

.task-kicker {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.task-title {
    margin: 0;
    color: var(--text);
    font-size: 1.35rem;
    line-height: 1.18;
    letter-spacing: 0;
}

.task-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.task-form {
    display: grid;
    gap: var(--space-sm);
}

.task-form .form-group {
    margin-bottom: 0;
}

.task-form.compact {
    margin-top: var(--space-sm);
}

.code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 118px;
    gap: var(--space-sm);
    align-items: end;
}

.check-line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
    padding: 2px 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.check-line input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--brand);
    flex: 0 0 auto;
}

.password-login {
    border-top: 1px solid var(--line);
    padding-top: var(--space-sm);
}

.password-login summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 700;
}

.quote-box {
    display: grid;
    gap: var(--space-xs);
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.quote-main {
    color: var(--brand-strong);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.quote-sub {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.quote-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
}

.metric-grid > div {
    display: grid;
    gap: 4px;
    min-height: 72px;
    padding: var(--space-sm);
    border: none;
    border-radius: 10px;
    background: var(--page-bg);
}

.metric-grid span,
.compact-row small,
.order-row small,
.order-row-side small {
    color: var(--muted);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-grid strong {
    color: var(--text);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.filter-row {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter-row a {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    line-height: 1;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.86rem;
    background: var(--surface);
    white-space: nowrap;
}

.filter-row a.active {
    border-color: color-mix(in oklch, var(--brand), black 8%);
    background: color-mix(in oklch, var(--brand), white 88%);
    color: color-mix(in oklch, var(--brand), black 22%);
}

.order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid color-mix(in oklch, var(--line), white 60%);
    min-width: 0;
}

.order-row a {
    min-width: 0;
}

.order-row:last-child {
    border-bottom: 0;
}

.order-row > span:first-child {
    display: grid;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}

.order-row-side {
    display: grid;
    gap: 3px;
    text-align: right;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 0;
    max-width: 40%;
}

.timeline-list {
    display: grid;
    gap: var(--space-sm);
}

.timeline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border: none;
    border-radius: 10px;
    color: var(--muted);
    background: var(--page-bg);
}

.timeline-item.active {
    color: var(--text);
    border-color: color-mix(in oklch, var(--brand), white 45%);
    background: color-mix(in oklch, var(--brand), white 92%);
}

.meta-card.flat {
    box-shadow: none;
    border: 1px solid var(--line);
}

.amount-display.compact {
    margin: 0;
}

.tabbar-icon.material-symbols-outlined {
    font-size: 23px;
    line-height: 1;
}

@media (max-width: 360px) {
    .code-row {
        grid-template-columns: 1fr;
    }
    .metric-grid {
        grid-template-columns: 1fr;
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    background: oklch(16% 0.02 154 / 0.48);
    backdrop-filter: blur(6px);
}

.loading-overlay.active {
    display: flex;
}

.loading-panel {
    display: grid;
    min-width: 112px;
    gap: 12px;
    place-items: center;
    padding: 18px 20px;
    border: 1px solid oklch(100% 0 0 / 0.22);
    border-radius: var(--radius-card);
    background: oklch(18% 0.018 154 / 0.78);
    color: oklch(98% 0.004 154);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid oklch(100% 0 0 / 0.82);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 13px;
    font-weight: 700;
}

.app-toast {
    position: fixed;
    top: calc(66px + env(safe-area-inset-top));
    left: 50%;
    z-index: 1000;
    width: min(calc(100% - 32px), 420px);
    transform: translate(-50%, -12px);
    padding: 10px 14px;
    border-radius: var(--radius-control);
    background: var(--ink);
    color: var(--surface-raised);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-xs);
    width: min(100%, 480px);
    margin: 0 auto var(--space-md);
    padding: 0 14px;
}

.page-link,
.page-current {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.page-link {
    border: 1px solid var(--line-strong);
    background: var(--surface-raised);
    color: var(--brand-strong);
}

.page-link.disabled {
    color: var(--subtle);
}

.page-current {
    min-width: 72px;
    color: var(--muted);
}

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

@media (hover: hover) {
    .action-item:hover,
    .btn-outline:hover {
        border-color: color-mix(in oklch, var(--brand), white 52%);
    }
}

@media (max-width: 360px) {
    .container {
        padding-inline: 12px;
    }

    .header-row {
        padding-inline: 10px;
    }

    .header h1 {
        font-size: 16px;
    }

    .app-title {
        font-size: 22px;
    }

    .button-grid,
    .metric-grid.three,
    .profile-hero,
    .account-snapshot {
        grid-template-columns: 1fr;
    }

    .btn-fit {
        width: 100%;
    }

    .quick-links {
        justify-items: stretch;
    }

    .metric-grid {
        gap: 7px;
    }

    .header-action,
    .channel-badge {
        padding-inline: 8px;
        max-width: 72px;
    }
}

@media (min-width: 700px) {
    .container {
        padding-top: var(--space-lg);
    }

    .card {
        margin-bottom: var(--space-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

