/* ============================================================================
   COREIDON.AI — Smart Wallet
   Mobile-first design system. Base styles render at 360px with no media
   queries; min-width breakpoints layer enhancements on top.
   Ladder: base | sm 640 | md 768 | lg 1024 | xl 1280.
   ============================================================================ */

/* ----- Theme tokens ----- */
:root {
    /* Brand */
    --c-navy:           #091C3A;
    --c-navy-deep:      #061226;
    --c-ink:            #000000;
    --c-ink-soft:       #2B303B;
    --c-canvas:         #FFFFFF;
    --c-surface:        #F8F5F0;
    --c-border:         #E5E7EB;
    --c-border-strong:  #2B303B;
    --c-cyan:           #0284C7;
    --c-cyan-soft:      rgba(2, 132, 199, 0.10);
    --c-success:        #16A34A;
    --c-success-soft:   rgba(22, 163, 74, 0.10);
    --c-danger:         #DC2626;
    --c-danger-soft:    rgba(220, 38, 38, 0.10);

    /* Semantic roles (light) */
    --bg-canvas:        var(--c-canvas);
    --bg-surface:       var(--c-surface);
    --bg-elevated:      var(--c-canvas);
    --bg-muted:         #F4F1EC;
    --bg-overlay:       rgba(9, 28, 58, 0.45);

    --fg-primary:       var(--c-ink);
    --fg-secondary:     var(--c-ink-soft);
    --fg-muted:         #6B7280;
    --fg-on-accent:     #FFFFFF;

    --border-subtle:    var(--c-border);
    --border-strong:    var(--c-ink-soft);
    --border-divider:   #EDEAE4;

    --accent:           var(--c-navy);
    --accent-hover:     #0D2851;
    --expressive:       var(--c-cyan);
    --expressive-soft:  var(--c-cyan-soft);
    --focus-ring:       rgba(2, 132, 199, 0.45);

    --semantic-success:        var(--c-success);
    --semantic-success-soft:   var(--c-success-soft);
    --semantic-danger:         var(--c-danger);
    --semantic-danger-soft:    var(--c-danger-soft);

    /* Typography */
    --font-heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* Fluid type scale */
    --fs-xs:    0.75rem;
    --fs-sm:    0.8125rem;
    --fs-base:  0.9375rem;
    --fs-md:    1rem;
    --fs-lg:    clamp(1.0625rem, 0.9rem + 0.5vw, 1.25rem);
    --fs-xl:    clamp(1.25rem, 1rem + 1vw, 1.5rem);
    --fs-2xl:   clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    --fs-3xl:   clamp(1.875rem, 1.4rem + 2vw, 2.5rem);
    --fs-display: clamp(2.25rem, 1.6rem + 3vw, 3.25rem);

    /* Spacing scale */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;

    /* Radii */
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 8px;
    --r-pill: 999px;

    /* Layout */
    --shell-max: 1280px;
    --gutter-x: var(--sp-4);
    --header-h: 56px;

    /* Effects */
    --shadow-pop: 0 12px 32px rgba(9, 28, 58, 0.12);
    --transition-fast: 120ms ease-out;
    --transition-med:  180ms ease-out;
}

[data-theme="dark"] {
    --bg-canvas:        #0A1220;
    --bg-surface:       #121B2A;
    --bg-elevated:      #243447;
    --bg-muted:         #1F2A3C;
    --bg-overlay:       rgba(4, 10, 22, 0.65);

    --fg-primary:       #FFFFFF;
    --fg-secondary:     rgba(248, 245, 240, 0.75);
    --fg-muted:         rgba(248, 245, 240, 0.45);
    --fg-on-accent:     #FFFFFF;

    --border-subtle:    #2D3D52;
    --border-strong:    #2B303B;
    --border-divider:   #1F2A3C;

    --accent:           #38BDF8;
    --accent-hover:     #7DD3FC;
    --expressive:       #38BDF8;
    --expressive-soft:  rgba(56, 189, 248, 0.12);
    --focus-ring:       rgba(56, 189, 248, 0.5);

    --semantic-success:        #34D399;
    --semantic-success-soft:   rgba(52, 211, 153, 0.12);
    --semantic-danger:         #FB7185;
    --semantic-danger-soft:    rgba(251, 113, 133, 0.14);

    --shadow-pop: 0 12px 36px rgba(0, 0, 0, 0.55);
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
}
[data-theme="dark"] html { color-scheme: dark; }

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.55;
    color: var(--fg-primary);
    background: var(--bg-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    transition: background var(--transition-med), color var(--transition-med);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--fg-primary);
    margin: 0;
    line-height: 1.15;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p { margin: 0 0 var(--sp-3) 0; }

a {
    color: var(--expressive);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}
a:hover { border-bottom-color: var(--expressive); }

:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection { background: var(--expressive-soft); color: var(--fg-primary); }

/* ----- Loading / empty / error ----- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: var(--sp-3);
    color: var(--fg-secondary);
    font-family: var(--font-body);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--expressive);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.error {
    margin: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    background: var(--semantic-danger-soft);
    border: 1px solid var(--semantic-danger);
    border-radius: var(--r-md);
    color: var(--semantic-danger);
    font-weight: 500;
}

/* ============================================================================
   App shell
   ============================================================================ */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-canvas);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-canvas);
    border-block-end: 1px solid var(--border-subtle);
    backdrop-filter: saturate(180%) blur(6px);
}

.app-header__inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding-inline: var(--gutter-x);
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--fg-primary);
    text-decoration: none;
    border: 0;
}
.brand__mark {
    width: 28px;
    height: 28px;
    display: inline-block;
}
.brand__mark svg { display: block; width: 100%; height: 100%; }
.brand__wordmark {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 0.875rem;
    color: var(--fg-primary);
    white-space: nowrap;
}
.brand__wordmark .dot { color: var(--expressive); }
.brand__sublabel {
    display: none;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--fs-xs);
    color: var(--fg-muted);
    padding-inline-start: var(--sp-3);
    margin-inline-start: var(--sp-3);
    border-inline-start: 1px solid var(--border-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* Theme toggle — 44x44 tap target */
.theme-toggle {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    color: var(--fg-secondary);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.theme-toggle:hover {
    border-color: var(--expressive);
    color: var(--expressive);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Content container */
.app-main {
    flex: 1;
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: var(--sp-5) var(--gutter-x) var(--sp-10);
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

/* Title row above tabs */
.page-title {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}
.page-title__kicker {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fg-muted);
}
.page-title h1 { font-size: var(--fs-2xl); }

/* ----- Tabs (horizontally scrollable on mobile) ----- */
.tabs {
    display: flex;
    gap: var(--sp-1);
    border-block-end: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-block-end: var(--sp-2);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    padding: var(--sp-3) var(--sp-4);
    min-height: 44px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--fg-secondary);
    cursor: pointer;
    border-block-end: 2px solid transparent;
    margin-block-end: -1px;
    white-space: nowrap;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab:hover { color: var(--fg-primary); }
.tab.active {
    color: var(--fg-primary);
    border-block-end-color: var(--expressive);
}

/* ----- Cards ----- */
.card {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}
[data-theme="dark"] .card { background: var(--bg-surface); }
.card--surface { background: var(--bg-surface); }
[data-theme="dark"] .card--surface { background: var(--bg-surface); }
.card__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}
.card__title h2, .card__title h3 { margin: 0; }

/* Balance card */
.balance-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-5);
}
.balance-main { display: flex; flex-direction: column; gap: var(--sp-1); }
.balance-main .label {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fg-muted);
    font-weight: 500;
}
.balance-main .value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--fs-display);
    color: var(--fg-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}
.balance-main .value .unit {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--fg-muted);
    margin-inline-start: var(--sp-2);
    letter-spacing: 0;
}
.balance-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--fg-secondary);
}
.balance-meta strong { color: var(--fg-primary); font-weight: 600; }

/* ----- Badges ----- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    font-family: var(--font-body);
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge.post_bill {
    color: var(--fg-secondary);
    background: var(--bg-muted);
    border-color: var(--border-subtle);
}
.badge.credit_enforced {
    color: var(--expressive);
    background: var(--expressive-soft);
    border-color: transparent;
}
.badge.success { color: var(--semantic-success); background: var(--semantic-success-soft); }
.badge.danger  { color: var(--semantic-danger);  background: var(--semantic-danger-soft); }
/* Pricing-mode badges so the active mode reads at a glance in the wallet
   header and usage table. Neutral palette — neither mode is "bad". */
.badge.pricing-markup {
    color: var(--fg-secondary);
    background: var(--bg-muted);
    border-color: var(--border-subtle);
}
.badge.pricing-fixed {
    color: var(--expressive);
    background: var(--expressive-soft);
    border-color: transparent;
}

/* Radio-pill row used in the Settings card and Pricing-override modal to
   pick the pricing_mode. Each .radio-pill is a <label> that wraps a native
   radio + the readable text so the entire pill is clickable.
   IMPORTANT: bare `label { display:block; text-transform:uppercase;
   font-size:--fs-xs; letter-spacing:0.08em; margin-bottom:--sp-2;
   color:--fg-secondary }` upstream in this file inherits into every label,
   so every one of those properties has to be explicitly re-set here or
   the pill renders as a stretched-out uppercase header with the radio
   dot floating off to the right. The .form-row.check label rule below
   does the same trick for checkbox labels — keep these two in sync. */
.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-1);
}
.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, border-color 0.12s ease;
    /* Reset the inherited bare-label styles so the pill reads as a button,
       not a section heading. */
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    color: var(--fg-primary);
    font-size: var(--fs-sm);
    font-weight: 500;
}
.radio-pill:hover { background: var(--bg-muted); }
.radio-pill input[type="radio"] {
    /* The native radio's default block sizing can squash the flex layout;
       force a fixed footprint so the pill stays a consistent height
       across browsers. */
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--expressive);
}
.radio-pill:has(input[type="radio"]:checked) {
    background: var(--expressive-soft);
    border-color: var(--expressive);
    color: var(--expressive);
    font-weight: 600;
}

/* ----- Grids ----- */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-4);
}
.kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3) var(--sp-4);
}
.kv > div .k {
    color: var(--fg-muted);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}
.kv > div .v {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--fs-lg);
    color: var(--fg-primary);
    margin-top: 2px;
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    background: var(--accent);
    color: var(--fg-on-accent);
    border: 1px solid var(--accent);
    padding: 0 var(--sp-5);
    height: 44px;
    border-radius: var(--r-md);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--fs-sm);
    letter-spacing: 0.02em;
    cursor: pointer;
    width: 100%;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
[data-theme="dark"] .btn { color: #0A1220; }
[data-theme="dark"] .btn:hover { color: #0A1220; }

.btn.secondary {
    background: transparent;
    color: var(--fg-primary);
    border-color: var(--border-subtle);
}
.btn.secondary:hover {
    background: transparent;
    border-color: var(--expressive);
    color: var(--expressive);
    transform: translateY(-1px);
}
[data-theme="dark"] .btn.secondary { color: var(--fg-primary); }
[data-theme="dark"] .btn.secondary:hover { color: var(--expressive); }

.btn.danger {
    background: var(--semantic-danger);
    border-color: var(--semantic-danger);
    color: #FFFFFF;
}
.btn.danger:hover { filter: brightness(0.92); }

.btn.ghost {
    background: transparent;
    color: var(--fg-secondary);
    border-color: transparent;
}
.btn.ghost:hover { color: var(--expressive); border-color: var(--expressive); }

.btn.is-sm { height: 36px; padding-inline: var(--sp-4); font-size: var(--fs-xs); }

.btn-row {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

/* ----- Forms ----- */
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-canvas);
    color: var(--fg-primary);
    padding: 0 var(--sp-3);
    height: 44px;
    border-radius: var(--r-md);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: var(--bg-muted); }
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--expressive);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
label {
    display: block;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--fs-xs);
    color: var(--fg-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--sp-2);
}
.form-row { display: flex; flex-direction: column; gap: 0; margin-bottom: var(--sp-4); }
.form-row.inline { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }
.form-row.check { flex-direction: row; align-items: center; gap: var(--sp-2); }
.form-row.check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--expressive);
}
.form-row.check label {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    color: var(--fg-primary);
    font-weight: 500;
    font-size: var(--fs-sm);
}
.form-hint {
    margin-top: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--fg-muted);
    line-height: 1.5;
}

/* ----- Tables ----- */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    min-width: 480px;
}
thead th {
    text-align: start;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-surface);
    color: var(--fg-muted);
    font-weight: 600;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-block-end: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1;
}
[data-theme="dark"] thead th { background: var(--bg-muted); }
tbody td {
    padding: var(--sp-3) var(--sp-4);
    border-block-end: 1px solid var(--border-divider);
    color: var(--fg-primary);
    vertical-align: middle;
}
tbody tr:last-child td { border-block-end: 0; }
tbody tr.clickable { cursor: pointer; transition: background var(--transition-fast); }
tbody tr.clickable:hover td { background: var(--expressive-soft); }
td .muted-inline { color: var(--fg-muted); font-size: var(--fs-xs); margin-inline-start: var(--sp-1); }

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    color: var(--fg-primary);
}
[data-theme="dark"] code { background: var(--bg-muted); }

/* ----- Banners ----- */
.banner {
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--r-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--fg-primary);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
}
.banner strong { color: var(--fg-primary); font-weight: 700; }
.banner.danger {
    background: var(--semantic-danger-soft);
    border-color: var(--semantic-danger);
    color: var(--semantic-danger);
}
.banner.danger strong { color: var(--semantic-danger); }
.banner.warning {
    background: var(--expressive-soft);
    border-color: var(--expressive);
    color: var(--expressive);
}

/* ----- Modal ----- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 0;
    animation: fade-in var(--transition-med);
}
.modal {
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: var(--sp-5);
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    box-shadow: var(--shadow-pop);
    animation: slide-up var(--transition-med);
}
[data-theme="dark"] .modal { background: var(--bg-surface); }
.modal h2 { font-size: var(--fs-xl); }
.modal-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ----- Charts ----- */
.chart-wrap {
    position: relative;
    width: 100%;
    height: clamp(200px, 40vw, 320px);
}

/* ----- Utility ----- */
.muted { color: var(--fg-muted); }
.right { text-align: end; }
.num   { font-variant-numeric: tabular-nums; font-family: var(--font-body); }
.empty-state {
    padding: var(--sp-6);
    text-align: center;
    color: var(--fg-muted);
    font-size: var(--fs-sm);
}

/* Mobile mini-summary above tables */
.list-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}

/* ============================================================================
   Breakpoints — progressive enhancement
   ============================================================================ */

/* sm: 640px — inline buttons, larger gutters */
@media (min-width: 40rem) {
    :root { --gutter-x: var(--sp-6); }

    .btn { width: auto; }
    .btn-row { flex-direction: row; flex-wrap: wrap; }
    .modal-actions { flex-direction: row; justify-content: flex-end; gap: var(--sp-3); }
    .modal {
        max-width: 480px;
        border-radius: var(--r-lg);
        align-self: center;
    }
    .modal-backdrop { align-items: center; padding: var(--sp-4); }
    .form-row.inline { grid-template-columns: 1fr 1fr; }
    .list-summary { grid-template-columns: repeat(4, 1fr); }
}

/* md: 768px — multi-column grids appear here */
@media (min-width: 48rem) {
    :root { --header-h: 64px; }

    .app-main { padding-block: var(--sp-8) var(--sp-12); gap: var(--sp-6); }
    .brand__sublabel { display: inline-flex; align-items: center; }
    .grid { grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
    .balance-card {
        grid-template-columns: 1.4fr 1fr;
        align-items: start;
    }
    .balance-meta {
        grid-template-columns: 1fr;
        text-align: end;
        gap: var(--sp-3);
    }
    .kv { grid-template-columns: repeat(3, 1fr); }
}

/* lg: 1024px — more generous spacing */
@media (min-width: 64rem) {
    .card { padding: var(--sp-6); }
    .kv { grid-template-columns: repeat(4, 1fr); }
}

/* xl: 1280px — full shell width */
@media (min-width: 80rem) {
    :root { --gutter-x: var(--sp-8); }
}

/* Honor reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
