/*
 * SVA Base Styles — Shared Design System
 *
 * Common styles inherited by all SVA apps (client, wallet, etc.).
 * Each app loads this first, then its own stylesheet which overrides
 * --color-primary, --color-primary-dark, --color-primary-light, and
 * --shadow-ring to set the app's accent colour.
 *
 * Mobile-first. Progressive enhancement via min-width breakpoints.
 */

/* ===================================================================
   0. SELF-HOSTED GOOGLE FONTS
   =================================================================== */

@font-face {
    font-family: 'sva-logo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/sva-logo.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/roboto-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/roboto-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('fonts/material-symbols-outlined.woff2') format('woff2');
}
@font-face {
    font-family: 'bootstrap-icons';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('fonts/bootstrap-icons.woff2') format('woff2');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
    /* Prevent Android WebView from showing ligature text alongside glyph */
    overflow: hidden;
    width: 1em;
    vertical-align: middle;
}

/* Bootstrap Icons — used on iOS as Material Symbol replacement */
.bi {
    font-family: 'bootstrap-icons' !important;
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   1. DESIGN TOKENS (shared across all apps)
   =================================================================== */

:root {
    /* Neutral palette — identical in every app */
    --color-bg: #f0f4f8;
    --color-surface: #ffffff;
    --color-success: #0d7a3e;
    --color-success-light: #e6f5ed;
    --color-success-dark: #0a6232;
    --color-warning: #c27803;
    --color-warning-light: #fef3e0;
    --color-warning-dark: #a86702;
    --color-danger: #c0392b;
    --color-danger-light: #fde8e5;
    --color-danger-dark: #a93125;
    --color-info: #2b7ab8;
    --color-info-light: #d6eaf5;
    --color-info-dark: #1f5f8f;
    --color-text: #1a1a2e;
    --color-text-secondary: #4a5568;
    --color-text-muted: #8492a6;
    --color-border: #e2e8f0;

    /* Secondary/neutral button palette */
    --color-secondary: #5a6577;
    --color-secondary-dark: #475163;
    --color-secondary-light: #e8eaed;
    --color-disabled: #ccc;
    --color-disabled-text: var(--color-text-muted);

    /* Layout constants */
    --header-height: 56px;
    --tab-bar-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);

    /* Spacing scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Radius scale */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 22px;
    --radius-pill: 100px;

    /* Shadow scale */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.10);
    --shadow-sheet: 0 -4px 24px rgba(0, 0, 0, 0.15);

    /* Typography — legacy size scale (kept for compatibility) */
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-lg: 17px;
    --font-size-xl: 20px;
    --font-size-2xl: 28px;

    /* M3 Typography — semantic type roles (Material Design 3) */
    --md-display-large:  57px;
    --md-display-medium: 45px;
    --md-display-small:  36px;
    --md-headline-large: 32px;
    --md-headline-medium: 28px;
    --md-headline-small: 24px;
    --md-title-large:    22px;
    --md-title-medium:   16px;
    --md-title-small:    14px;
    --md-body-large:     16px;
    --md-body-medium:    14px;
    --md-body-small:     12px;
    --md-label-large:    14px;
    --md-label-medium:   12px;
    --md-label-small:    11px;

    /* Typography stacks */
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;

    /* Interactive feedback — press transforms */
    --btn-press-scale: 0.97;
    --fab-press-scale: 0.92;
    --card-press-scale: 0.98;

    /* M3 Tonal surface palette */
    --color-surface-dim:             #d9dde3;
    --color-surface-bright:          #f8fafc;
    --color-surface-container-lowest:#ffffff;
    --color-surface-container-low:   #f2f5f9;
    --color-surface-container:       #eceff4;
    --color-surface-container-high:  #e6eaf0;
    --color-surface-container-highest:#dfe4eb;
    --color-on-surface:              var(--color-text);
    --color-on-surface-variant:      var(--color-text-secondary);
    --color-outline:                 var(--color-border);
    --color-outline-variant:         #c4cad4;

    /* M3 Elevation (5 levels) */
    --shadow-level0: none;
    --shadow-level1: 0 1px 2px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.1);
    --shadow-level2: 0 1px 2px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.1);
    --shadow-level3: 0 1px 3px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.12);
    --shadow-level4: 0 2px 3px rgba(0,0,0,0.1), 0 6px 10px rgba(0,0,0,0.14);
    --shadow-level5: 0 4px 4px rgba(0,0,0,0.12), 0 8px 12px rgba(0,0,0,0.16);

    /* M3 Motion — easing curves */
    --md-ease-standard:    cubic-bezier(0.2, 0, 0, 1);
    --md-ease-standard-decel: cubic-bezier(0, 0, 0, 1);
    --md-ease-standard-accel: cubic-bezier(0.3, 0, 1, 1);
    --md-ease-emphasized:  cubic-bezier(0.2, 0, 0, 1);
    --md-ease-emphasized-decel: cubic-bezier(0.05, 0.7, 0.1, 1);
    --md-ease-emphasized-accel: cubic-bezier(0.3, 0, 0.8, 0.15);

    /* M3 Motion — durations */
    --md-duration-short1:  50ms;
    --md-duration-short2:  100ms;
    --md-duration-short3:  150ms;
    --md-duration-short4:  200ms;
    --md-duration-medium1: 250ms;
    --md-duration-medium2: 300ms;
    --md-duration-medium3: 350ms;
    --md-duration-medium4: 400ms;
    --md-duration-long1:   450ms;
    --md-duration-long2:   500ms;
}

/* ===================================================================
   2. RESET & BASE
   =================================================================== */

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

* {
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-on-surface, var(--color-text));
    font-size: var(--md-body-large, var(--font-size-base));
    line-height: 1.5;
    letter-spacing: 0.5px;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--color-on-surface, var(--color-text));
    line-height: 1.3;
}

h1 { font-size: var(--md-title-large, 22px); font-weight: 400; }
h2 { font-size: var(--md-title-medium, 18px); font-weight: 500; letter-spacing: 0.15px; }
h3 { font-size: var(--md-title-small, 16px); font-weight: 500; letter-spacing: 0.1px; }

/* ===================================================================
   3. APP SHELL — .sva-header, .sva-content, .sva-tab-bar
   =================================================================== */

.sva-header {
    position: sticky;
    top: 0;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
    background: var(--color-surface-container, var(--color-surface));
    border-bottom: 1px solid var(--color-outline, var(--color-border));
    z-index: 100;
}

.header-title {
    font-weight: 400;
    font-size: var(--md-title-large, 18px);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-logo {
    font-family: 'sva-logo', sans-serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    color: var(--color-primary);
}

.sva-content {
    padding-top: 12px;
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
    padding-left: 12px;
    padding-right: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: calc(100vh - var(--header-height) - var(--safe-top));
}

.sva-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tab-bar-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    background: var(--color-surface-container, var(--color-surface));
    border-top: none;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

/* ===================================================================
   4. TAB BAR ITEMS
   =================================================================== */

.tab-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    position: relative;
    transition: color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.tab-bar-item:active {
    opacity: 0.7;
}

.tab-bar-item.active {
    color: var(--color-primary);
}

/* M3 active indicator pill (behind the icon) */
.tab-bar-item.active .tab-bar-icon {
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    border-radius: var(--radius-pill);
    padding: 2px 16px;
    margin-left: -8px;
    margin-right: -8px;
    transition: background var(--md-duration-short3, 0.15s) var(--md-ease-standard, ease);
}

.tab-bar-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

.tab-bar-icon svg {
    width: 22px;
    height: 22px;
}

.tab-bar-icon .material-symbols-outlined {
    font-size: 22px;
}

.tab-bar-label {
    font-size: var(--md-label-small, 10px);
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.tab-bar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===================================================================
   4b. HEADER EXTRAS (shared by all apps)
   =================================================================== */

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-icon {
    font-size: 22px;
    color: var(--color-primary);
}

.header-account {
    font-size: 13px;
    color: var(--color-text-muted);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===================================================================
   4c. BALANCE DISPLAY (shared by bank + wallet)
   =================================================================== */

.balance-display {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
    padding: 16px 0 4px;
}

.balance-label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

/* ===================================================================
   4d. TRANSACTION LIST (shared by bank + wallet)
   =================================================================== */

.tx-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tx-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.tx-amount {
    font-weight: 600;
}

.tx-amount.positive {
    color: var(--color-success);
}

.tx-amount.negative {
    color: var(--color-danger);
}

.tx-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ===================================================================
   4e. ACCOUNT SELECTOR (shared by all apps)
   =================================================================== */

.account-selector {
    margin-bottom: 16px;
}

.account-selector select {
    font-size: 15px;
    padding: 12px;
}

/* ===================================================================
   4f. INLINE FORM (shared pattern)
   =================================================================== */

.inline-form {
    display: flex;
    gap: 8px;
    align-items: end;
}

.inline-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* ===================================================================
   5. CARDS
   =================================================================== */

.card {
    background: var(--color-surface-container-low, var(--color-surface));
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-level1, var(--shadow-sm));
}

/* ===================================================================
   6. TAB CONTENT
   =================================================================== */

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabFadeIn var(--md-duration-short3, 0.15s) var(--md-ease-emphasized-decel, ease-out);
}

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   7. BUTTONS
   =================================================================== */

button {
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    cursor: pointer;
    min-height: 44px;
    transition: background var(--md-duration-short3, 0.15s) var(--md-ease-standard, ease),
                transform var(--md-duration-short2, 0.1s) var(--md-ease-standard, ease);
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

/* M3 state layer on all buttons */
button {
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    opacity: 0;
    transition: opacity var(--md-duration-short2, 100ms) var(--md-ease-standard, ease);
    pointer-events: none;
}

button:hover::before {
    opacity: 0.08;
}

button:active::before {
    opacity: 0.12;
}

button:hover {
    background: var(--color-primary-dark);
}

button:active {
    transform: scale(var(--btn-press-scale));
}

button:disabled::before {
    display: none;
}

button:disabled {
    background: var(--color-disabled);
    color: var(--color-disabled-text);
    cursor: not-allowed;
    transform: none;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    min-height: 44px;
    transition: background 0.15s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

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

.btn-secondary:hover {
    background: var(--color-secondary);
    color: #ffffff;
}

.btn-secondary:active {
    transform: scale(var(--btn-press-scale));
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: var(--color-danger-dark);
}

.btn-danger:active {
    transform: scale(var(--btn-press-scale));
}

.btn-warning {
    background: var(--color-warning);
    color: var(--color-text);
}

.btn-warning:hover {
    background: var(--color-warning-dark);
}

.btn-warning:active {
    transform: scale(var(--btn-press-scale));
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
}

.btn-success:hover {
    background: var(--color-success-dark);
}

.btn-success:active {
    transform: scale(var(--btn-press-scale));
}

.btn-info {
    background: var(--color-info);
    color: #ffffff;
}

.btn-info:hover {
    background: var(--color-info-dark);
}

.btn-info:active {
    transform: scale(var(--btn-press-scale));
}

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline-primary:hover {
    background: var(--color-primary-light);
}

.btn-outline-danger {
    background: transparent;
    border: 1.5px solid var(--color-danger);
    color: var(--color-danger);
}

.btn-outline-danger:hover {
    background: var(--color-danger-light);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Button with icon + text */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-icon .material-symbols-outlined {
    font-size: 18px;
}

/* ===================================================================
   8. FORM ELEMENTS
   =================================================================== */

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-outline, var(--color-border));
    border-radius: var(--radius-sm);
    font-size: var(--md-body-large, 16px); /* prevents iOS zoom on focus */
    font-family: inherit;
    color: var(--color-on-surface, var(--color-text));
    background: var(--color-surface);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--md-duration-short3, 0.15s) var(--md-ease-standard, ease);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    border-width: 2px;
    padding: 11px;
    box-shadow: none;
}

label {
    display: block;
    font-size: var(--md-body-small, 13px);
    color: var(--color-on-surface-variant, var(--color-text-secondary));
    margin-bottom: 4px;
    font-weight: 500;
    letter-spacing: 0.4px;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group {
    margin-bottom: 14px;
}

.label-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 2px;
}

.label-row label {
    margin-bottom: 0;
}

/* ===================================================================
   9. STATUS MESSAGES
   =================================================================== */

.status-msg {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: var(--md-body-medium, 14px);
    font-weight: 450;
    letter-spacing: 0.15px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    animation: status-msg-enter 0.3s var(--md-ease-emphasized-decel);
}
.status-msg.hidden {
    animation: none;
}

.status-msg.error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-left-color: var(--color-danger);
}

.status-msg.success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-left-color: var(--color-success);
}

.status-msg.info {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border-left-color: var(--color-primary);
}

/* Status message inline icon — Material Symbols via CSS content.
   Suppressed when JS already added a custom icon (data-has-icon).
   overflow:hidden + fixed width prevent ligature text from showing
   on Android WebViews where the font loads asynchronously. */
.status-msg.error:not([data-has-icon])::before,
.status-msg.success:not([data-has-icon])::before,
.status-msg.info:not([data-has-icon])::before {
    font-family: 'Material Symbols Outlined';
    font-size: 18px;
    vertical-align: -3px;
    margin-right: 6px;
    font-weight: normal;
    font-style: normal;
    display: inline-block;
    width: 18px;
    overflow: hidden;
}
.status-msg.error::before   { content: 'error'; }
/* success icon handled by JS (successCheckHtml SVG) — no CSS fallback
   to avoid Android WebView rendering ligature text alongside glyph */
.status-msg.info::before    { content: 'info'; }

@keyframes status-msg-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   10. BADGES
   =================================================================== */

.badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* ===================================================================
   11. TOOLTIP STYLES
   =================================================================== */

.info-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px;
    margin-left: 2px;
    margin-top: 0;
    min-height: auto;
    border-radius: 50%;
    vertical-align: middle;
    transition: color 0.15s ease, background 0.15s ease;
    line-height: 1;
}

.info-tooltip-trigger:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
    transform: none;
}

.info-tooltip-trigger:active {
    transform: none;
}

.css-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.css-tooltip-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    min-width: 200px;
    padding: var(--space-lg);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--color-text);
    z-index: 10001;
    pointer-events: none;
    white-space: normal;
}

.css-tooltip-text strong {
    color: var(--color-text);
    font-weight: 600;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.css-tooltip:hover .css-tooltip-text,
.css-tooltip:focus-within .css-tooltip-text {
    display: block;
    animation: tooltipFadeIn 0.15s ease-out;
}

/* Touch devices: tap-to-show tooltip (JS adds .tooltip-open class) */
.css-tooltip.tooltip-open .css-tooltip-text {
    display: block;
    pointer-events: auto;
    animation: tooltipFadeIn 0.15s ease-out;
}

/* On coarse (touch) pointers, suppress hover-triggered tooltips */
@media (pointer: coarse) {
    .css-tooltip:hover .css-tooltip-text {
        display: none;
    }
    .css-tooltip.tooltip-open .css-tooltip-text {
        display: block;
    }
}

/* ===================================================================
   12. WIZARD MODAL
   =================================================================== */

.wizard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
}

.wizard-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    padding-left: 8px;
    padding-right: 8px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.wizard-header-back,
.wizard-header-close,
.wizard-header-skip {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    margin: 0;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    border-radius: var(--radius-md);
}

.wizard-header-back:hover,
.wizard-header-close:hover,
.wizard-header-skip:hover {
    background: var(--color-bg);
    transform: none;
}

.wizard-header-back:active,
.wizard-header-close:active {
    transform: scale(var(--btn-press-scale));
}

.wizard-header-skip {
    font-size: 14px;
    color: var(--color-primary);
}

.wizard-header-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    flex-shrink: 0;
}

.wizard-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background 0.2s ease;
}

.wizard-dot-active {
    background: var(--color-primary);
}

.wizard-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 24px;
}

.wizard-concept {
    background: var(--color-primary-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.wizard-concept-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.wizard-concept-heading {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.wizard-concept-body {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.wizard-step-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 16px;
}

.wizard-step-content {
    font-size: 14px;
    color: var(--color-text);
    line-height: 1.6;
}

.wizard-step-content label {
    display: block;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.wizard-step-content input,
.wizard-step-content select {
    margin-bottom: 16px;
}

.wizard-status {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
}

.wizard-status-info {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.wizard-status-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.wizard-status-error {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.wizard-status-progress {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.wizard-back-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 12px 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    min-height: 44px;
    margin: 0;
}

.wizard-back-btn:hover {
    background: var(--color-bg);
    transform: none;
}

.wizard-next-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    min-height: 44px;
    margin: 0;
}

.wizard-next-btn:hover {
    background: var(--color-primary-dark);
    transform: none;
}

.wizard-next-btn:disabled {
    background: var(--color-disabled);
    color: var(--color-disabled-text);
    cursor: not-allowed;
}

/* Wizard radio/option list */
.wizard-option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.wizard-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.wizard-option:active {
    transform: scale(var(--card-press-scale));
}

.wizard-option.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.wizard-option-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.wizard-option.selected .wizard-option-radio {
    border-color: var(--color-primary);
}

.wizard-option.selected .wizard-option-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
}

.wizard-option-text {
    flex: 1;
}

.wizard-option-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
}

.wizard-option-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* Wizard spinner for async steps */
.wizard-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.wizard-spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: wizardSpin 0.8s linear infinite;
}

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

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

.wizard-spinner-text {
    margin-top: 16px;
    font-size: 15px;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Wizard success screen */
.wizard-success {
    text-align: center;
    padding: 24px 0;
}

.wizard-success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.wizard-success-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.wizard-success-detail {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.wizard-success-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 280px;
    margin: 0 auto;
}

.wizard-success-actions button {
    width: 100%;
    margin: 0;
}

.wizard-success-actions button.secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

/* Wizard OTC code display */
.wizard-otc-display {
    font-family: var(--font-mono);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    text-align: center;
    letter-spacing: 6px;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-primary-light);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    color: var(--color-primary);
}

/* Wizard OTC input */
.wizard-otc-input {
    font-family: var(--font-mono);
    font-size: var(--font-size-xl);
    letter-spacing: 4px;
    text-align: center;
}

/* Wizard info card */
.wizard-info-card {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* Wizard warning card */
.wizard-warning-card {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.wizard-warning-card strong {
    color: var(--color-text);
}

/* Wizard monospace ID display */
.wizard-mono-id {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* Wizard hint text */
.wizard-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: calc(-1 * var(--space-sm));
}

/* Wizard responsive — compact on short viewports */
@media (max-height: 700px) {
    .wizard-concept {
        padding: var(--space-md);
        margin-bottom: var(--space-lg);
    }

    .wizard-concept-heading {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-xs);
    }

    .wizard-concept-body {
        font-size: var(--font-size-sm);
    }

    .wizard-step-title {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-md);
    }

    .wizard-spinner {
        padding: var(--space-xl) 0;
    }

    .wizard-success {
        padding: var(--space-lg) 0;
    }

    .wizard-success-icon {
        font-size: 48px;
        margin-bottom: var(--space-md);
    }

    .wizard-success-title {
        font-size: var(--font-size-xl);
    }

    .wizard-otc-display {
        font-size: var(--font-size-xl);
        letter-spacing: 4px;
        padding: var(--space-sm) var(--space-md);
    }
}

/* Wizard responsive — centered card on wide screens */
@media (min-width: 768px) {
    .wizard-overlay {
        background: rgba(0, 0, 0, 0.5);
        align-items: center;
        justify-content: center;
    }
    .wizard-card {
        background: var(--color-bg);
        max-width: 560px;
        width: 100%;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-level5);
        max-height: 90vh;
        overflow: hidden;
        flex: none;
    }
    .wizard-card > .wizard-header {
        padding-top: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .wizard-card > .wizard-footer {
        padding-bottom: 12px;
        border-radius: 0 0 12px 12px;
    }
    .wizard-card > .wizard-body {
        overflow-y: auto;
    }
}

/* Wizard container (hosts the overlay, hidden until shown) */
#wizardContainer {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
}

/* ===================================================================
   13. UTILITY CLASSES
   =================================================================== */

.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

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

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

.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

.btn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}

.btn-row .btn-block {
    flex: 1;
    margin-top: 0;
}

/* ===================================================================
   13b. M3 TYPOGRAPHY UTILITY CLASSES
   =================================================================== */

.md-display-large  { font-size: var(--md-display-large);  font-weight: 400; line-height: 1.12; letter-spacing: -0.25px; }
.md-display-medium { font-size: var(--md-display-medium); font-weight: 400; line-height: 1.16; }
.md-display-small  { font-size: var(--md-display-small);  font-weight: 400; line-height: 1.22; }
.md-headline-large { font-size: var(--md-headline-large); font-weight: 400; line-height: 1.25; }
.md-headline-medium{ font-size: var(--md-headline-medium);font-weight: 400; line-height: 1.29; }
.md-headline-small { font-size: var(--md-headline-small); font-weight: 400; line-height: 1.33; }
.md-title-large    { font-size: var(--md-title-large);    font-weight: 400; line-height: 1.27; }
.md-title-medium   { font-size: var(--md-title-medium);   font-weight: 500; line-height: 1.5;  letter-spacing: 0.15px; }
.md-title-small    { font-size: var(--md-title-small);    font-weight: 500; line-height: 1.43; letter-spacing: 0.1px; }
.md-body-large     { font-size: var(--md-body-large);     font-weight: 400; line-height: 1.5;  letter-spacing: 0.5px; }
.md-body-medium    { font-size: var(--md-body-medium);    font-weight: 400; line-height: 1.43; letter-spacing: 0.25px; }
.md-body-small     { font-size: var(--md-body-small);     font-weight: 400; line-height: 1.33; letter-spacing: 0.4px; }
.md-label-large    { font-size: var(--md-label-large);    font-weight: 500; line-height: 1.43; letter-spacing: 0.1px; }
.md-label-medium   { font-size: var(--md-label-medium);   font-weight: 500; line-height: 1.33; letter-spacing: 0.5px; }
.md-label-small    { font-size: var(--md-label-small);    font-weight: 500; line-height: 1.45; letter-spacing: 0.5px; }

/* ===================================================================
   13c. M3 BUTTON VARIANTS (Text + Filled-Tonal)
   =================================================================== */

.btn-text {
    background: transparent;
    color: var(--color-primary);
    border: none;
    padding: 10px 12px;
    font-size: var(--md-label-large);
    font-weight: 500;
    letter-spacing: 0.1px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    min-height: 40px;
    transition: background var(--md-duration-short3) var(--md-ease-standard);
}

.btn-text:hover {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    transform: none;
}

.btn-text:active {
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    transform: none;
}

.btn-tonal {
    background: var(--color-surface-container-high, var(--color-secondary-light));
    color: var(--color-on-surface, var(--color-text));
    border: none;
    padding: 10px 24px;
    font-size: var(--md-label-large);
    font-weight: 500;
    letter-spacing: 0.1px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    min-height: 40px;
    transition: background var(--md-duration-short3) var(--md-ease-standard),
                box-shadow var(--md-duration-short3) var(--md-ease-standard);
}

.btn-tonal:hover {
    box-shadow: var(--shadow-level1);
    transform: none;
}

.btn-tonal:active {
    box-shadow: none;
    transform: none;
}

/* ===================================================================
   13d. M3 RIPPLE EFFECT
   =================================================================== */

.md-ripple {
    position: relative;
    overflow: hidden;
}

.md-ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
        var(--color-on-surface, #000) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--md-duration-short3) var(--md-ease-standard);
    pointer-events: none;
}

.md-ripple:active::after {
    opacity: 0.12;
}

/* State layer — 8% on hover, 12% on press (M3 spec) */
.md-state-layer {
    position: relative;
}

.md-state-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    opacity: 0;
    transition: opacity var(--md-duration-short2) var(--md-ease-standard);
    pointer-events: none;
}

.md-state-layer:hover::before {
    opacity: 0.08;
}

.md-state-layer:active::before {
    opacity: 0.12;
}

.md-state-layer:focus-visible::before {
    opacity: 0.12;
}

/* ===================================================================
   13e. M3 FLOATING LABELS (animated input labels)
   =================================================================== */

.md-field {
    position: relative;
    margin-bottom: 16px;
}

.md-field input,
.md-field select,
.md-field textarea {
    padding: 20px 12px 8px;
    font-size: var(--md-body-large);
    border: 1px solid var(--color-outline, var(--color-border));
    border-radius: var(--radius-sm);
    background: var(--color-surface-container-highest, var(--color-surface));
    color: var(--color-on-surface, var(--color-text));
    transition: border-color var(--md-duration-short3) var(--md-ease-standard);
    width: 100%;
}

.md-field input:focus,
.md-field select:focus,
.md-field textarea:focus {
    border-color: var(--color-primary);
    border-width: 2px;
    padding: 19px 11px 7px;
    outline: none;
}

.md-field label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--md-body-large);
    color: var(--color-on-surface-variant, var(--color-text-secondary));
    pointer-events: none;
    transition: all var(--md-duration-short4) var(--md-ease-standard);
    transform-origin: left top;
    margin-bottom: 0;
}

.md-field textarea ~ label {
    top: 20px;
}

.md-field input:focus ~ label,
.md-field input:not(:placeholder-shown) ~ label,
.md-field select:focus ~ label,
.md-field select:not([value=""]) ~ label,
.md-field textarea:focus ~ label,
.md-field textarea:not(:placeholder-shown) ~ label {
    top: 6px;
    transform: translateY(0);
    font-size: var(--md-body-small);
    color: var(--color-primary);
}

/* ===================================================================
   14. HELP MODAL
   =================================================================== */

.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
}

.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    padding-left: var(--space-lg);
    padding-right: var(--space-sm);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.help-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.help-header-close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    margin: 0;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
}

.help-header-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
    transform: none;
}

/* Help search bar */
.help-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px var(--space-lg);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.help-search-icon {
    font-size: 20px;
    color: var(--color-text-muted);
}
.help-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--color-text);
    outline: none;
    padding: 6px 0;
    min-height: auto;
}
.help-search-input::placeholder {
    color: var(--color-text-muted);
}

.help-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-md) var(--space-lg);
}

.help-section {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.help-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--space-lg);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.help-section-title:active {
    background: var(--color-bg);
}

.help-chevron {
    font-size: 12px;
    color: var(--color-text-muted);
    transition: transform 0.2s ease;
}

.help-section.open .help-chevron {
    transform: rotate(180deg);
}

.help-section-content {
    padding: 0 var(--space-lg) var(--space-lg);
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

.help-section-content p {
    margin: 0 0 8px;
}

.help-section-content ul,
.help-section-content ol {
    margin: 0 0 8px;
    padding-left: 20px;
}

.help-section-content li {
    margin-bottom: 4px;
}

/* ===================================================================
   15. BACK ARROW BUTTON
   =================================================================== */

.back-arrow-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    margin: 0;
    min-height: 44px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    border-radius: var(--radius-md);
}

.back-arrow-btn:hover {
    background: var(--color-bg);
    transform: none;
}

/* ===================================================================
   16. HELP BUTTON (header)
   =================================================================== */

.help-btn {
    background: transparent;
    border: 1.5px solid var(--color-text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    border-radius: 50%;
}

.help-btn:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    border-color: var(--color-primary);
    transform: none;
}

/* ===================================================================
   17. BTN-SM (small button variant)
   =================================================================== */

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    min-height: 32px;
}

/* ===================================================================
   18. PRIVATE DNS INFO BANNER
   =================================================================== */

.sva-dns-info {
    margin: 8px 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    font-size: 13px;
    overflow: hidden;
}

.sva-dns-info-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.sva-dns-info-header:hover {
    background: var(--color-secondary-light);
}

.sva-dns-info-icon {
    font-size: 14px;
    line-height: 1;
}

.sva-dns-info-title {
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}

.sva-dns-info-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.sva-dns-info-chevron {
    font-size: 10px;
    color: var(--color-text-muted);
    transition: transform 0.15s;
}

.sva-dns-info-body {
    padding: 0 12px 10px;
}

.sva-dns-info-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}

.sva-dns-info-table th {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sva-dns-info-table td {
    padding: 4px 8px;
    color: var(--color-text);
}

.sva-dns-info-table tbody tr:hover {
    background: var(--color-secondary-light);
}

/* ===================================================================
   19. COLORBLIND-FRIENDLY MODE
   =================================================================== */

html.colorblind {
    --color-success: #2563EB;
    --color-success-light: #dbeafe;
    --color-success-dark: #1d4ed8;
    --color-warning: #D97706;
    --color-warning-light: #fef3c7;
    --color-warning-dark: #b45309;
    --color-danger: #DB2777;
    --color-danger-light: #fce7f3;
    --color-danger-dark: #be185d;
}

/* ===================================================================
   20. ATTESTATION BROWSER MODAL
   =================================================================== */

.attest-browser-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
}

.attest-browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.attest-browser-header-title {
    font-weight: 600;
    font-size: 16px;
}

.attest-browser-header-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--color-text);
    line-height: 1;
}

.attest-browser-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.attest-browser-graph {
    flex: 1;
    min-height: 60vh;
    border: 1px solid var(--color-border);
    margin-bottom: 8px;
}

.attest-browser-legend {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.attest-browser-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.attest-browser-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* --- Attestation Replay Controls --- */

.attest-replay-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    background: var(--color-bg);
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.attest-replay-transport {
    display: flex;
    gap: 4px;
}

.attest-replay-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
    transition: background 0.1s;
}

.attest-replay-btn:hover {
    background: var(--color-surface);
}

.attest-replay-btn:active {
    background: var(--color-border);
}

.attest-replay-btn .material-symbols-outlined {
    font-size: 20px;
}

.attest-replay-speed {
    display: flex;
    gap: 4px;
}

.attest-replay-speed-btn {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    background: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background 0.1s, color 0.1s;
}

.attest-replay-speed-btn:hover {
    background: var(--color-surface);
}

.attest-replay-speed-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.attest-replay-scrubber {
    flex: 1;
    min-width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 2px;
    outline: none;
}

.attest-replay-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.attest-replay-scrubber::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.attest-replay-counter {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.attest-replay-exit {
    margin-left: auto;
}

/* ===================================================================
   21. REDUCED MOTION
   =================================================================== */

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

/* ===================================================================
   22. CONFIRM MODAL (shared destructive-action confirmation)
   =================================================================== */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: tabFadeIn 0.12s ease-out;
}

.confirm-card {
    background: var(--color-surface-container-high, var(--color-surface));
    border-radius: var(--radius-xl, var(--radius-lg));
    padding: var(--space-xl);
    max-width: 380px;
    width: 90%;
    box-shadow: var(--shadow-level3, var(--shadow-lg));
}

.confirm-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.confirm-title .material-symbols-outlined {
    font-size: 22px;
}

.confirm-title.danger .material-symbols-outlined {
    color: var(--color-danger);
}

.confirm-body {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-lg);
}

.confirm-summary {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-sm);
}

.confirm-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.confirm-summary-label {
    color: var(--color-text-muted);
}

.confirm-summary-value {
    font-weight: 600;
    color: var(--color-text);
}

.confirm-actions {
    display: flex;
    gap: var(--space-sm);
}

.confirm-actions button {
    flex: 1;
    margin: 0;
}

/* ===================================================================
   23. DARK MODE
   Activated by OS preference OR manual toggle (data-theme attribute).
   Manual toggle wins over OS preference when set.
   =================================================================== */

/* Dark tokens — shared by both auto-detect and manual toggle */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --color-bg: #121218;
        --color-surface: #1e1e2a;
        --color-text: #f0f0f8;
        --color-text-secondary: #c8ccdd;
        --color-text-muted: #9ea4b8;
        --color-border: #2e3040;

        --color-secondary: #8490a5;
        --color-secondary-dark: #6b7790;
        --color-secondary-light: #2a2e3e;
        --color-disabled: #444;
        --color-disabled-text: #6b7080;

        --color-success: #2ecc71;
        --color-success-light: #1a3328;
        --color-success-dark: #27ae60;
        --color-warning: #e8a317;
        --color-warning-light: #33291a;
        --color-warning-dark: #d4950f;
        --color-danger: #e74c3c;
        --color-danger-light: #331a1a;
        --color-danger-dark: #c0392b;
        --color-info: #3498db;
        --color-info-light: #1a2833;
        --color-info-dark: #2980b9;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);

        /* M3 dark tonal surfaces */
        --color-surface-dim:             #0e0e14;
        --color-surface-bright:          #38384a;
        --color-surface-container-lowest:#0b0b10;
        --color-surface-container-low:   #1a1a26;
        --color-surface-container:       #1e1e2a;
        --color-surface-container-high:  #282838;
        --color-surface-container-highest:#333346;
        --color-outline-variant:         #444560;

        /* M3 dark elevation */
        --shadow-level1: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
        --shadow-level2: 0 1px 3px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
        --shadow-level3: 0 1px 3px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.4);
        --shadow-level4: 0 2px 4px rgba(0,0,0,0.5), 0 6px 10px rgba(0,0,0,0.4);
        --shadow-level5: 0 4px 6px rgba(0,0,0,0.5), 0 8px 12px rgba(0,0,0,0.5);

        color-scheme: dark;
    }
}

/* Manual dark toggle — same tokens, applied when user explicitly selects dark */
html[data-theme="dark"] {
    --color-bg: #121218;
    --color-surface: #1e1e2a;
    --color-text: #f0f0f8;
    --color-text-secondary: #c8ccdd;
    --color-text-muted: #9ea4b8;
    --color-border: #2e3040;

    --color-secondary: #8490a5;
    --color-secondary-dark: #6b7790;
    --color-secondary-light: #2a2e3e;
    --color-disabled: #444;
    --color-disabled-text: #6b7080;

    --color-success: #2ecc71;
    --color-success-light: #1a3328;
    --color-success-dark: #27ae60;
    --color-warning: #e8a317;
    --color-warning-light: #33291a;
    --color-warning-dark: #d4950f;
    --color-danger: #e74c3c;
    --color-danger-light: #331a1a;
    --color-danger-dark: #c0392b;
    --color-info: #3498db;
    --color-info-light: #1a2833;
    --color-info-dark: #2980b9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);

    /* M3 dark tonal surfaces */
    --color-surface-dim:             #0e0e14;
    --color-surface-bright:          #38384a;
    --color-surface-container-lowest:#0b0b10;
    --color-surface-container-low:   #1a1a26;
    --color-surface-container:       #1e1e2a;
    --color-surface-container-high:  #282838;
    --color-surface-container-highest:#333346;
    --color-outline-variant:         #444560;

    /* M3 dark elevation */
    --shadow-level1: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
    --shadow-level2: 0 1px 3px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
    --shadow-level3: 0 1px 3px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.4);
    --shadow-level4: 0 2px 4px rgba(0,0,0,0.5), 0 6px 10px rgba(0,0,0,0.4);
    --shadow-level5: 0 4px 6px rgba(0,0,0,0.5), 0 8px 12px rgba(0,0,0,0.5);

    color-scheme: dark;
}

/* Colorblind + dark: override status colors in dark mode too */
html.colorblind[data-theme="dark"],
html.colorblind:not([data-theme="light"]) {
    --color-success: #60a5fa;
    --color-success-light: #1a2640;
    --color-success-dark: #3b82f6;
    --color-warning: #f59e0b;
    --color-warning-light: #33291a;
    --color-warning-dark: #d97706;
    --color-danger: #f472b6;
    --color-danger-light: #331a2a;
    --color-danger-dark: #ec4899;
}

/* ===================================================================
   24. SKELETON LOADING PLACEHOLDERS
   =================================================================== */

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

.skeleton {
    background: linear-gradient(90deg,
        var(--color-bg, #f0f0f0) 25%,
        var(--color-surface, #e0e0e0) 50%,
        var(--color-bg, #f0f0f0) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: var(--radius-sm);
}
.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-xs);
}
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.skeleton-card {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}
.skeleton-card .skeleton-line:last-child { margin-bottom: 0; }

/* ===================================================================
   25. SUCCESS ANIMATION
   =================================================================== */

@keyframes successCheckDraw {
    0% { stroke-dashoffset: 36; }
    100% { stroke-dashoffset: 0; }
}

@keyframes successPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.success-check-anim {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: successPulse 0.5s ease-out;
}

.success-check-anim svg {
    width: 48px;
    height: 48px;
}

.success-check-anim .check-circle {
    fill: var(--color-success);
}

.success-check-anim .check-mark {
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: successCheckDraw 0.4s 0.2s ease-out forwards;
}

/* ===================================================================
   26. LIST ITEM STAGGER ANIMATION
   =================================================================== */

@keyframes listItemFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
    animation: listItemFadeIn var(--md-duration-medium1, 0.25s) var(--md-ease-emphasized-decel, ease-out) both;
}

/* ===================================================================
   27. CARD TRANSITIONS
   =================================================================== */

.card-enter {
    animation: cardSlideIn var(--md-duration-medium1, 0.25s) var(--md-ease-emphasized-decel, ease-out);
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   28. BOTTOM SHEET
   =================================================================== */

.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 2000;
    transition: background 0.25s ease;
    pointer-events: none;
}

.bottom-sheet-backdrop.active {
    background: rgba(0,0,0,0.4);
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2001;
    background: var(--color-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-sheet);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--md-duration-medium2, 0.3s) var(--md-ease-emphasized-decel, cubic-bezier(0.22, 1, 0.36, 1));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    will-change: transform;
    touch-action: none;
}

.bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    cursor: grab;
    flex-shrink: 0;
}

.bottom-sheet-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-border);
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px 12px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.bottom-sheet-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.bottom-sheet-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 20px;
    line-height: 1;
}

.bottom-sheet-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Tablet+: constrained width, centered */
@media (min-width: 768px) {
    .bottom-sheet {
        left: 50%;
        right: auto;
        transform: translate(-50%, 100%);
        width: 480px;
        max-height: 70vh;
        border-radius: var(--radius-xl);
        bottom: 24px;
    }
    .bottom-sheet.open {
        transform: translate(-50%, 0);
    }
}

/* ===================================================================
   29. TABLET TWO-COLUMN LAYOUT
   =================================================================== */

.tablet-split {
    display: flex;
    flex-direction: column;
}

.tablet-split-list {
    flex: 1;
    min-width: 0;
}

.tablet-split-detail {
    flex: 1;
    min-width: 0;
    display: none;
}

.tablet-split-detail.has-content {
    display: block;
}

@media (min-width: 768px) {
    .tablet-split {
        flex-direction: row;
        gap: 16px;
    }

    .tablet-split-list {
        flex: 0 0 340px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    .tablet-split-detail {
        display: block;
        flex: 1;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    .tablet-split-detail:empty::after,
    .tablet-split-detail:not(.has-content)::after {
        content: 'Select an item to view details';
        display: flex;
        align-items: center;
        justify-content: center;
        height: 200px;
        color: var(--color-text-muted);
        font-size: 14px;
    }
}

@media (min-width: 1024px) {
    .tablet-split-list {
        flex: 0 0 400px;
    }
}

/* ===================================================================
   30. PULL-TO-REFRESH
   =================================================================== */

.pull-to-refresh-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 0;
    overflow: hidden;
    transition: height 0.2s ease;
    color: var(--color-text-muted);
    font-size: 13px;
    gap: 8px;
}

.pull-to-refresh-indicator.pulling {
    height: 48px;
}

.pull-to-refresh-indicator.refreshing {
    height: 48px;
}

.pull-to-refresh-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: ptrSpin 0.6s linear infinite;
}

.pull-to-refresh-arrow {
    transition: transform 0.2s ease;
    font-size: 18px;
}

.pull-to-refresh-arrow.flipped {
    transform: rotate(180deg);
}

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

/* ===================================================================
   31. COACH MARKS
   =================================================================== */

.coach-mark-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: auto;
}

.coach-mark-spotlight {
    position: fixed;
    z-index: 3001;
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.6); /* nosemantic: ios_shadow — fullscreen dimming overlay, not a real shadow */
    pointer-events: none;
    transition: all 0.3s ease;
}

.coach-mark-tooltip {
    position: fixed;
    z-index: 3002;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 280px;
    box-shadow: var(--shadow-lg);
    animation: coachFadeIn 0.25s ease-out;
}

.coach-mark-tooltip h4 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.coach-mark-tooltip p {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

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

.coach-mark-dots {
    display: flex;
    gap: 5px;
}

.coach-mark-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-border);
}

.coach-mark-dot.active {
    background: var(--color-primary);
}

.coach-mark-actions {
    display: flex;
    gap: 8px;
}

.coach-mark-skip {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

.coach-mark-next {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 14px;
}

@keyframes coachFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   32. M3 SNACKBAR (fixed-position feedback)
   =================================================================== */

.md-snackbar {
    position: fixed;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 8px);
    left: 16px;
    right: 16px;
    z-index: 5000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface-container-highest, #333);
    color: var(--color-surface-container-lowest, #fff);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-level3);
    font-size: var(--md-body-medium);
    letter-spacing: 0.25px;
    transform: translateY(calc(100% + 16px));
    opacity: 0;
    transition: transform var(--md-duration-medium2) var(--md-ease-emphasized-decel),
                opacity var(--md-duration-short4) var(--md-ease-standard);
    pointer-events: none;
}

.md-snackbar.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.md-snackbar-text {
    flex: 1;
    line-height: 1.4;
}

.md-snackbar-action {
    background: none;
    border: none;
    color: var(--color-primary-light, var(--color-primary));
    font-size: var(--md-label-large);
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    padding: 4px 8px;
    margin: 0;
    min-height: auto;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.md-snackbar-action:hover {
    background: rgba(255,255,255,0.08);
    transform: none;
}

.md-snackbar-close {
    background: none;
    border: none;
    color: var(--color-surface-container-lowest, #fff);
    opacity: 0.7;
    cursor: pointer;
    padding: 4px;
    margin: 0;
    min-height: auto;
    font-size: 18px;
    line-height: 1;
}

.md-snackbar-close:hover {
    opacity: 1;
    transform: none;
}

/* Leading icon for semantic variants */
.md-snackbar-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Snackbar semantic variants ── */
.md-snackbar--error {
    background: #d32f2f;
    color: #fff;
}
.md-snackbar--error .md-snackbar-action {
    color: #ffcdd2;
}

.md-snackbar--success {
    background: #2e7d32;
    color: #fff;
}
.md-snackbar--success .md-snackbar-action {
    color: #c8e6c9;
}

.md-snackbar--warning {
    background: #e65100;
    color: #fff;
}
.md-snackbar--warning .md-snackbar-action {
    color: #ffe0b2;
}

/* Tablet+: snackbar max width and center/left */
@media (min-width: 768px) {
    .md-snackbar {
        left: 24px;
        right: auto;
        min-width: 320px;
        max-width: 480px;
    }
}

/* ===================================================================
   33. M3 NAVIGATION INDICATOR (animated pill)
   =================================================================== */

.tab-bar {
    position: relative;
}

.tab-bar-indicator {
    position: absolute;
    bottom: 0;
    height: 3px;
    background: var(--color-primary);
    border-radius: 3px 3px 0 0;
    transition: left var(--md-duration-medium1) var(--md-ease-emphasized),
                width var(--md-duration-medium1) var(--md-ease-emphasized);
    will-change: left, width;
}

/* ===================================================================
   NOTIFICATION BELL — Material Design 3 bell icon + dropdown panel
   Used in platform header and all app headers (bank, ticket, wallet).
   =================================================================== */

/* Bell button — 40x40 touch target, Material M3 icon button */
.notif-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    color: var(--color-on-surface-variant, var(--color-text-secondary));
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.notif-bell-btn:hover {
    background: var(--color-surface-container-highest, rgba(0,0,0,0.06));
    color: var(--color-on-surface, var(--color-text));
}
.notif-bell-btn:active {
    background: var(--color-surface-container-highest, rgba(0,0,0,0.1));
}
.notif-bell-active {
    background: var(--color-surface-container-highest, rgba(0,0,0,0.08));
    color: var(--color-primary);
}

/* Bell icon */
.notif-bell-icon {
    font-size: 24px;
    line-height: 1;
    transition: transform 0.15s ease;
}
.notif-bell-active .notif-bell-icon {
    font-variation-settings: 'FILL' 1;
}

/* Ring animation on new notification */
@keyframes bellRing {
    0%   { transform: rotate(0deg); }
    10%  { transform: rotate(14deg); }
    20%  { transform: rotate(-14deg); }
    30%  { transform: rotate(10deg); }
    40%  { transform: rotate(-10deg); }
    50%  { transform: rotate(6deg); }
    60%  { transform: rotate(-4deg); }
    70%  { transform: rotate(2deg); }
    80%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}
.notif-bell-ring {
    animation: bellRing 0.6s ease-out;
}

/* Badge — M3 small badge (dot when no text, pill when count) */
.notif-bell-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--color-danger, #c0392b);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
    animation: badgePop 0.3s var(--md-ease-emphasized-decel, cubic-bezier(0.05, 0.7, 0.1, 1));
}
@keyframes badgePop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Dropdown panel — positioned absolutely via JS */
.notif-bell-panel {
    position: fixed;
    z-index: 200;
    width: min(360px, calc(100vw - 24px));
    max-height: min(480px, 70vh);
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-outline, var(--color-border));
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-level3, 0 4px 16px rgba(0,0,0,0.12));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Entry animation */
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.2s var(--md-ease-emphasized-decel, ease),
                transform 0.2s var(--md-ease-emphasized-decel, ease);
}
.notif-bell-panel-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Panel header */
.notif-bell-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--color-outline-variant, var(--color-border));
}
.notif-bell-panel-title {
    font-size: var(--md-title-small, 14px);
    font-weight: 500;
    color: var(--color-on-surface, var(--color-text));
    letter-spacing: 0.1px;
}
.notif-bell-clear-btn {
    border: none;
    background: none;
    font-size: var(--md-label-medium, 12px);
    font-weight: 500;
    color: var(--color-primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 6px);
    transition: background 0.12s ease;
}
.notif-bell-clear-btn:hover {
    background: var(--color-surface-container-highest, rgba(0,0,0,0.06));
}

/* Notification list inside panel */
.notif-bell-list {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0;
}

/* Cards inside the dropdown use the same .notif-card styles from styles.css,
   but with tighter padding for the panel context */
.notif-bell-panel .notif-card {
    border-radius: 0;
    border-left: none;
    border-bottom: 1px solid var(--color-outline-variant, var(--color-border));
    padding: 10px 16px;
    animation: none;
}
.notif-bell-panel .notif-card:last-child {
    border-bottom: none;
}

/* Empty state */
.notif-bell-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--color-text-muted);
    font-size: var(--md-body-medium, 14px);
}
.notif-bell-empty-icon {
    font-size: 40px;
    opacity: 0.4;
}

/* Segment Control */
.segment-control {
    display: flex;
    gap: 0;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 2px;
    margin-bottom: 12px;
}

.segment-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
    margin: 0;
}

.segment-btn:hover {
    background: transparent;
}

.segment-btn:active {
    transform: none;
}

.segment-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
