/* EVM PayServer Client - design tokens and component styles */

/* Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================
   Design Tokens
   ============================================ */
:root {
    /* Primary colours. Indigo: high enough contrast on both grounds to
     * carry a primary action without shouting, and distinct from the
     * semantic green/amber/red so an accent never reads as a status. */
    --color-primary: #635bff;
    --color-primary-hover: #5851ea;
    --color-primary-light: #e8e7ff;

    /* Semantic Colors */
    --color-success: #30b566;
    --color-success-light: #e6f7ed;
    --color-warning: #f5a623;
    --color-warning-light: #fef6e6;
    --color-error: #df1b41;
    --color-error-light: #fce8ec;
    --color-info: #0073e6;
    --color-info-light: #e5f2ff;

    /* Neutral Colors */
    --color-gray-50: #f7f8fa;
    --color-gray-100: #f1f3f5;
    --color-gray-200: #e3e8ee;
    --color-gray-300: #c1c9d2;
    --color-gray-400: #a3acb9;
    --color-gray-500: #697386;
    --color-gray-600: #545969;
    --color-gray-700: #3c4257;
    --color-gray-800: #2a2f45;
    --color-gray-900: #1a1f36;

    /* Surfaces */
    --bg-primary: #ffffff;
    --bg-secondary: var(--color-gray-50);
    --bg-tertiary: var(--color-gray-100);
    --bg-sidebar: #1a1f36;
    --bg-sidebar-hover: #2a2f45;
    --bg-sidebar-active: #3c4257;

    /* Text */
    --text-primary: var(--color-gray-900);
    --text-secondary: var(--color-gray-700);
    --text-muted: var(--color-gray-500);
    --text-disabled: var(--color-gray-400);
    --text-inverse: #ffffff;
    --text-link: var(--color-primary);

    /* Borders */
    --border-color: var(--color-gray-200);
    --border-color-strong: var(--color-gray-300);
    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 8px;
    --border-radius-xl: 12px;
    --border-radius-full: 9999px;

    /* Shadows. Layered and shallow: a card should read as lifted off the
     * page, not as floating above it. */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-focus: 0 0 0 3px rgba(99, 91, 255, 0.15);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace;

    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 20px;
    --text-3xl: 24px;
    --text-4xl: 30px;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 56px;
    --content-max-width: 1400px;

    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-base: 0.15s ease;
    --transition-slow: 0.25s ease;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

/* ============================================
   App Layout - Sidebar + Content
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
}

/* Mobile: Sidebar hidden by default */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-inverse);
    font-size: var(--text-md);
    font-weight: 600;
}

.sidebar-logo-icon {
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: var(--space-6);
}

.sidebar-section-title {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray-500);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    margin: var(--space-1) 0;
    border-radius: var(--border-radius-md);
    color: var(--color-gray-400);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-inverse);
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-inverse);
}

.sidebar-link-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.sidebar-link.active .sidebar-link-icon,
.sidebar-link:hover .sidebar-link-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .sidebar-link {
    text-decoration: none;
}

/* Store Selector */
.store-selector {
    position: relative;
    padding: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.store-selector-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-sidebar-hover);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    color: var(--text-inverse);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.store-selector-btn:hover {
    background: var(--bg-sidebar-active);
    border-color: rgba(255, 255, 255, 0.15);
}

.store-selector-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.store-selector-info svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.store-selector-name {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-chevron {
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform var(--transition-fast);
}

/* Store Dropdown */
.store-dropdown {
    position: absolute;
    top: calc(100% + var(--space-1));
    left: var(--space-3);
    right: var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.store-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* The list scrolls inside the menu so many stores cannot push it past the
   viewport; the sidebar header and the Manage link stay outside it. */
.store-dropdown-list {
    max-height: min(320px, calc(100vh - 220px));
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.store-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-family: var(--font-family);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.store-dropdown-item:first-child {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.store-dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.store-dropdown-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.store-dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.store-dropdown-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-1) 0;
}

.store-dropdown-manage {
    color: var(--text-muted);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.store-dropdown-manage:hover {
    color: var(--text-primary);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-base);
}

@media (max-width: 768px) {
    .sidebar-overlay.open {
        display: block;
        opacity: 1;
    }
}

/* Sidebar close button for mobile */
.sidebar-close {
    display: none;
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    border-radius: var(--border-radius-md);
}

.sidebar-close:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-inverse);
}

@media (max-width: 768px) {
    .sidebar-close {
        display: flex;
    }
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.main-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--content-max-width);
    height: 100%;
    padding: 0 var(--space-6);
}

@media (min-width: 1600px) {
    .main-header-inner {
        padding: 0 var(--space-12);
    }
}

@media (min-width: 2000px) {
    .main-header-inner {
        padding: 0 var(--space-16);
    }
}

@media (max-width: 768px) {
    .main-header-inner {
        padding: 0 var(--space-4);
    }
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--border-radius-md);
    margin-right: var(--space-3);
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

.main-header-left {
    display: flex;
    align-items: center;
}

.main-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

@media (max-width: 768px) {
    .main-header-actions {
        gap: var(--space-2);
    }

    .main-header-actions .btn span,
    .main-header-actions .ps-btn span {
        display: none;
    }

    /* No icon to fall back on, and the invoices page has its own create
       control, so this stops competing for space rather than degrading
       into an unlabelled box. */
    .header-create-invoice {
        display: none;
    }
}

/* User menu dropdown */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 180px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 100;
    padding: var(--space-1) 0;
}

.user-menu-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s ease, color 0.1s ease;
}

.user-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.user-menu-logout:hover {
    color: var(--color-error);
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-1) 0;
}

.page-container {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: var(--space-8) var(--space-6);
    overflow-x: hidden;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .page-container {
        padding: var(--space-4);
        overflow-x: hidden;
    }
}

@media (min-width: 1600px) {
    .page-container {
        padding: var(--space-8) var(--space-12);
    }
}

@media (min-width: 2000px) {
    .page-container {
        padding: var(--space-8) var(--space-16);
    }
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    margin-bottom: var(--space-6);
}

/* The page shell every screen in this app has, written down once.
 *
 * `.invoices-page`, `.stores-page`, `.wallets-page`, `.payments-page` and
 * `.settings-page` used to each spell out these exact declarations for
 * themselves, which is how a sixth screen ended up with none of them: a
 * plugin page was rendering into `.page`, a class this stylesheet does not
 * define at all, so it had no max width, no column and no gap - it was the
 * one screen in the product with no layout. `.payments-page` had also drifted
 * to just the width pair, missing the flex layout every other screen has.
 *
 * Named in the `ps-` vocabulary the rest of the client is migrating to.
 * Per-page rules below only override where a screen genuinely differs
 * (`.settings-page`'s narrower max-width). */
.ps-page,
.invoices-page,
.payments-page,
.stores-page,
.wallets-page,
.settings-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    width: 100%;
    max-width: var(--content-max-width);
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.page-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-description {
    margin-top: var(--space-1);
    font-size: var(--text-base);
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: var(--space-2);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xs);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* ============================================
   Stats Cards
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

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

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card,
.ps-stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
}

.stat-label,
.ps-stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value,
.ps-stat-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-top: var(--space-1);
    letter-spacing: -0.02em;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
}

.stat-change.positive {
    color: var(--color-success);
}

.stat-change.negative {
    color: var(--color-error);
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--color-gray-50);
}

/* Bounded, scrolling user list: the page stays a fixed height however many
   users there are, and the header stays visible while the rows scroll. */
.admin-users-table {
    max-height: 480px;
    overflow: auto;
}

.admin-users-table .table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-cell-primary {
    color: var(--text-primary);
    font-weight: 500;
}

.table-cell-mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.table-cell-link {
    color: var(--text-link);
    font-weight: 500;
}

.table-cell-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    /* Without this, a column with unbreakable content (a long decimal, a
       status badge) shrinks until it wraps or clips instead of the table
       scrolling inside `.table-container` (rule above, at line 828) - the
       same pairing `.addresses-table`/`.addresses-table-container` already
       uses below. `check-classes-styled.py`, wired into CI as "Every class
       in the markup has a rule", checks every emitted class regardless of
       prefix, so `.table`/`.table-container` are covered and that pairing
       can't silently go stale. */
    .table {
        min-width: 500px;
    }
}

/* ============================================
   Buttons
   ============================================ */
.btn,
.ps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
    border-radius: var(--border-radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled,
.ps-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary,
.ps-btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover:not(:disabled),
.ps-btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-primary:focus,
.ps-btn-primary:focus {
    box-shadow: var(--shadow-focus);
}

.btn-secondary,
.ps-btn-secondary,
.ps-btn-ghost {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled),
.ps-btn-secondary:hover:not(:disabled),
.ps-btn-ghost:hover:not(:disabled) {
    background: var(--bg-secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-danger,
.ps-btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover:not(:disabled),
.ps-btn-danger:hover:not(:disabled) {
    background: #c4162f;
}

/* Semantic button variants. These have been referenced by the admin user table
 * since it was written - "Lock" and "Unlock" - and styled by nothing, so both
 * states rendered as a plain button and the colour carried no meaning. Shaped
 * like .btn-primary because they are solid actions, not ghosts. */
.btn-success,
.ps-btn-success {
    background: var(--color-success);
    color: white;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-success:hover:not(:disabled),
.ps-btn-success:hover:not(:disabled) {
    filter: brightness(0.95);
}

.btn-warning,
.ps-btn-warning {
    background: var(--color-warning);
    color: white;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-warning:hover:not(:disabled),
.ps-btn-warning:hover:not(:disabled) {
    filter: brightness(0.95);
}

.btn-sm,
.ps-btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label,
.ps-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-label-optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-input,
.form-select,
.form-textarea,
.ps-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover,
.ps-input:hover {
    border-color: var(--border-color-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.ps-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.form-input::placeholder,
.ps-input::placeholder {
    color: var(--text-disabled);
}

.form-help {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.form-error {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-error);
}

.form-optional {
    font-weight: 400;
    color: var(--text-muted);
}

.form-alert {
    padding: var(--space-3);
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.form-alert-error {
    background: color-mix(in srgb, var(--color-error) 10%, transparent);
    color: var(--color-error);
    border: 1px solid color-mix(in srgb, var(--color-error) 20%, transparent);
}

.form-alert-success {
    background: color-mix(in srgb, var(--color-success) 10%, transparent);
    color: var(--color-success);
    border: 1px solid color-mix(in srgb, var(--color-success) 20%, transparent);
}

/* Page-level banners (safe mode, settings save results). Text keeps the
   normal colour so it stays readable on the tint in both themes; the tone
   comes from the border, background and the heading. */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.alert p {
    margin: var(--space-1) 0 0;
}

.alert-error {
    background: color-mix(in srgb, var(--color-error) 10%, transparent);
    border: 1px solid var(--color-error);
}

.alert-error strong {
    color: var(--color-error);
}

.alert-warning {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
}

.alert-warning strong {
    color: var(--color-warning);
}

.alert-success {
    background: color-mix(in srgb, var(--color-success) 10%, transparent);
    border: 1px solid var(--color-success);
}

.form-alert-action {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.form-row {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.form-row > .form-group {
    margin-top: 0;
    margin-bottom: 0;
}

.form-group-grow {
    flex: 1;
}

.form-row > .form-group:not(.form-group-grow) {
    flex: 0 0 180px;
}

.form-advanced-toggle {
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
}

.form-advanced-section {
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: modal-fade-in 0.15s ease-out;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-slide-in 0.15s ease-out;
}

.modal-md {
    max-width: 520px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile: full-width modal */
@media (max-width: 640px) {
    .modal {
        margin: var(--space-3);
    }
    .modal-md {
        max-width: none;
    }
    .form-row {
        flex-direction: column;
    }
}

/* ============================================
   Badges & Status
   ============================================ */
.badge,
.ps-status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--border-radius-full);
    text-transform: capitalize;
}

.badge-success,
.ps-status-badge.paid,
.ps-status-badge.confirmed {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-warning,
.ps-status-badge.pending {
    background: var(--color-warning-light);
    color: #9e6c00;
}

.badge-error,
.ps-status-badge.expired,
.ps-status-badge.error {
    background: var(--color-error-light);
    color: var(--color-error);
}

.badge-info {
    background: var(--color-info-light);
    color: var(--color-info);
}

.badge-neutral {
    background: var(--color-gray-100);
    color: var(--color-gray-600);
}

/* Status dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.success { background: var(--color-success); }
.status-dot.warning { background: var(--color-warning); }
.status-dot.error { background: var(--color-error); }
.status-dot.info { background: var(--color-info); }
.status-dot.neutral { background: var(--color-gray-400); }

/* ============================================
   Network Badges
   ============================================ */
.network-badge,
.ps-network-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.network-badge-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

/* ============================================
   Address Display
   ============================================ */
.address,
.ps-address {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.address-truncated {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.address-copy-btn {
    padding: var(--space-1);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.address-copy-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* ============================================
   Empty States
   ============================================ */
.empty-state,
.evm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    color: var(--text-disabled);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: var(--space-5);
}

/* ============================================
   Loading States
   ============================================ */
.spinner,
.ps-spinner,
.loading-spinner,
.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-sm,
.loading-spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

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

/* Page-level and inline loading, rendered by LoadingState and LoadingInline. */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-12);
}

.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.loading-text {
    margin: 0;
    font-size: var(--text-base);
    color: var(--text-muted);
}

.loading-text-sm {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.skeleton,
.ps-skeleton {
    background: linear-gradient(90deg, var(--color-gray-100) 25%, var(--color-gray-200) 50%, var(--color-gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--border-radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Grid & Layout Utilities
   ============================================ */
.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

/* Text utilities */
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }

/* ============================================
   EVM-Specific Styles (legacy compatibility)
   ============================================ */
.evm-page {
    width: 100%;
    max-width: var(--content-max-width);
}

/* One card definition for both vocabularies, now that the client emits ui-kit's
 * names. This is the union of the two rules it replaces: ui-kit's Card (rendered
 * on the 404 page) brought `box-shadow`, and the client's detail cards brought
 * `overflow: hidden`. Both now apply to both, which is the point - one design
 * system means one card - and it is a real visual change: 40 cards gain a
 * subtle shadow they did not have. */
.ps-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.ps-card-padded {
    padding: var(--space-5);
}







.evm-invoice-list { display: flex; flex-direction: column; gap: var(--space-3); }
.evm-detail-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.evm-detail-row { display: flex; justify-content: space-between; align-items: center; }
.evm-detail-label { color: var(--text-muted); font-size: var(--text-sm); }

.evm-network-status-list { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.evm-network-status-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}
.evm-network-status-indicator { font-size: var(--text-sm); }
.evm-network-status-item.connected .evm-network-status-indicator { color: var(--color-success); }
.evm-network-status-item.disconnected .evm-network-status-indicator { color: var(--color-error); }

/* ============================================
   Dashboard
   ============================================ */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    width: 100%;
    max-width: var(--content-max-width);
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

@media (max-width: 600px) {
    .dashboard-header {
        flex-direction: column;
        gap: var(--space-3);
    }
}

.dashboard-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

@media (max-width: 600px) {
    .dashboard-title {
        font-size: var(--text-2xl);
    }
}

.dashboard-subtitle {
    margin-top: var(--space-1);
    font-size: var(--text-base);
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .dashboard-subtitle {
        font-size: var(--text-sm);
    }
}

.dashboard-actions {
    display: flex;
    gap: var(--space-2);
}

@media (max-width: 600px) {
    .dashboard-actions {
        width: 100%;
    }

    .dashboard-actions .btn,
    .dashboard-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Onboarding checklist */
.onboarding-checklist {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-xs);
}

.onboarding-checklist-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.onboarding-checklist-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    list-style: none;
    padding: 0;
    margin: 0;
}

.onboarding-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.onboarding-step-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    color: var(--color-success);
}

.onboarding-step-done .onboarding-step-mark {
    border-color: var(--color-success);
    background: color-mix(in srgb, var(--color-success) 12%, transparent);
}

.onboarding-step-done .onboarding-step-label {
    color: var(--text-primary);
    text-decoration: line-through;
    text-decoration-color: var(--border-color);
}

/* The optional contact-email row: a dashed mark and a muted tag set it apart
   from the required steps, so it reads as a suggestion, not unfinished setup. */
.onboarding-step-optional .onboarding-step-mark {
    border-style: dashed;
}

.onboarding-step-tag {
    font-size: var(--text-xs);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0 var(--space-1);
}

.onboarding-step-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.onboarding-step-skip {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.onboarding-step-skip:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* An arrow rather than the word "Go": the label beside it already says what
   the step is, so a second word only competed with it. The accessible name
   comes from aria-label on the link, not from the glyph. */
.onboarding-step-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    /* Keeps the hit target at the 24px the icon alone would not reach. */
    padding: var(--space-1);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.onboarding-step-action:hover {
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    transform: translateX(2px);
}

.onboarding-step-action:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .onboarding-step-action {
        transition: background-color 0.15s ease;
    }

    .onboarding-step-action:hover {
        transform: none;
    }
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
}

.metric-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.metric-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 500;
}

.metric-trend svg {
    flex-shrink: 0;
}

.metric-trend-up {
    color: var(--color-success);
}

.metric-trend-down {
    color: var(--color-error);
}

.metric-trend-neutral {
    color: var(--text-muted);
}

.metric-period {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 900px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-5);
    padding-bottom: var(--space-3);
}

@media (max-width: 600px) {
    .chart-header {
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-4);
        padding-bottom: var(--space-2);
    }
}

.chart-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.chart-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

@media (max-width: 600px) {
    .chart-subtitle {
        display: none;
    }
}

.chart-controls {
    display: flex;
    gap: var(--space-1);
}

.btn-xs,
.ps-btn-xs {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
}

.btn-ghost.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.chart-body {
    padding: var(--space-3) var(--space-5) var(--space-5);
}

@media (max-width: 600px) {
    .chart-body {
        padding: var(--space-3) var(--space-4) var(--space-4);
    }
}

/* Volume Chart */
.volume-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.volume-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
}

@media (max-width: 600px) {
    .volume-chart-bars {
        height: 120px;
        gap: 2px;
    }
}

.volume-bar {
    flex: 1;
    background: var(--color-primary-light);
    border-radius: 2px 2px 0 0;
    min-height: 4px;
    transition: background var(--transition-fast);
}

.volume-bar:hover {
    background: var(--color-primary);
}

.volume-bar-today {
    background: var(--color-primary);
}

.volume-chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Payment Methods Breakdown */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.payment-method-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Same class, two different elements: the dashboard breakdown uses a <div>
   and wants the flex layout above, but the payment-methods table's <tr>
   reuses this class name too - `display: flex` takes it out of table layout,
   so its cells stop sharing the header's column widths. Same collision
   already fixed for tr.payment-row below; give this one the same override.

   Confirmed against the real rendered DOM, not just the markup in this file:
   mounted PaymentMethodsTab in a browser with a stubbed API response and
   inspected the live tree. The row's <tr> is a direct child of <tbody> with
   or without this rule - so the table-nesting/parser-hoisting theory this
   ticket also suspected does not apply here. Removing this rule reproduces
   the reported symptom exactly (computed display: flex, headers 626-819px
   right of their columns); restoring it makes every header sit at dx=0.

   Re-verified independently on a later pass, against a fresh mount of the
   same component with a stubbed response: `tr.parentElement === tbody` is
   true both with and without this rule; with it removed, computed display
   flips to `flex` and every header lands 714-973px right of its column
   (dx 0, -714, -772, -784, -960, -973 across the six columns); with it
   restored, every dx is 0. Numbers differ slightly from the pass above
   because the stub payload's field lengths differ - the shape doesn't.

   The DOM-nesting theory isn't just empirically absent here, it's
   structurally impossible: table-content-model hoisting (the algorithm
   that can move a <tr> out from under a non-<table> ancestor) is part of
   the HTML tree-construction algorithm and runs only while the browser's
   HTML parser is tokenizing markup - `innerHTML`, `document.write`, the
   initial page load. This app is CSR: Leptos's `view!` macro builds nodes
   with `document.createElement`/`appendChild`, which never invokes that
   parser, so there is no mechanism available to hoist anything regardless
   of what any one test run happens to observe. */
tr.payment-method-row {
    display: table-row;
}

.payment-method-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 60px;
}

.payment-method-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.payment-method-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.payment-method-bar-container {
    flex: 1;
    height: 8px;
    background: var(--color-gray-100);
    border-radius: var(--border-radius-full);
    overflow: hidden;
}

.payment-method-bar {
    height: 100%;
    border-radius: var(--border-radius-full);
    transition: width var(--transition-slow);
}

.payment-method-pct {
    width: 36px;
    text-align: right;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

/* Activity Section */
.activity-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 900px) {
    .activity-section {
        grid-template-columns: 1fr;
    }
}

.activity-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xs);
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 600px) {
    .activity-header {
        padding: var(--space-3) var(--space-4);
    }
}

.activity-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.activity-link {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-primary);
}

.activity-link:hover {
    text-decoration: underline;
}

/* Recent Payments List */
.payments-list {
    display: flex;
    flex-direction: column;
}

.payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
    gap: var(--space-3);
    /* The dashboard panel renders each row as a link to the payment; without
       this the whole row picks up the default anchor colour and underline. */
    color: inherit;
    text-decoration: none;
}

@media (max-width: 600px) {
    .payment-row {
        padding: var(--space-3) var(--space-4);
        flex-wrap: wrap;
    }
}

/* The same class is used for two different things, and only one of them is a
 * flex list. The dashboard's recent-payments panel renders each row as
 * <a class="payment-row"> and wants the flex layout above. The payments table
 * and the invoice detail table render <tr class="payment-row">, and there
 * `display: flex` takes the row out of table layout entirely: its cells stop
 * being table cells, so they no longer share the column widths the <thead>
 * computed.
 *
 * The result is a header row laid out independently of its data. Measured on
 * the payments table: the "Transaction" header spans 883px above a 146px cell,
 * and every later header sits 600-700px right of the column it names.
 *
 * `tr.payment-row` is specificity (0,1,1) against the flex rule's (0,1,0), so
 * it wins wherever it sits in the file rather than depending on order - which
 * matters in a stylesheet where that has already gone wrong three times.
 */
tr.payment-row {
    display: table-row;
}

.payment-row:last-child {
    border-bottom: none;
}

.payment-row:hover {
    background: var(--color-gray-50);
}

.payment-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
    flex: 1;
}

.payment-tx {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.payment-time {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.payment-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-1);
}

@media (max-width: 480px) {
    .payment-amount {
        align-items: flex-start;
        flex-direction: row;
        gap: var(--space-2);
    }
}

.payment-crypto {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.payment-chain {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Panel-level message: loading, empty, or "we cannot tell you". Sized for an
   activity card, unlike the full-page .empty-state. */
.activity-note {
    padding: var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.activity-note-error {
    color: var(--color-error);
}

/* Network Status List */
.network-list {
    display: flex;
    flex-direction: column;
}

.network-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.network-row:last-child {
    border-bottom: none;
}

.network-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.network-dot-online {
    background: var(--color-success);
    box-shadow: 0 0 0 3px var(--color-success-light);
}

.network-dot-degraded {
    background: var(--color-warning);
    box-shadow: 0 0 0 3px var(--color-warning-light);
}

.network-dot-offline {
    background: var(--color-gray-400);
}

.network-dot-error {
    background: var(--color-error);
    box-shadow: 0 0 0 3px var(--color-error-light);
}

.network-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.network-detail {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: right;
}

/* Badge variants */
.badge-secondary {
    background: var(--color-gray-100);
    color: var(--color-gray-600);
}

/* ============================================
   Invoices Page
   ============================================ */

/* Toolbar: Filters + Search */
.invoices-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.invoices-filters {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.filter-select {
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: var(--space-8);
    min-width: 140px;
    transition: border-color var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--color-primary);
}

.filter-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.filter-tab.active {
    color: var(--text-primary);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-xs);
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 var(--space-1);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--color-gray-200);
    border-radius: var(--border-radius-full);
}

.filter-tab.active .filter-count {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.invoices-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    min-width: 240px;
}

.invoices-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.invoices-search input {
    flex: 1;
    border: none;
    background: none;
    font-size: var(--text-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    outline: none;
}

.invoices-search input::placeholder {
    color: var(--text-muted);
}

/* Invoice Table */
.invoices-table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
}

.invoices-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.invoices-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.invoices-table th:last-child {
    width: 48px;
}

.invoices-table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.invoices-table tbody tr:last-child td {
    border-bottom: none;
}

.invoices-table tbody tr:hover {
    background: var(--color-gray-50);
}

/* Invoice Cell Styles */
.invoice-id-cell {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.invoice-id-link {
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.invoice-id-link:hover {
    text-decoration: underline;
}

.invoice-order-id {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Store attribution, shown only in the "All Stores" view. */
.invoice-store,
.payment-store {
    color: var(--text-secondary);
}

.invoice-amount-cell {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.invoice-fiat {
    font-weight: 600;
    color: var(--text-primary);
}

.invoice-crypto {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.invoice-network {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.invoice-customer {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.invoice-date {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.btn-icon,
.ps-btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pagination (shared component) */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
}

.pagination-info {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.pagination-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.pagination-btn-page {
    color: var(--text-primary);
}

.pagination-btn-active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    cursor: default;
}

.pagination-btn-active:hover:not(:disabled) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    font-size: var(--text-sm);
    color: var(--text-muted);
    user-select: none;
}

/* Invoice Detail Page */
.invoice-detail-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    width: 100%;
    max-width: var(--content-max-width);
}

.invoice-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.invoice-detail-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: var(--space-2);
}

.back-link:hover {
    color: var(--text-primary);
}

.invoice-detail-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.invoice-detail-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
}

.invoice-detail-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.invoice-detail-actions {
    display: flex;
    gap: var(--space-2);
}

.invoice-detail-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-5);
}

@media (max-width: 900px) {
    .invoice-detail-content {
        grid-template-columns: 1fr;
    }
}

.invoice-detail-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.invoice-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* Detail Card */
.ps-card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.ps-card-header h3 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.ps-card-body {
    padding: var(--space-5);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.detail-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.detail-value {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.detail-value-lg {
    font-size: var(--text-lg);
    font-weight: 600;
}

.address-code {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    background: var(--bg-secondary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius-sm);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
}

.btn-icon-sm:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    position: relative;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 28px;
    bottom: -12px;
    width: 2px;
    background: var(--border-color);
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
    margin-top: 4px;
}

.timeline-item-success .timeline-dot {
    background: var(--color-success);
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.timeline-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.timeline-time {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.timeline-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.timeline-item-pending .timeline-dot {
    background: var(--color-warning);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.timeline-item-error .timeline-dot {
    background: var(--color-error);
}

/* Customer Info */
.customer-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.customer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-md);
}

.customer-details {
    display: flex;
    flex-direction: column;
}

.customer-email {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 500;
}

.metadata-empty {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-style: italic;
}

/* Payments Table */
.ps-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.payment-count {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 400;
}

.payments-body {
    padding: 0;
}

.payments-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-8);
    color: var(--text-muted);
}

.payments-empty svg {
    opacity: 0.5;
}

.payments-table-container {
    overflow-x: auto;
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
}

.payments-table thead th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.payments-table tbody td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.payments-table tbody tr:last-child td {
    border-bottom: none;
}

.payment-row:hover {
    background: var(--bg-secondary);
}

.payment-tx-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.tx-hash {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-primary);
}

.btn-icon-xs,
.ps-btn-icon-xs {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
}

.btn-icon-xs:hover,
.ps-btn-icon-xs:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.payment-amount {
    font-family: var(--font-mono);
    font-weight: 500;
}

.payment-time {
    color: var(--text-muted);
    white-space: nowrap;
}

.confirmations-done {
    color: var(--color-success);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.confirmations-pending {
    color: var(--color-warning);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

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

.detail-value-address {
    max-width: 280px;
}

.invoice-paid {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Responsive Visibility
 *
 * `!important` here is not laziness, it is the only thing that works. These are
 * utility classes applied alongside a component class, and the component class
 * is defined later in this file with its own `display`:
 *
 *     .mobile-only     { display: none }   line 2714
 *     .invoices-cards  { display: flex }   line 2729
 *     .payments-cards  { display: flex }   line 3189
 *
 * Identical specificity (0,1,0), so source order decides and the component
 * wins. `<div class="payments-cards mobile-only">` was therefore visible on
 * desktop, which is why every table rendered twice: the table and the card
 * list, one under the other, showing the same rows.
 *
 * The media query below already carried `!important` for the mobile direction -
 * someone hit this and patched half of it. This is the other half.
 */
.desktop-only {
    display: block !important;
}

.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    /* `display: block` is wrong for these two, and the utility above cannot know
       that. Both are flex columns whose spacing comes entirely from `gap`, so
       forcing `block` leaves the gap declared and inert: every card's border
       sits flush against the next one. Measured before this rule existed -
       display: block, row-gap: 12px, actual distance between cards: 0px.
       Restoring `flex` costs nothing on desktop, where the utility hides them. */
    .payments-cards,
    .invoices-cards {
        display: flex !important;
    }
}

/* Mobile Invoice Cards */
.invoices-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.invoice-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.invoice-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.invoice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-2);
}

.invoice-card-id {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.invoice-card-id-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.invoice-card-order {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.invoice-card-amounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.invoice-card-amount {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.invoice-card-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invoice-card-value {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.invoice-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color);
}

.invoice-card-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.invoice-card-store,
.payment-card-store {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.invoice-card-footer svg {
    color: var(--text-muted);
}

/* Mobile Responsive - Invoice List */
@media (max-width: 768px) {
    .invoices-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .invoices-page .page-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .invoices-page .page-actions {
        display: flex;
        gap: var(--space-2);
    }

    .invoices-page .page-actions .btn,
    .invoices-page .page-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .invoices-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .invoices-filters {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .filter-select {
        flex: 1;
        min-width: 120px;
    }

    .invoices-search {
        width: 100%;
        min-width: unset;
    }

    .pagination {
        flex-direction: column;
        gap: var(--space-3);
        align-items: center;
    }

    .pagination-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .invoices-cards {
        width: 100%;
    }
}

/* Mobile Responsive - Invoice Detail */
@media (max-width: 768px) {
    .invoice-detail-page {
        width: 100%;
        max-width: 100%;
        gap: var(--space-4);
        overflow-x: hidden;
    }

    .invoice-detail-header {
        flex-direction: column;
        gap: var(--space-3);
    }

    .invoice-detail-header-left {
        width: 100%;
    }

    .invoice-detail-title-row {
        flex-wrap: wrap;
    }

    .invoice-detail-title {
        font-size: var(--text-xl);
        word-break: break-word;
    }

    .invoice-detail-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .invoice-detail-actions .btn,
    .invoice-detail-actions .ps-btn {
        justify-content: center;
    }

    .invoice-detail-content {
        gap: var(--space-4);
    }

    .invoice-detail-main,
    .invoice-detail-sidebar {
        gap: var(--space-4);
        width: 100%;
    }

    .ps-card {
        border-radius: var(--border-radius-md);
        overflow: hidden;
    }

    .ps-card-header {
        padding: var(--space-3) var(--space-4);
    }

    .ps-card-header h3 {
        font-size: var(--text-base);
    }

    .ps-card-body {
        padding: var(--space-3) var(--space-4);
    }

    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
    }

    .detail-value-lg {
        font-size: var(--text-lg);
    }

    .detail-value-address {
        width: 100%;
        max-width: 100%;
    }

    .address-code {
        font-size: var(--text-xs);
        word-break: break-all;
        display: block;
        max-width: calc(100vw - 120px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Mobile Payments Table */
    .payments-body {
        overflow-x: hidden;
    }

    .payments-table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .payments-table {
        min-width: 350px;
        font-size: var(--text-xs);
    }

    .payments-table thead th,
    .payments-table tbody td {
        padding: var(--space-2);
    }

    /* Hide Network column on mobile */
    .payments-table thead th:nth-child(3),
    .payments-table tbody td:nth-child(3) {
        display: none;
    }

    .tx-hash {
        font-size: 10px;
    }

    .payment-tx-cell {
        max-width: 100px;
    }

    /* Timeline Mobile */
    .timeline {
        gap: var(--space-3);
    }

    .timeline-item {
        gap: var(--space-2);
    }

    .timeline-title {
        font-size: var(--text-sm);
        word-break: break-word;
    }

    .timeline-time {
        font-size: var(--text-xs);
    }

    /* Customer Card Mobile */
    .customer-info {
        flex-direction: column;
        text-align: center;
    }

    .customer-avatar {
        width: 48px;
        height: 48px;
        font-size: var(--text-lg);
    }

    /* Metadata Mobile */
    .metadata-json {
        font-size: var(--text-xs);
        overflow-x: auto;
        max-width: 100%;
        word-break: break-all;
    }

    .metadata-empty {
        text-align: center;
    }
}

/* ============================================
   Payments Page
   ============================================ */
.payments-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.payments-filters {
    display: flex;
    gap: var(--space-1);
}

.payments-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    min-width: 280px;
}

.payments-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.payments-search input {
    border: none;
    background: transparent;
    font-size: var(--text-sm);
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

.payments-search input::placeholder {
    color: var(--text-muted);
}

/* Payments Table */
.payments-table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-6);
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
}

.payments-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.payments-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payments-table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-sm);
}

.payments-table tbody tr:last-child td {
    border-bottom: none;
}

.payment-row:hover {
    background: var(--bg-secondary);
}

.payment-tx-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.payment-tx-cell .tx-hash {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.payment-amount {
    font-weight: 500;
    font-family: var(--font-mono);
}

.payment-network {
    color: var(--text-secondary);
}

.payment-invoice-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.payment-invoice-link:hover {
    text-decoration: underline;
}

.payment-credited {
    font-weight: 500;
    color: var(--color-success);
}

.payment-date {
    color: var(--text-muted);
}


/* Payments Cards (Mobile) */
.payments-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.payment-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
}

.payment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.payment-card-amount {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.payment-card-amount-value {
    font-size: var(--text-lg);
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.payment-card-network {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.payment-card-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.payment-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.payment-card-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-card-tx {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.payment-card-tx code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.payment-card-tx svg {
    color: var(--text-muted);
}

.payment-card-invoice-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--text-sm);
}

.payment-card-invoice-link:hover {
    text-decoration: underline;
}

.payment-card-credited {
    font-weight: 500;
    color: var(--color-success);
    font-size: var(--text-sm);
}

.payment-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-4);
}

.payment-card-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.payment-card-footer .btn,
.payment-card-footer .ps-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Mobile Responsive - Payments */
@media (max-width: 768px) {
    .payments-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .payments-page .page-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .payments-page .page-actions {
        display: flex;
        gap: var(--space-2);
    }

    .payments-page .page-actions .btn,
    .payments-page .page-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .payments-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .payments-filters {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-2);
        margin-bottom: calc(-1 * var(--space-2));
        scrollbar-width: none;
    }

    .payments-filters::-webkit-scrollbar {
        display: none;
    }

    .payments-search {
        width: 100%;
        min-width: unset;
    }

    .payments-cards {
        width: 100%;
    }
}

/* ============================================
   Payment Detail Page
   ============================================ */
.payment-detail-page {
    width: 100%;
    max-width: var(--content-max-width);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.payment-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.payment-detail-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.payment-detail-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.payment-detail-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-family: var(--font-mono);
}

.payment-detail-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
}

.payment-detail-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.payment-detail-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-6);
}

.payment-detail-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.payment-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* Full transaction hash display */
.tx-hash-full {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    word-break: break-all;
    color: var(--text-primary);
}

.address-link {
    font-family: var(--font-mono);
    color: var(--color-primary);
    text-decoration: none;
}

.address-link:hover {
    text-decoration: underline;
}

/* Related invoice link */
.related-invoice-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.related-invoice-link:hover {
    background: var(--bg-tertiary);
}

.related-invoice-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.related-invoice-info svg {
    color: var(--text-muted);
}

.related-invoice-info span {
    font-weight: 500;
    color: var(--color-primary);
}

.related-invoice-link svg:last-child {
    color: var(--text-muted);
}

/* Status info section */
.status-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.status-badge-lg {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
}

.status-warning {
    font-size: var(--text-sm);
    color: var(--color-error);
    margin: 0;
    padding: var(--space-2);
    background: var(--color-error-light);
    border-radius: var(--border-radius-sm);
}

.status-info-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
}

/* Mobile Responsive - Payment Detail */
@media (max-width: 768px) {
    .payment-detail-page {
        width: 100%;
        max-width: 100%;
        gap: var(--space-4);
        overflow-x: hidden;
    }

    .payment-detail-header {
        flex-direction: column;
        gap: var(--space-3);
    }

    .payment-detail-header-left {
        width: 100%;
    }

    .payment-detail-title-row {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .payment-detail-title {
        font-size: var(--text-2xl);
    }

    .payment-detail-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .payment-detail-actions .btn,
    .payment-detail-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .payment-detail-content {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
    }

    .payment-detail-sidebar {
        order: -1;
    }

    .tx-hash-full {
        font-size: 10px;
    }

    .related-invoice-link {
        padding: var(--space-4);
    }
}

/* ============================================
   Stores Page
   ============================================ */

.stores-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
}

/* Store Card */
.store-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}

.store-card:hover {
    border-color: var(--border-color-strong);
    box-shadow: var(--shadow-md);
}

.store-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.store-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-primary-light);
    border-radius: var(--border-radius-md);
    color: var(--color-primary);
    flex-shrink: 0;
}

.store-card-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    min-width: 0;
}

.store-card-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.store-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
}

.store-card-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.store-card-website {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.store-card-id {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.store-card-footer svg {
    color: var(--text-muted);
}

/* ============================================
   Store Detail Page
   ============================================ */

.store-detail-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    width: 100%;
    max-width: 900px;
}

.store-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.store-detail-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.store-detail-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.store-detail-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.store-detail-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.store-detail-id {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--color-gray-100);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
}

.store-detail-actions {
    display: flex;
    gap: var(--space-2);
}

/* Store Tabs */
.store-tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-6);
}

.store-tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.store-tab:hover {
    color: var(--text-secondary);
}

.store-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.store-tab-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* General Tab */
.store-tab-general {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group + .form-group {
    margin-top: var(--space-4);
}

/* Not inside a layout container that already provides its own `gap`. There the
   stacked-form margin above is not merely redundant, it pushes every second
   field 16px below the first:

     .form-row      Amount vs Currency in the create-invoice modal
     .settings-grid Account Created vs Last Login in Settings > Account

   Both were reported as "slightly down", and both are this one rule.
   `.form-row > .form-group` already says `margin-top: 0`, but that rule and the
   one above have identical specificity (0,2,0), so it loses on source order and
   has never applied. These are child+sibling (0,3,0) and win wherever they sit,
   rather than depending on where the next rule gets added.

   Extend this list when a new gap-based container starts holding .form-groups;
   CSS cannot ask whether a parent set a gap. */
.form-row > .form-group + .form-group,
.settings-grid > .form-group + .form-group {
    margin-top: 0;
}

/* An <input> and a <select> carrying the same class rendered 34px and 36px:
   identical padding, border and box-sizing, but a select's intrinsic content
   box is taller. Side by side that reads as one control sagging. Pin the height
   so anything styled .form-input is the same height as everything else. */
.form-input,
.ps-input {
    min-height: 36px;
}

.form-label,
.ps-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-input,
.ps-input {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    outline: none;
    transition: all 0.15s ease;
}

.form-input:hover,
.ps-input:hover {
    border-color: var(--border-color-strong);
}

.form-input:focus,
.ps-input:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.form-input::placeholder,
.ps-input::placeholder {
    color: var(--text-disabled);
}

.form-help {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0;
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

/* Danger Zone Card */
.ps-card-danger {
    border-color: var(--color-error-light);
}

.ps-card-danger .ps-card-header {
    background: var(--color-error-light);
}

.ps-card-danger .ps-card-header h3 {
    color: var(--color-error);
}

.danger-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-color);
}

.danger-action:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.danger-action:first-child {
    padding-top: 0;
}

.danger-action-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.danger-action-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.danger-action-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Payment Methods Tab */
.store-tab-payment-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.section-desc {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: var(--space-1) 0 0 0;
}

.payment-methods-table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.payment-methods-table {
    width: 100%;
    border-collapse: collapse;
}

.payment-methods-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--border-color);
}

.payment-methods-table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-color);
}

.payment-methods-table tr:last-child td {
    border-bottom: none;
}

.payment-method-row:hover {
    background: var(--color-gray-50);
}

.payment-method-asset {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.payment-method-symbol {
    font-weight: 600;
    color: var(--text-primary);
}

.payment-method-network {
    color: var(--text-secondary);
}

.payment-method-type {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--color-gray-100);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius-sm);
}

.payment-method-index {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Webhooks Tab */
.store-tab-webhooks {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.webhook-url-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-gray-50);
    padding: var(--space-3);
    border-radius: var(--border-radius-md);
}

.webhook-url {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    word-break: break-all;
}

.webhook-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.webhook-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.webhook-detail-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.webhook-secret-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.webhook-secret {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.webhook-events {
    display: flex;
    flex-direction: column;
}

.webhook-event {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

.webhook-event:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.webhook-event:first-child {
    padding-top: 0;
}

.webhook-event code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.webhook-event span {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: right;
}

.webhook-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-8) var(--space-4);
    gap: var(--space-3);
}

.webhook-empty svg {
    color: var(--text-disabled);
}

.webhook-empty h4 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.webhook-empty p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
    max-width: 300px;
}

/* Mobile Responsive - Stores */
@media (max-width: 768px) {
    .stores-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .stores-page .page-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .stores-page .page-actions {
        display: flex;
        gap: var(--space-2);
    }

    .stores-page .page-actions .btn,
    .stores-page .page-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .stores-grid {
        grid-template-columns: 1fr;
    }

    .store-card {
        padding: var(--space-4);
    }

    .store-detail-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .store-detail-header {
        flex-direction: column;
        gap: var(--space-3);
    }

    .store-detail-title {
        font-size: var(--text-2xl);
    }

    .store-detail-actions {
        width: 100%;
    }

    .store-detail-actions .btn,
    .store-detail-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .store-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .store-tabs::-webkit-scrollbar {
        display: none;
    }

    .store-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .section-header {
        flex-direction: column;
        gap: var(--space-3);
    }

    .section-header .btn,
    .section-header .ps-btn {
        width: 100%;
        justify-content: center;
    }

    .payment-methods-table-container {
        overflow-x: auto;
    }

    .payment-methods-table {
        min-width: 600px;
    }

    .danger-action {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .danger-action .btn,
    .danger-action .ps-btn {
        width: 100%;
        justify-content: center;
    }

    .webhook-event {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
    }

    .webhook-event span {
        text-align: left;
    }
}

/* ============================================
   Wallets Page
   ============================================ */

.wallets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-4);
}

.wallets-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-12) var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    gap: var(--space-3);
}

.wallets-empty svg {
    color: var(--text-disabled);
}

.wallets-empty h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.wallets-empty p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
    max-width: 320px;
}

/* Wallet Card */
.wallet-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}

.wallet-card:hover {
    border-color: var(--border-color-strong);
    box-shadow: var(--shadow-md);
}

.wallet-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.wallet-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-primary-light);
    border-radius: var(--border-radius-md);
    color: var(--color-primary);
    flex-shrink: 0;
}

.wallet-card-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.wallet-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    flex: 1;
}

.wallet-card-address {
    background: var(--color-gray-50);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius-md);
}

.wallet-card-address code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.wallet-card-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.wallet-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wallet-card-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.wallet-card-path {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.wallet-card-chains {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.wallet-card-networks {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.wallet-chain-badge {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--color-gray-100);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius-full);
}

.wallet-chain-more {
    color: var(--text-muted);
}

.wallet-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.wallet-card-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.wallet-card-footer svg {
    color: var(--text-muted);
}

/* ============================================
   Wallet Detail Page
   ============================================ */

.wallet-detail-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    width: 100%;
    max-width: 900px;
}

.wallet-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.wallet-detail-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.wallet-detail-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.wallet-detail-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.wallet-detail-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.wallet-detail-id {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--color-gray-100);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
}

.wallet-detail-actions {
    display: flex;
    gap: var(--space-2);
}

/* Wallet Tabs */
.wallet-tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border-color);
}

.wallet-tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.wallet-tab:hover {
    color: var(--text-secondary);
}

.wallet-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.wallet-tab-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* General Tab */
.wallet-tab-general {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-static {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-gray-50);
    border-radius: var(--border-radius-md);
}

.form-static code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    word-break: break-all;
}

.wallet-address-full {
    font-size: var(--text-sm);
}

/* Networks Tab */
.wallet-tab-networks {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.networks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3);
}

.network-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-4);
    transition: all 0.15s ease;
}

.network-card.enabled {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.network-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.network-card-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.network-card-symbol {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    background: var(--color-gray-100);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
}

.network-card.enabled .network-card-symbol {
    background: var(--bg-primary);
}

.network-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.network-card-chain-id {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-gray-300);
    transition: 0.2s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--color-primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* Testnet Row */
.testnet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.testnet-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.testnet-chain-id {
    font-size: var(--text-xs);
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Addresses Tab */
.wallet-tab-addresses {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.addresses-table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.addresses-table {
    width: 100%;
    border-collapse: collapse;
}

.addresses-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--border-color);
}

.addresses-table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-color);
}

.addresses-table tr:last-child td {
    border-bottom: none;
}

.address-row:hover {
    background: var(--color-gray-50);
}

.address-index {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.address-full {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.addresses-info {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-info-light);
    border-radius: var(--border-radius-md);
}

.addresses-info svg {
    flex-shrink: 0;
    color: var(--color-info);
    margin-top: 2px;
}

.addresses-info p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: var(--leading-relaxed);
}

/* Mobile Responsive - Wallets */
@media (max-width: 768px) {
    .wallets-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .wallets-page .page-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .wallets-page .page-actions {
        display: flex;
        gap: var(--space-2);
    }

    .wallets-page .page-actions .btn,
    .wallets-page .page-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .wallets-grid {
        grid-template-columns: 1fr;
    }

    .wallet-card {
        padding: var(--space-4);
    }

    .wallet-detail-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .wallet-detail-header {
        flex-direction: column;
        gap: var(--space-3);
    }

    .wallet-detail-title {
        font-size: var(--text-2xl);
    }

    .wallet-detail-actions {
        width: 100%;
    }

    .wallet-detail-actions .btn,
    .wallet-detail-actions .ps-btn {
        flex: 1;
        justify-content: center;
    }

    .wallet-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .wallet-tabs::-webkit-scrollbar {
        display: none;
    }

    .wallet-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .networks-grid {
        grid-template-columns: 1fr 1fr;
    }

    .addresses-table-container {
        overflow-x: auto;
    }

    .addresses-table {
        min-width: 500px;
    }
}

/* ============================================
   Settings Page
   ============================================ */

.settings-page {
    max-width: 900px;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.settings-tab:hover {
    color: var(--text-secondary);
}

.settings-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.settings-tab-admin {
    color: var(--color-warning);
}

.settings-tab-admin.active {
    color: var(--color-warning);
    border-bottom-color: var(--color-warning);
}

.settings-tab-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.settings-tab-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.settings-tab-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Tab Content Containers */
.settings-tab-account,
.settings-tab-security,
.settings-tab-preferences,
.settings-tab-api-keys,
.settings-tab-notifications,
.settings-admin-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Form Select */
.form-select {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    outline: none;
    transition: all 0.15s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-select:hover {
    border-color: var(--border-color-strong);
}

.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.form-input-mono {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

/* API Keys */
.api-keys-list {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.api-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.api-key-item:last-child {
    border-bottom: none;
}

.api-key-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.api-key-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.api-key-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.api-key-value {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.api-key-created {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.api-key-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.api-key-permissions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.api-key-permissions-label {
    font-weight: 500;
}

.permission-checkboxes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.permission-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.permission-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.permission-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    white-space: nowrap;
    color: var(--text-secondary);
}

/* Settings Info Box */
.settings-info {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-warning-light);
    border-radius: var(--border-radius-md);
}

.settings-info svg {
    flex-shrink: 0;
    color: var(--color-warning);
    margin-top: 2px;
}

.settings-info p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: var(--leading-relaxed);
}

.settings-info p + p {
    margin-top: var(--space-1);
}

/* Notification event x channel matrix */
.notification-matrix {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
}

.notification-matrix th,
.notification-matrix td {
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.notification-matrix thead th {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.notification-matrix thead th:not(:first-child),
.notification-matrix tbody td {
    text-align: center;
    width: 96px;
}

.notification-matrix tbody tr:last-child th,
.notification-matrix tbody tr:last-child td {
    border-bottom: none;
}

.notification-matrix tbody th {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-weight: 400;
}

.notification-option-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.notification-option-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.notification-event-key {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Overflow, not reflow: the matrix loses its meaning if the channel columns
   wrap away from their row. */
@media (max-width: 640px) {
    .notification-matrix {
        display: block;
        overflow-x: auto;
    }
}

/* Admin Tab */
.admin-warning {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--border-radius-md);
}

.admin-warning svg {
    flex-shrink: 0;
    color: var(--color-warning);
    margin-top: 2px;
}

.admin-warning strong {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.admin-warning p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: var(--space-1) 0 0 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-4);
}

.admin-networks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
}

.admin-network-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    transition: all 0.15s ease;
}

.admin-network-item.enabled {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.admin-network-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-network-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.admin-network-chain-id {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.admin-actions {
    display: flex;
    flex-direction: column;
}

.admin-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-color);
}

.admin-action:first-child {
    padding-top: 0;
}

.admin-action:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.admin-action-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.admin-action-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.admin-action-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Mobile Responsive - Settings */
@media (max-width: 768px) {
    .settings-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .settings-page .page-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .admin-networks-grid {
        grid-template-columns: 1fr;
    }

    .api-key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .api-key-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .notification-option {
        flex-direction: row;
        align-items: flex-start;
    }

    .admin-action {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .admin-action .btn,
    .admin-action .ps-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Authentication Pages (ps-auth-*)
   ============================================ */

/* Auth page container - centers the card */
.ps-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--bg-secondary);
}

/* Auth card - main container */
.ps-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8);
}

/* Auth header */
.ps-auth-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.ps-auth-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2);
}

.ps-auth-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0;
}

/* Auth success icon */
.ps-auth-success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-4);
    color: var(--color-success);
}

/* Auth tabs */
.ps-auth-tabs {
    display: flex;
    gap: var(--space-2);
    background: var(--bg-tertiary);
    padding: var(--space-1);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}

.ps-auth-tab {
    flex: 1;
    padding: var(--space-2) var(--space-4);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ps-auth-tab:hover {
    color: var(--text-secondary);
}

.ps-auth-tab-active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Auth content */
.ps-auth-content {
    margin-bottom: var(--space-6);
}

.ps-auth-tab-description {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0 0 var(--space-4);
    text-align: center;
}

/* Auth error */
.ps-auth-error {
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

.ps-auth-error p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-error);
}

/* Auth loading */
.ps-auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Auth footer */
.ps-auth-footer {
    text-align: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.ps-auth-footer p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.ps-auth-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.ps-auth-link:hover {
    text-decoration: underline;
}

/* Spinner animation */
.ps-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: ps-spin 0.8s linear infinite;
}

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

/* Wallet connect button */
.ps-wallet-connect {
    width: 100%;
}

.ps-wallet-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ps-wallet-button:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.ps-wallet-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ps-wallet-connected {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-success-light);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-md);
}

.ps-wallet-address {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.ps-wallet-error {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--color-error-light);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-error);
}

/* Passkey auth form */
.ps-passkey-auth {
    width: 100%;
}

.ps-passkey-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.ps-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.ps-form-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.ps-form-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ps-form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.ps-form-input:disabled {
    background: var(--bg-tertiary);
    color: var(--text-disabled);
    cursor: not-allowed;
}

.ps-passkey-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ps-passkey-button:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.ps-passkey-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ps-passkey-icon {
    width: 20px;
    height: 20px;
}

.ps-passkey-error {
    font-size: var(--font-size-sm);
    color: var(--color-error);
    margin: 0;
}

.ps-passkey-not-available {
    padding: var(--space-4);
    background: var(--color-warning-light);
    border-radius: var(--radius-md);
    text-align: center;
}

/* Recovery setup */
.ps-recovery-setup {
    width: 100%;
}

.ps-recovery-intro {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0 0 var(--space-4);
    text-align: center;
}

.ps-mnemonic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    /* Folded in from a second, later `.ps-mnemonic-grid` block that redefined
       every property above and added these two. Two rules for one selector is
       how a later edit lands in the losing one. */
    max-width: 100%;
    overflow: hidden;
}

.ps-mnemonic-copy {
    display: flex;
    justify-content: flex-end;
    margin-top: calc(var(--space-6) * -1 + var(--space-2));
    margin-bottom: var(--space-6);
}

.ps-mnemonic-word {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.ps-mnemonic-index {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    min-width: 20px;
    /* Right-aligned and tabular, or the words do not line up. The index box has
       a min-width but the number inside it was left-aligned, so with 24 words in
       three columns indices 1-9 fill rows 1-3 and 10-24 fill rows 4-8 - one
       glyph against two - and the flex gap then started each word at a
       different offset. Tabular figures matter on their own: in a proportional
       face even 10 and 11 differ in width. */
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ps-mnemonic-text {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* The confirm step is a plain container, like .ps-recovery-show. It used to
 * carry a copy of the .ps-checkbox-label rule below - display:flex, the warning
 * background, padding, radius - which is that element's styling, not this one's.
 *
 * Applied here it laid the step's four children (title, description, checkbox
 * label, actions) out as four columns, because flex defaults to row. Nothing
 * failed: it compiled, rendered, and was simply wrong. It also drew
 * the warning background twice, one inside the other, invisibly.
 *
 * If this needs layout again, set flex-direction explicitly. */
.ps-recovery-confirm {
    display: block;
}

.ps-recovery-checkbox {
    margin-top: 2px;
}

.ps-recovery-confirm-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.ps-recovery-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.ps-recovery-btn-primary {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ps-recovery-btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.ps-recovery-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ps-recovery-btn-skip {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ps-recovery-btn-skip:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Recovery page specific styles */
.ps-recovery-show,
.ps-recovery-complete {
    text-align: center;
}

.ps-recovery-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2);
}

.ps-recovery-description {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0 0 var(--space-6);
    line-height: 1.5;
}

/* Account id shown beside the recovery phrase for passkey-only accounts.
   Recovery needs an identifier as well as the phrase, and a passkey-only
   account has no email or wallet to fall back on. Styled as a
   sibling of the mnemonic grid so it reads as part of what must be saved,
   not as an aside. */
.ps-recovery-account-id {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    text-align: left;
}

.ps-recovery-account-id-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.ps-recovery-account-id-value {
    font-family: var(--font-mono, monospace);
    font-size: var(--font-size-sm);
    word-break: break-all;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
}

.ps-recovery-account-id-hint {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.ps-recovery-warning {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    text-align: left;
}

.ps-recovery-warning p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.ps-warning-icon {
    flex-shrink: 0;
    color: var(--color-warning);
}

.ps-success-icon {
    color: var(--color-success);
    margin-bottom: var(--space-4);
}

/* Generic button styles */
.ps-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    width: 100%;
}

.ps-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ps-button-primary {
    background: var(--color-primary);
    color: white;
}

.ps-button-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.ps-button-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ps-button-ghost:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Checkbox styles */
.ps-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-warning-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    cursor: pointer;
    text-align: left;
}

.ps-checkbox-label span {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.ps-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

@media (max-width: 400px) {
    .ps-mnemonic-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* WebSocket connection indicator */
.ws-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px 10px;
    border-radius: var(--border-radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: default;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.ws-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ws-indicator-connected {
    background: var(--color-success-light);
    color: var(--color-success);
}

.ws-indicator-connected .ws-indicator-dot {
    background: var(--color-success);
}

.ws-indicator-reconnecting {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.ws-indicator-reconnecting .ws-indicator-dot {
    background: var(--color-warning);
    animation: ws-pulse 1.5s ease-in-out infinite;
}

.ws-indicator-disconnected {
    background: var(--color-gray-100);
    color: var(--color-gray-500);
}

.ws-indicator-disconnected .ws-indicator-dot {
    background: var(--color-gray-400);
}

@keyframes ws-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@media (max-width: 768px) {
    .ws-indicator-label {
        display: none;
    }

    .ws-indicator {
        padding: 4px;
        min-width: 14px;
        justify-content: center;
    }
}

/* Auth card sizing for recovery page */
.ps-auth-card {
    overflow: visible;
    max-height: none;
}

.ps-auth-content {
    overflow: visible;
    width: 100%;
}

/* Ensure recovery content fits within card */
.ps-recovery-show,
.ps-recovery-confirm {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================================
 * Checkout Page (Public)
 * ============================================================================ */

.checkout-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    padding: var(--space-4);
}

.checkout-container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.checkout-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.checkout-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    font-size: var(--text-sm);
}

.checkout-brand {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.checkout-loading {
    padding: var(--space-12) var(--space-5);
    text-align: center;
    color: var(--text-muted);
}

.checkout-error {
    padding: var(--space-10) var(--space-5);
    text-align: center;
}

.checkout-error h2 {
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.checkout-error p {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* Terminal status states */
.checkout-status {
    padding: var(--space-10) var(--space-5);
    text-align: center;
}

.checkout-status-icon {
    font-size: 48px;
    margin-bottom: var(--space-3);
}

.checkout-paid .checkout-status-icon {
    color: var(--color-green-500);
}

.checkout-expired .checkout-status-icon {
    color: var(--color-red-500);
}

.checkout-status h2 {
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.checkout-status .checkout-amount {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.checkout-status-detail {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* Active checkout body */
.checkout-body {
    padding: var(--space-5);
}

.checkout-amount-section {
    text-align: center;
    margin-bottom: var(--space-5);
}

.checkout-amount {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.checkout-status-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.checkout-countdown {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
}

.checkout-countdown-label {
    color: var(--text-muted);
}

.checkout-countdown-time {
    font-weight: 600;
    color: var(--color-orange-500);
    font-variant-numeric: tabular-nums;
}

/* Chain selector */
.checkout-chain-selector {
    margin-bottom: var(--space-5);
}

.checkout-chain-selector label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.checkout-chain-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chain-option {
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chain-option:hover {
    border-color: var(--color-primary);
    color: var(--text-primary);
}

.chain-option.active {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
    color: var(--color-primary);
    font-weight: 600;
}

/* Payment details */
.checkout-payment-details {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.checkout-qr {
    display: flex;
    justify-content: center;
    padding: var(--space-5);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

/* QR picker: one card per encoding, paged with arrows, dots or a swipe */
.checkout-qr-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    touch-action: pan-y;
    outline: none;
}

.checkout-qr-picker:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
    border-radius: var(--border-radius-md);
}

.checkout-qr-track {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.checkout-qr-card {
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.checkout-qr-card-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkout-qr-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checkout-qr-arrow:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.checkout-qr-dots {
    display: flex;
    gap: var(--space-2);
}

.checkout-qr-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: var(--border-radius-full);
    background: var(--border-color-strong);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.checkout-qr-dot-active {
    background: var(--color-primary);
}

.checkout-qr-placeholder {
    text-align: center;
}

.checkout-qr-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: var(--space-3);
}

.checkout-qr-box {
    width: 200px;
    height: 200px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.checkout-qr-addr-short {
    font-family: monospace;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.checkout-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.checkout-detail-row:last-child {
    border-bottom: none;
}

.checkout-detail-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.checkout-detail-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.checkout-address-row {
    padding: var(--space-3) var(--space-4);
}

.checkout-address-row .checkout-detail-label {
    display: block;
    margin-bottom: var(--space-2);
}

.checkout-address-value {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-2) var(--space-3);
}

.checkout-address {
    flex: 1;
    font-size: var(--text-xs);
    word-break: break-all;
    color: var(--text-primary);
}

.checkout-copy-btn {
    flex-shrink: 0;
    padding: var(--space-1) var(--space-2);
    font-family: var(--font-family);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.checkout-copy-btn:hover {
    background: var(--color-primary);
    color: white;
}

/* Wallet connect (EIP-6963) — supplementary to the address/QR above, never a
   replacement, so it only ever adds a section rather than restyling one. */
.checkout-wallet-actions {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-color);
}

.checkout-wallet-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
}

.checkout-wallet-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.checkout-wallet-status {
    margin: var(--space-2) 0 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.checkout-wallet-error {
    color: var(--color-red-500);
}

.checkout-wallet-success {
    color: var(--color-green-500);
}

/* Footer */
.checkout-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-color);
}

.checkout-ws-status {
    font-size: var(--text-xs);
    color: var(--color-green-500);
    font-weight: 500;
}

.checkout-powered {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Mobile responsive */
@media (max-width: 540px) {
    .checkout-page {
        padding: 0;
        align-items: stretch;
    }

    .checkout-container {
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh;
        box-shadow: none;
        border: none;
    }

    .checkout-qr-box {
        width: 180px;
        height: 180px;
    }
}

/* ==========================================================================
   Plugin pages

   A plugin ships a component tree and this client draws it, so these rules
   dress a vocabulary rather than a screen: nothing here knows what any
   particular plugin is for. They reuse the existing .card, .table, .badge
   and .btn rules wherever the vocabulary maps onto something this client
   already has, and only add what it does not.
   ========================================================================== */

.plugin-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.plugin-section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.plugin-stack {
    display: flex;
    gap: var(--space-3);
}

.plugin-stack-column {
    flex-direction: column;
}

.plugin-stack-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

/* Grid column count is set inline: it comes from the plugin, and a class per
   possible count would be a fixed menu of layouts the vocabulary does not
   have. Falls back to a single column on narrow screens regardless. */
.plugin-grid {
    display: grid;
    gap: var(--space-3);
    align-items: center;
}

@media (max-width: 640px) {
    .plugin-grid {
        grid-template-columns: 1fr !important;
    }
}

.plugin-notice {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius);
    font-size: var(--text-sm);
    line-height: 1.5;
    border-left: 3px solid transparent;
}

.plugin-notice-neutral {
    background: var(--color-gray-100);
    color: var(--text-secondary);
    border-left-color: var(--color-gray-400);
}

.plugin-notice-info {
    background: var(--color-info-light);
    color: var(--color-info);
    border-left-color: var(--color-info);
}

.plugin-notice-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-left-color: var(--color-success);
}

.plugin-notice-warning {
    background: var(--color-warning-light);
    color: #9e6c00;
    border-left-color: var(--color-warning);
}

.plugin-notice-danger {
    background: var(--color-error-light);
    color: var(--color-error);
    border-left-color: var(--color-error);
}

/* A summary tile. Deliberately the same box as `.metric-card` on the
   dashboard: a plugin's tiles sit on an operator screen directly beside the
   host's own metric cards, and a tile with no surface and no shadow beside
   four that have both is how a plugin page reads as the odd one out.

   The radius previously came from `--radius-md`, which no :root in this file
   defines, so it fell through to its own hardcoded `8px`. That happens to be
   what `--border-radius-lg` resolves to, so nothing was visibly wrong - which
   is the point worth keeping: a `var()` fallback cannot fail loudly, so a
   token that stops existing is indistinguishable from one that works until
   the day its value and the fallback diverge. */
.plugin-figure {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-5);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xs);
}

.plugin-figure-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
}

.plugin-figure-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Spelled out rather than left to inherit from `.plugin-figure-value`.
   The renderer emits a tone class for every tone including this one, and a
   class with no rule is the one styling mistake nothing reports: the markup
   is valid, the build is green, and the page is simply unstyled. Leaving
   neutral implicit shipped exactly that - the class was emitted and matched
   no rule in this file at all. */
.plugin-figure-neutral .plugin-figure-value {
    color: var(--text-primary);
}

.plugin-figure-info .plugin-figure-value {
    color: var(--color-info);
}

.plugin-figure-success .plugin-figure-value {
    color: var(--color-success);
}

.plugin-figure-warning .plugin-figure-value {
    color: #9e6c00;
}

.plugin-figure-danger .plugin-figure-value {
    color: var(--color-error);
}

.plugin-form,
.plugin-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.plugin-field-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.plugin-tabs {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* A tab's content, stacked. The renderer draws every tab's content at once -
 * switching one is an interaction it cannot tell the plugin about - so these
 * need separating from each other the way sections do. Emitted since the
 * renderer was written and never defined until now. */
.plugin-tab {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.plugin-tab-label {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 var(--space-2);
}

/* A button the plugin gave no link to. Drawn, and visibly unable to act -
   the vocabulary has no actions, so a live-looking control would lie. */
.plugin-section .btn:disabled,
.plugin-tabs .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Plugin pages: prose and label/value pairs.
   These two are why a plugin page can look like the rest of the product at
   all - before them every piece of text had to be a badge, so a detail page
   rendered as rows of coloured pills. */

.plugin-text {
    margin: 0;
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-primary);
}

.plugin-text-muted {
    color: var(--text-muted);
}

.plugin-text-strong {
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.plugin-fields {
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* A row per pair, label left and value right, with a hairline between - the
   same shape the rest of the app uses for detail panels. */
.plugin-field-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

.plugin-field-row:last-child {
    border-bottom: none;
}

.plugin-field-key {
    font-size: var(--text-sm);
    color: var(--text-muted);
    flex: 0 0 auto;
}

.plugin-field-value {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-primary);
    text-align: right;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

/* Stacked on a narrow screen: a long value pushed hard right against its
   label is unreadable well before the row actually overflows. */
@media (max-width: 480px) {
    .plugin-field-row {
        flex-direction: column;
        gap: var(--space-1);
    }

    .plugin-field-value {
        text-align: left;
    }
}

/* Store settings tab */
.store-settings .card {
    margin-bottom: var(--space-5);
}

.store-settings .card-title {
    margin-bottom: var(--space-3);
}

.store-settings .card-subtitle {
    margin: 0 0 var(--space-4);
}

.notification-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.color-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.color-input-row .form-input {
    flex: 1;
}

.color-swatch {
    width: 40px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-primary);
    cursor: pointer;
}

.branding-preview {
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

.policy-table {
    margin: var(--space-3) 0;
}

.policy-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-sm);
}

.policy-row-head {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.policy-add {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
    margin-bottom: var(--space-4);
}

.policy-add > div {
    min-width: 0;
}

/* ============================================
   Error states
   ============================================ */
.error-container,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--color-error);
}

.error-state {
    background: var(--color-error-light);
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
}

.error-icon {
    display: flex;
    color: var(--color-error);
}

.error-message {
    margin: 0;
    max-width: 480px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ============================================
   404 page
   ============================================ */
.evm-not-found {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.evm-not-found-content {
    text-align: center;
    padding: var(--space-8);
}

.evm-not-found-code {
    margin: 0;
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-muted);
}

.evm-not-found-title {
    margin: var(--space-4) 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.evm-not-found-message {
    margin: 0 0 var(--space-6);
    color: var(--text-muted);
}

/* ============================================
   Stores list states
   ============================================ */
.stores-loading,
.stores-empty,
.stores-error {
    text-align: center;
    padding: var(--space-12);
}

.stores-loading {
    color: var(--text-muted);
}

.stores-error {
    color: var(--color-error);
}

.store-card-date {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ============================================
   Admin user table
   ============================================ */
.data-table td {
    vertical-align: middle;
}

.user-row.locked {
    background: var(--color-warning-light);
}

.user-cell {
    white-space: nowrap;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.date-cell {
    white-space: nowrap;
    color: var(--text-muted);
}

.form-input-sm {
    width: auto;
    padding: var(--space-1) var(--space-2);
}

.form-status {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ============================================
   Invoices, payments, wallets, dashboard, EVM
   ============================================ */
/* Cells hold stacked content (id over order id), so centre rather than
   baseline-align against the single-line cells beside them. */
.invoice-row td {
    vertical-align: middle;
}

.invoice-received {
    font-weight: 500;
    color: var(--color-success);
}

.tx-hash-search {
    position: relative;
}

.tx-search-error {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-error);
}

.detail-value-mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    word-break: break-all;
}

/* Flex child of .wallet-card-header: take the remaining width and let a long
   wallet name truncate instead of pushing the card wider. */
.wallet-card-title {
    flex: 1;
    min-width: 0;
}

.wallet-card-title .wallet-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grid item of .charts-section (2fr 1fr): without min-width 0 the chart's
   intrinsic width stretches the 2fr track and squeezes the side card. */
.chart-card-main {
    min-width: 0;
}

.settings-tab-icon {
    flex-shrink: 0;
    margin-right: var(--space-1);
    vertical-align: -2px;
}

.evm-amount-details {
    margin-top: var(--space-1);
}

.evm-chain-info {
    font-size: var(--text-xs);
    color: var(--text-muted);
}
