:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1a1d23;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --muted: #6b7280;
    --border: #e5e7eb;
    --border-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #fef2f2;
    --success: #059669;
    --success-soft: #ecfdf5;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.28);
    --focus-ring-danger: 0 0 0 3px rgba(220, 38, 38, 0.22);
    --page-gutter: 0.85rem;
    --app-topbar-height: 0px;
    --app-header-height: 0px;
    --app-mobile-menu-offset: 0px;
    --app-sidebar-width: 15.5rem;
    --app-sidebar-width-collapsed: 4.35rem;
    --fx-nav-accent: #7c3aed;
    --fx-nav-accent-hover: #6d28d9;
    --fx-nav-orb-shadow: 0 8px 22px rgba(124, 58, 237, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
    --settings-nav-label: #7534df;
    --surface-raised: #ffffff;
    --surface-muted: #f8fafc;
    --input-bg: #ffffff;
    --input-border: #e5e7eb;
    --table-header-bg: #f8fafc;
    --deal-band-bg: #f8fafc;
    --deal-band-alt: #eff6ff;
    --deal-band-hover: #f1f5f9;
    --deal-band-alt-hover: #dbeafe;
    --overlay: rgba(15, 23, 42, 0.45);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-raised: #243044;
    --surface-muted: #1a2332;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #cbd5e1;
    --muted: #94a3b8;
    --border: #334155;
    --border-strong: #475569;
    --input-bg: #1e293b;
    --input-border: #475569;
    --table-header-bg: #1a2332;
    --primary-soft: #1e3a5f;
    --danger-soft: #450a0a;
    --success-soft: #064e3b;
    --deal-band-bg: #1a2332;
    --deal-band-alt: #1e3a5f;
    --deal-band-hover: #243044;
    --deal-band-alt-hover: #234060;
    --overlay: rgba(2, 6, 23, 0.72);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    /* Brand violet (slightly brighter than light mode for dark surfaces) */
    --settings-nav-label: #8b5cf6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-icon {
    display: block;
    flex-shrink: 0;
    opacity: 0.88;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
    align-items: center;
    gap: 0.65rem 1.25rem;
    padding: 0.5rem var(--page-gutter);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    position: relative;
    z-index: 1;
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    padding: 0.2rem 0.15rem 0.2rem 0;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}
.topbar-brand:hover {
    color: var(--primary);
}
.topbar-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.45rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}
.topbar-brand-version {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.88em;
}

.topbar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
    padding: 0.15rem;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.85);
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar {
    display: none;
}

.topbar-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.topbar-nav-link .nav-icon {
    width: 15px;
    height: 15px;
}
.topbar-nav-link:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.92);
}
.topbar-nav-link.is-active {
    color: var(--primary);
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12), inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}
.topbar-nav-link.is-active .nav-icon {
    opacity: 1;
}

/* FX wizard — raised orb inside the nav pill (reference: center tab treatment) */
.topbar--has-fx-wizard {
    overflow: visible;
    padding-bottom: 1.4rem;
}

.topbar-nav--has-fx {
    overflow: visible;
    align-items: center;
    padding: 0.35rem 0.55rem 0.55rem;
    background: #ffffff;
    box-shadow: var(--fx-nav-orb-shadow);
    border-color: rgba(226, 232, 240, 0.65);
}

.topbar-nav-fx {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.32rem;
    margin: 0.15rem 1rem -1.4rem;
    padding: 0 0.15rem 0;
    text-decoration: none;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.topbar-nav-fx__label {
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
    color: #9ca3af;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.topbar-nav-fx:hover .topbar-nav-fx__label,
.topbar-nav-fx.is-active .topbar-nav-fx__label {
    color: var(--fx-nav-accent);
}

.topbar-nav-fx__orb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.75rem;
    height: 2.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--fx-nav-accent) 0%, var(--fx-nav-accent-hover) 100%);
    border: 1px solid rgba(109, 40, 217, 0.45);
    box-shadow: var(--fx-nav-orb-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.topbar-nav-fx:hover .topbar-nav-fx__orb,
.topbar-nav-fx:focus-visible .topbar-nav-fx__orb,
.topbar-nav-fx.is-active .topbar-nav-fx__orb {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #8b5cf6 0%, var(--fx-nav-accent) 100%);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.32), 0 4px 10px rgba(15, 23, 42, 0.1);
}

.topbar-nav-fx__orb .nav-icon {
    width: 1.35rem;
    height: 1.35rem;
    color: #ffffff;
    opacity: 1;
    stroke-width: 2.25;
}

.topbar-nav-fx.is-active .topbar-nav-fx__orb {
    border-color: rgba(91, 33, 182, 0.55);
}

.topbar-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    font-size: 0.85rem;
    min-width: 0;
}

.topbar-divider {
    width: 1px;
    height: 1.65rem;
    background: var(--border);
    flex-shrink: 0;
}

.topbar-control {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.2rem 0.45rem 0.2rem 0.35rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topbar-control:hover {
    border-color: var(--border-strong);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}
.topbar-control:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.topbar-control-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    flex-shrink: 0;
}
.topbar-control-icon .nav-icon {
    width: 14px;
    height: 14px;
}
.topbar-control-icon--globe {
    color: var(--primary);
}

.topbar-control-select {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.22rem 1.35rem 0.22rem 0.1rem;
    cursor: pointer;
    min-width: 0;
    max-width: 9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.1rem center;
    background-size: 12px;
}
.topbar-control-select:focus {
    outline: none;
}

.company-switcher-select {
    min-width: 7.5rem;
    max-width: 11rem;
}

/* Segmented language toggle — matches marketing mk-lang on light topbar */
.topbar-lang {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.1875rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.topbar-lang__form {
    display: contents;
}
.topbar-lang__btn {
    padding: 0.3125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.topbar-lang__btn:hover {
    color: var(--text);
}
.topbar-lang__btn.is-active {
    color: var(--text);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
.topbar-lang__btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.topbar-company-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 11rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.topbar-company-badge .nav-icon {
    width: 13px;
    height: 13px;
    color: var(--muted);
}
.topbar-company-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.2rem 0.55rem 0.2rem 0.2rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.topbar-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.topbar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}
.topbar-user-name {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text);
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-user-role {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.topbar-logout-form {
    display: inline;
    margin: 0;
}
.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.38rem 0.62rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.topbar-logout-btn .nav-icon {
    width: 15px;
    height: 15px;
}
.topbar-logout-btn:hover {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(220, 38, 38, 0.12);
}

.login-language-form {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.25rem 0.5rem 0.25rem 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.login-language-form .topbar-control-icon--globe {
    display: inline-flex;
}
.login-language-select {
    appearance: none;
    border: 0;
    background: transparent;
    min-width: 8.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.3rem 1.4rem 0.3rem 0.15rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.15rem center;
    background-size: 12px;
}
.login-language-select:focus {
    outline: none;
}

.settings-labels-table-wrap {
    overflow-x: auto;
}
.settings-labels-table code {
    font-size: 0.8rem;
    color: var(--muted);
}
@media (max-width: 1080px) {
    .company-switcher-select {
        min-width: 6.5rem;
        max-width: 8.5rem;
    }
}

/* Topbar drawer mode — hide brand text on narrow phones; drawer nav below 1181px */
@media (max-width: 639px) {
    .topbar-brand-text {
        display: none;
    }
    .topbar-brand-version {
        display: none;
    }
}
.badge-role {
    background: #ecfdf5;
    color: #047857;
}

.badge {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.container {
    max-width: 2560px;
    margin: 1.25rem auto;
    padding: 0 var(--page-gutter);
}
@media (min-width: 1536px) {
    .container,
    .container--full,
    .container--wide,
    .container--settings {
        max-width: 2560px;
    }
}
.container--wide { max-width: 2560px; }
.container--narrow { max-width: 32rem; }

.error-page {
    margin: 3.5rem auto 2rem;
    padding: 2rem 1.5rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.error-page-code {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.error-page h1 {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
}
.error-page-lead {
    margin: 0 auto 1.25rem;
    max-width: 26rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--muted);
}
.error-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.container--full {
    max-width: 2560px;
    width: 100%;
    margin: 0.65rem auto;
    padding: 0 var(--page-gutter);
}

/* List pages — maximize table area */
.list-page .page-header {
    margin-bottom: 0.65rem;
    align-items: center;
}
.list-page .page-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0;
}
.list-page .page-header .subtitle {
    margin-bottom: 0;
    font-size: 0.85rem;
}
.list-page .filter-bar {
    margin-bottom: 0.5rem;
}
.list-page .filter-bar .form-input {
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
    min-width: 120px;
}
.table-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-panel:not(:has(> .table-panel__scroll)) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-panel__scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-panel.overflow-x-auto {
    overflow-x: hidden;
}
/* Entities list: allow BA multi-line tips to paint outside sticky header clip */
.table-panel.entities-list-table-panel {
    overflow: visible;
}
.table-panel.entities-list-table-panel.overflow-x-auto {
    overflow-x: auto;
    overflow-y: visible;
}
.table-panel.reports-daily-table-panel:not(:has(> .table-panel__scroll)) {
    overflow: auto;
}
.table-panel.reports-daily-table-panel:has(> .table-panel__scroll) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.table-panel.reports-daily-table-panel > .table-panel__scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.data-table--dense {
    width: 100%;
    font-size: 0.8125rem;
}
.data-table--dense th,
.data-table--dense td {
    padding: 0.35rem 0.55rem;
    vertical-align: middle;
}
.data-table--dense th {
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
    box-shadow: 0 1px 0 var(--border);
}
.data-table--dense td.num,
.data-table--dense th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.data-table--dense td.muted {
    color: var(--muted);
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table--dense tbody tr:hover {
    background: #f8fafc;
}
.data-table--dense .badge,
.data-table--dense .status-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
}
.type-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.type-deposit { background: #d1fae5; color: #065f46; }
.type-withdrawal { background: #fee2e2; color: #991b1b; }
.type-fx { background: #dbeafe; color: #1d4ed8; }
.type-adjustment { background: #f3f4f6; color: #374151; }
.type-expenses { background: #ffedd5; color: #9a3412; }
.type-bank_charges { background: #f3e8ff; color: #6b21a8; }
.type-others { background: #f3f4f6; color: #6b7280; }

.list-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding: 0.35rem 0;
    flex-wrap: wrap;
}
.list-pagination-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.list-pagination-page {
    font-size: 0.8rem;
    color: var(--muted);
}
.list-pagination-page--of {
    white-space: nowrap;
}
.list-pagination--compact {
    margin-top: 0;
    padding: 0;
}
.list-pagination-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}
.list-pagination-jump__label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}
.list-pagination-jump__select,
.list-pagination-jump__input {
    width: auto;
    min-width: 3.25rem;
    max-width: 5.5rem;
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1.2;
}
.list-pagination-jump__input {
    width: 3.75rem;
}
.list-pagination-actions .btn.is-disabled,
.list-pagination-actions .btn[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}

/* Entries list — View by panel (peer of Filters / Tables) */
.entries-view-by-panel {
    flex: 0 1 13.5rem;
    min-width: 12rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    align-self: stretch;
}
.entries-view-by-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    flex: none;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}
.entries-view-by-panel__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
/* Fill remaining panel height after heading — two equal large options */
.entries-view-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-height: 0;
}
.entries-view-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.55rem;
    border: 1px solid var(--border, #e2e8f0);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--muted);
    text-decoration: none;
    text-align: center;
    line-height: 1.25;
    background: var(--surface-raised, #f8fafc);
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.entries-view-toggle__btn:hover {
    color: var(--text);
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.entries-view-toggle__btn.is-active {
    color: #0e7490;
    background: rgba(34, 211, 238, 0.22);
    border-color: #0891b2;
    box-shadow:
        inset 0 0 0 1px rgba(8, 145, 178, 0.25),
        0 0 0 1px rgba(8, 145, 178, 0.12);
    font-weight: 800;
}
.entries-view-toggle__btn.is-active:hover {
    color: #0e7490;
    background: rgba(34, 211, 238, 0.28);
    border-color: #0e7490;
}
.entries-view-toggle__btn:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

/* Tables panel — disabled in Deals sequence */
.entries-tables-panel.is-disabled {
    opacity: 0.72;
    cursor: not-allowed;
}
.entries-tables-panel.is-disabled .entries-tables-panel__checks {
    pointer-events: none;
}
.entries-tables-panel__disabled-hint {
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    line-height: 1.35;
    color: #64748b;
}
.entries-tables-check.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.entries-tables-check.is-disabled .entries-tables-check__input {
    cursor: not-allowed;
}

.entry-sequence-hint {
    margin: 0 0 0.55rem;
    font-size: 0.8rem;
    line-height: 1.4;
}
.entry-seq-deal-mark {
    margin-bottom: 0.15rem;
}
.entry-seq-deal-chip,
.entry-seq-loose-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}
.entry-seq-deal-chip {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.28);
    text-decoration: none;
}
.entry-seq-deal-chip:hover {
    background: rgba(59, 130, 246, 0.2);
}
.entry-seq-loose-chip {
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
.entry-seq-row--deal-start td {
    border-top: 2px solid rgba(59, 130, 246, 0.35);
}
.entry-seq-row--loose td:first-child {
    box-shadow: inset 3px 0 0 #94a3b8;
}
.type-badge.type-deal-sequence {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}
.entry-seq-fx-second,
.entry-seq-fx-rate {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
}

/* Dependency party: Payer / Payee / Originator badge + name */
.entry-dep-party {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 0;
    max-width: 100%;
}
.entry-dep-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    line-height: 1.2;
    flex: none;
}
.entry-dep-badge--payer {
    color: #0f766e;
    background: rgba(20, 184, 166, 0.14);
    border: 1px solid rgba(13, 148, 136, 0.3);
}
.entry-dep-badge--payee {
    color: #b45309;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(217, 119, 6, 0.28);
}
.entry-dep-badge--originator {
    color: #6d28d9;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.28);
}
.entry-dep-badge--party {
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
.entry-dep-name {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.74rem;
    color: var(--text);
    line-height: 1.25;
}

/*
 * Deals sequence table:
 * - fill full content width when viewport is wide
 * - horizontal scroll when viewport is narrower than min-width
 * Parent chain must use min-width:0 so flex/overflow doesn't expand the page.
 */
.entries-list-page #entries-list-content,
.entries-list-page .entry-section--sequence,
.entries-list-page .entry-section--sequence .entry-section-body {
    min-width: 0;
    max-width: 100%;
}
.entry-sequence-table-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}
.entry-sequence-table-panel > .entry-sequence-scroll,
.entry-sequence-table-panel > .table-panel__scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.entries-list-page .entry-table--sequence {
    table-layout: fixed;
    width: 100%;
    min-width: 70rem; /* scroll when narrower than this */
    max-width: none;
}
/* Proportional columns — scale up to fill wide browsers */
.entries-list-page .entry-table--sequence .col-check { width: 3%; }
.entries-list-page .entry-table--sequence .col-entry { width: 11%; }
.entries-list-page .entry-table--sequence .col-date { width: 6%; }
.entries-list-page .entry-table--sequence .col-type { width: 6%; }
.entries-list-page .entry-table--sequence .col-tx { width: 6%; }
.entries-list-page .entry-table--sequence .col-entity { width: 11%; }
.entries-list-page .entry-table--sequence .col-amount { width: 9%; }
.entries-list-page .entry-table--sequence .col-dependent { width: 11%; }
.entries-list-page .entry-table--sequence .col-status { width: 6%; }
.entries-list-page .entry-table--sequence .col-deal { width: 7%; }
.entries-list-page .entry-table--sequence .col-refs { width: 8%; }
.entries-list-page .entry-table--sequence .col-actions { width: 6%; }
.entries-list-page .entry-table--sequence .entry-entity-cell,
.entries-list-page .entry-table--sequence .entry-dependent-cell {
    max-width: none;
}
.entries-list-page .entry-table--sequence .entry-amount {
    white-space: normal;
}
.entries-list-page .entry-table--sequence .entry-amount-main {
    white-space: nowrap;
}
.entries-list-page .entry-table--sequence .entry-uid-cell {
    white-space: normal;
}
/* Entry name left, edit control right (deals sequence). */
.entries-list-page .entry-table--sequence .entry-uid-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}
.entries-list-page .entry-table--sequence .entry-uid-row .entry-uid {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entries-list-page .entry-table--sequence .entry-uid-row .btn--icon-only,
.entries-list-page .entry-table--sequence .entry-uid-row .deal-entry-bulk-choice {
    flex: 0 0 auto;
    margin-left: auto;
}

@media (max-width: 767px) {
    .entries-view-by-panel {
        flex: 1 1 100%;
        min-width: 0;
        width: 100%;
        min-height: 8.5rem;
    }
    .entries-view-toggle {
        flex-direction: row;
        flex-wrap: nowrap;
        min-height: 3.5rem;
    }
    .entries-view-toggle__btn {
        flex: 1 1 50%;
        min-height: 3.25rem;
        font-size: 0.82rem;
    }
    .entries-list-page .entry-table--sequence {
        min-width: 64rem;
        font-size: 0.7rem;
    }
    .entry-dep-name {
        font-size: 0.7rem;
    }
    .entry-sequence-hint {
        font-size: 0.75rem;
    }
}

/* Entries list — type-specific sections */
.entry-section {
    margin-bottom: 1.25rem;
}
.entry-section:last-child {
    margin-bottom: 0;
}
.entry-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}
.entry-section-header__start {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.entry-section-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
}
.entry-section-collapse-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: #f8fafc;
}
.entry-section-collapse-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
.entry-section-collapse-icon {
    display: block;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    margin-top: -0.15rem;
}
.entry-section-collapse-icon.is-collapsed {
    transform: rotate(-45deg);
    margin-top: 0.1rem;
}
.entry-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.entry-section-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
}
.entry-section-new {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #9a3412;
    background: #ffedd5;
    border: 1px solid #fdba74;
    border-radius: 999px;
    padding: 0.08rem 0.45rem;
    cursor: pointer;
    line-height: 1.2;
    font-family: inherit;
}
.entry-section-new:hover {
    background: #fed7aa;
    border-color: #fb923c;
}
.entry-section-new__count {
    font-variant-numeric: tabular-nums;
}
.entry-section-sync {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    padding: 0;
    border: 1px solid #fdba74;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    cursor: pointer;
    flex-shrink: 0;
}
.entry-section-sync:hover {
    background: #ffedd5;
    color: #9a3412;
}
.entry-section-sync__icon {
    display: block;
}
[data-theme="dark"] .entry-section-new {
    color: #fdba74;
    background: rgba(154, 52, 18, 0.35);
    border-color: rgba(251, 146, 60, 0.45);
}
[data-theme="dark"] .entry-section-sync {
    background: rgba(154, 52, 18, 0.25);
    border-color: rgba(251, 146, 60, 0.4);
    color: #fdba74;
}
.entry-table {
    border-collapse: separate;
    border-spacing: 0;
}
.entry-table th,
.entry-table td {
    border-right: 1px solid #eef2f6;
}
.entry-table th:last-child,
.entry-table td:last-child {
    border-right: none;
}
.entry-table .entry-uid {
    font-weight: 600;
    white-space: nowrap;
}
.entry-table .entry-amount,
.entry-table .entry-rate {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.entry-table .entry-rate {
    font-size: 0.78rem;
    color: var(--muted);
}
.entry-table .entry-refs span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    white-space: nowrap;
}
.tx-channel { background: #e0f2fe; color: #0369a1; }
.tx-counterparty { background: #fce7f3; color: #9d174d; }
.entry-table--fx {
    min-width: 1080px;
}
.entry-table .entry-entity-cell {
    width: 11rem;
    max-width: 11rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    vertical-align: top;
}
.entry-list-check {
    width: 2rem;
    text-align: center;
    vertical-align: middle;
}
.entry-list-check input {
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}
.entries-batch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    margin-bottom: 0.85rem;
    padding: 0.55rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.entries-batch-label {
    font-size: 0.8125rem;
    color: var(--muted);
}
.entries-batch-select {
    font-size: 0.8125rem;
    padding: 0.25rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.entries-batch-remarks {
    flex: 1 1 16rem;
    min-width: 12rem;
    font-size: 0.8125rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    resize: vertical;
}
.entry-row-actions,
.deal-entry-actions {
    white-space: nowrap;
    text-align: right;
    vertical-align: top;
}
.entry-row-action-group,
.deal-entry-action-group,
.ui-action-cell .ui-action-group {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
}
.entry-row-action-form,
.deal-entry-action-form,
.ui-action-form {
    display: inline-flex;
    margin: 0;
}
.entry-table--deposit,
.entry-table--withdrawal {
    min-width: 1180px;
}

/* Entries list page */
.entries-list-page {
    --entries-topbar-height: var(--app-topbar-height);
    --entries-toolbar-height: 0px;
    --entries-batch-height: 0px;
    --entries-toolbar-top: var(--entries-topbar-height);
    /* Filters toolbar bottom — Set status sticks here */
    --entries-section-top: calc(var(--entries-topbar-height) + var(--entries-toolbar-height));
    /* Below filters + Set status (for future sticky section headers) */
    --entries-content-top: calc(
        var(--entries-topbar-height) + var(--entries-toolbar-height) + var(--entries-batch-height)
    );
}
.entries-list-page .page-header h1 {
    font-size: 1.15rem;
}
.entries-list-sticky-toolbar {
    position: relative;
    z-index: 35;
    background: var(--bg);
    margin-bottom: 0.65rem;
    padding-bottom: 0.15rem;
    box-sizing: border-box;
    /* Keep sticky descendants working: do not clip overflow */
    overflow: visible;
}
.entries-list-sticky-toolbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.06), transparent);
    pointer-events: none;
}
/* Spacer when Set status is fixed-pinned */
.entries-batch-spacer {
    height: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    pointer-events: none;
}
.entries-batch-spacer.is-active {
    flex-shrink: 0;
}
.entries-filter-popup {
    display: contents;
}
.entries-list-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.55rem;
    margin-bottom: 0.5rem;
}
.entries-list-toolbar__row .entries-filter-panel {
    flex: 1 1 36rem;
    min-width: min(100%, 28rem);
    margin-bottom: 0;
}
@media (max-width: 767px) {
    .entries-list-sticky-toolbar.is-filters-open .entries-filter-panel {
        min-width: 0;
        max-width: 100%;
    }
    .entries-list-sticky-toolbar.is-filters-open .entries-filter-panel .form-input,
    .entries-list-sticky-toolbar.is-filters-open .entries-filter-panel .form-select {
        max-width: 100%;
    }
}
.entries-tables-panel {
    flex: 0 1 15rem;
    min-width: 11.5rem;
    padding: 0.65rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.entries-tables-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}
.entries-tables-panel__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.entries-tables-panel__checks {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.entries-tables-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
}
.entries-tables-check__input {
    width: 0.9rem;
    height: 0.9rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.entries-tables-check__badge {
    font-size: 0.68rem;
}
.entry-section.is-table-hidden {
    display: none !important;
}
.entries-list-sticky-toolbar .entries-batch-actions {
    width: 100%;
}
.entry-section--deferred .entry-section-body--loading {
    padding: 1.25rem 0.75rem;
}
.entry-section-loading {
    margin: 0;
    text-align: center;
}
.entries-list-page .entry-section-header--sticky {
    position: static;
    z-index: 1;
    margin-bottom: 0.4rem;
    padding: 0.42rem 0.65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
.entries-list-page .entry-section-header--sticky + .entry-section-body .table-panel,
.entries-list-page .entry-section-header--sticky + .table-panel {
    margin-top: 0.4rem;
}
.entries-list-page .entry-section-header--sticky .entry-section-header__start {
    flex: 1 1 auto;
    min-width: 0;
}
.entries-list-page .entry-section {
    scroll-margin-top: calc(var(--entries-section-top) + 2.5rem);
}
.entries-filter-panel,
.deals-filter-panel {
    margin-bottom: 0.65rem;
    padding: 0.65rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.entries-filter-panel__head,
.deals-filter-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}
.entries-filter-panel__title,
.deals-filter-panel__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.entries-filter-panel__actions,
.deals-filter-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.entries-filter-grid,
.deals-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.45rem 0.55rem;
}
.entries-filter-field,
.deals-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.entries-filter-field label,
.deals-filter-field label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.entries-filter-field--search,
.deals-filter-field--search {
    grid-column: span 2;
}
.entries-filter-panel .form-input,
.deals-filter-panel .form-input {
    width: 100%;
    padding: 0.32rem 0.48rem;
    font-size: 0.74rem;
    line-height: 1.35;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
}
.entries-filter-panel .form-input:focus,
.deals-filter-panel .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.entries-filter-panel .form-select-wrap,
.deals-filter-panel .form-select-wrap {
    position: relative;
    display: block;
}
.entries-filter-panel .form-select-wrap::after,
.deals-filter-panel .form-select-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.5rem;
    width: 0.4rem;
    height: 0.4rem;
    pointer-events: none;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-65%) rotate(45deg);
}
.entries-filter-panel .form-select,
.deals-filter-panel .form-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 1.6rem;
    cursor: pointer;
}
.deals-list-page {
    --deals-toolbar-top: var(--entries-topbar-height);
    width: 100%;
    min-width: 0;
    overflow-x: clip;
}
.deals-list-page .table-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.deals-list-page .table-panel[data-deals-list-view="easy"] .table-panel__scroll,
.deals-list-page .table-panel[data-deals-list-view="easy"]:not(:has(> .table-panel__scroll)) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.deals-list-sticky-toolbar {
    position: sticky;
    top: var(--deals-toolbar-top);
    z-index: 35;
    background: var(--bg);
    margin-bottom: 0.65rem;
    padding-bottom: 0.15rem;
}
.deals-list-sticky-toolbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.06), transparent);
    pointer-events: none;
}
.deals-list-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.55rem;
    margin-bottom: 0.5rem;
}
.deals-list-toolbar__row .deals-filter-panel {
    flex: 1 1 36rem;
    min-width: min(100%, 28rem);
    margin-bottom: 0;
}
.deals-list-sticky-toolbar .deals-filter-panel {
    margin-bottom: 0;
}
/* Set status bar — thin bar only; JS may pin with .is-fixed while scrolling */
.entries-list-page .entries-batch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    margin: 0.45rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.74rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
    max-height: none;
}
.entries-list-page .entries-batch-actions.is-fixed {
    /* top/left/width set by JS; keep bar thin so it never blocks the page */
    margin: 0;
    max-height: 40vh;
    overflow: auto;
    box-shadow:
        0 4px 14px rgba(15, 23, 42, 0.1),
        0 1px 0 var(--border);
}
.entries-list-page .entries-batch-label {
    font-size: 0.72rem;
}
.entries-list-page .entries-batch-select,
.entries-list-page .entries-batch-remarks {
    font-size: 0.74rem;
    padding: 0.28rem 0.42rem;
}
.entries-list-page .entry-section {
    margin-bottom: 0.85rem;
}
.entries-list-page .entry-section-title {
    font-size: 0.82rem;
}
.entries-list-page .entry-section-count {
    font-size: 0.68rem;
    padding: 0.08rem 0.38rem;
}
.entries-list-page .entry-section-new {
    font-size: 0.65rem;
    padding: 0.06rem 0.4rem;
}
.entries-list-page .entry-section-sync {
    width: 1.3rem;
    height: 1.3rem;
}
.entries-list-page .entry-table {
    table-layout: fixed;
    font-size: 0.74rem;
}
.entries-list-page .entry-table th,
.entries-list-page .entry-table td {
    padding: 0.28rem 0.42rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entries-list-page .entry-table th {
    font-size: 0.6rem;
    position: static;
    top: auto;
    z-index: auto;
    box-shadow: none;
}
.entries-list-page .entry-table .col-check { width: 2rem; }
.entries-list-page .entry-table .col-entry { width: 9.5rem; }
.entries-list-page .entry-table .col-date { width: 5.25rem; }
.entries-list-page .entry-table .col-tx { width: 4.75rem; }
.entries-list-page .entry-table .col-entity { width: 7rem; }
.entries-list-page .entry-table .col-amount { width: 6.25rem; }
.entries-list-page .entry-table .col-rate { width: 6rem; }
.entries-list-page .entry-table .col-status { width: 4.75rem; }
.entries-list-page .entry-table .col-deal { width: 5.25rem; }
.entries-list-page .entry-table .col-refs { width: 6.5rem; }
.entries-list-page .entry-table .col-actions { width: 5.5rem; }
.entries-list-page .entry-table .entry-entity-cell {
    width: auto;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    line-height: 1.3;
}
.entries-list-page .entry-table .entry-uid {
    font-size: 0.74rem;
}
.entries-list-page .entry-table .entry-amount,
.entries-list-page .entry-table .entry-rate {
    font-size: 0.72rem;
}
.entries-list-page .entry-table .entry-rate {
    font-size: 0.68rem;
}
.entries-list-page .entry-table .type-badge,
.entries-list-page .entry-table .tx-badge,
.entries-list-page .entry-table .status-badge {
    font-size: 0.6rem;
    padding: 0.06rem 0.3rem;
}
.entries-list-page .entry-table .entry-refs {
    font-size: 0.68rem;
}
.entries-list-page .entry-table .ui-action-cell,
.entries-list-page .entry-table .entry-row-actions {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}
.entries-list-page .entry-table .ui-action-cell .ui-action-group {
    flex-wrap: nowrap;
}
.entries-list-page .entry-table .ui-action-group--icon-only {
    gap: 0.25rem;
}
/*
 * ENTRY column: never put display:flex on the <td> itself — that breaks table
 * row height so the UID cell sits half a row off (especially on mobile/narrow).
 * Keep table-cell + vertical-align; lay out the link + edit icon as inlines.
 */
.entries-list-page .entry-table .entry-uid-cell {
    display: table-cell;
    vertical-align: middle;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
.entries-list-page .entry-table .entry-uid-cell .entry-uid {
    display: inline-block;
    max-width: calc(100% - 1.75rem);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    line-height: 1.3;
}
.entries-list-page .entry-table .entry-uid-cell .btn--icon-only {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 0.2rem;
    flex-shrink: 0;
}
.entries-list-page .entry-table--deposit,
.entries-list-page .entry-table--withdrawal {
    min-width: 1040px;
}
.entries-list-page .entry-table--fx {
    min-width: 1060px;
}
/* Adjustments & other — balanced fixed columns; entity capped with ellipsis */
.entries-list-page .entry-table--other {
    width: 100%;
    min-width: 0;
}
.entries-list-page .entry-table--other .col-entry {
    width: 7rem;
}
.entries-list-page .entry-table--other .col-date {
    width: 5rem;
}
.entries-list-page .entry-table--other .col-type {
    width: 4.25rem;
}
.entries-list-page .entry-table--other .col-tx {
    width: 4.25rem;
}
.entries-list-page .entry-table--other .col-entity {
    width: 9rem;
}
.entries-list-page .entry-table--other .col-amount {
    width: 6.25rem;
}
.entries-list-page .entry-table--other .col-direction {
    width: 4.25rem;
}
.entries-list-page .entry-table--other .col-status {
    width: 4.5rem;
}
.entries-list-page .entry-table--other .col-deal {
    width: 5rem;
}
.entries-list-page .entry-table--other .col-refs {
    width: 6rem;
}
.entries-list-page .entry-table--other .col-actions {
    width: 10rem;
}
.entries-list-page .entry-table--other .entry-entity-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entries-list-page .entry-table--other .type-badge {
    font-size: 0.55rem;
    padding: 0.04rem 0.2rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
.entries-list-page .list-pagination-page {
    font-size: 0.72rem;
}
@media (max-width: 1200px) {
    .entries-filter-grid,
    .deals-filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .entries-filter-field--search,
    .deals-filter-field--search {
        grid-column: span 2;
    }
}
@media (max-width: 768px) {
    .entries-filter-grid,
    .deals-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .entries-filter-field--search,
    .deals-filter-field--search {
        grid-column: span 2;
    }
}

/* Dashboard — permission-gated operator home */
.dashboard-page .page-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0.15rem;
}
.dashboard-header {
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.dashboard-quick-actions {
    flex-basis: 100%;
    margin-top: 0.65rem;
}
.dashboard-section {
    margin-bottom: 1.25rem;
}
.dashboard-section-head,
.dashboard-panel-head,
.dashboard-op-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}
.dashboard-section-title-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}
.dashboard-section-title-row .dashboard-section-title {
    margin: 0;
}
.dashboard-section-title-row .module-info-tip__trigger {
    width: 1.35rem;
    height: 1.35rem;
}
.dashboard-section-title-row .module-info-tip__trigger .btn__icon {
    width: 0.85rem;
    height: 0.85rem;
}
.dashboard-section-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.dashboard-section-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}
.dashboard-section-link {
    font-size: 0.78rem;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.dashboard-section-link:hover {
    text-decoration: underline;
}
button.dashboard-treasury-sync {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
}
button.dashboard-treasury-sync:hover {
    text-decoration: underline;
}
button.dashboard-treasury-sync:disabled {
    opacity: 0.55;
    cursor: wait;
    text-decoration: none;
}
button.dashboard-treasury-sync.is-loading {
    cursor: wait;
}
.dashboard-callout {
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
}
.dashboard-callout--warn {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.65rem;
}
.dashboard-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.dashboard-stat-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.dashboard-stat-card--warn {
    border-color: #fecaca;
    background: #fef2f2;
}
.dashboard-stat-card--warn .dashboard-stat-value {
    color: #dc2626;
}
.dashboard-stat-card--muted .dashboard-stat-value {
    color: var(--muted);
}
.dashboard-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}
.dashboard-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.dashboard-stat-warn {
    color: #dc2626;
    font-weight: 600;
}
.dashboard-ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}
.dashboard-op-card {
    padding: 1rem 1.1rem;
}
.dashboard-op-card h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}
.dashboard-op-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem 0.75rem;
    margin: 0;
}
.dashboard-op-stats > div {
    min-width: 0;
}
.dashboard-op-stats dt {
    margin: 0 0 0.1rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}
.dashboard-op-stats dd {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dashboard-op-stats a {
    color: inherit;
    text-decoration: none;
}
.dashboard-op-stats a:hover {
    color: var(--primary);
}
.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 0.85rem;
    align-items: start;
}
.dashboard-panel {
    padding: 1rem 1.1rem;
    min-width: 0;
}
.dashboard-panel h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}
.dashboard-panel-empty {
    margin: 0.25rem 0 0;
}
.dashboard-table {
    font-size: 0.78rem;
}
.dashboard-table th,
.dashboard-table td {
    padding: 0.45rem 0.55rem;
}
.dashboard-table th {
    font-size: 0.68rem;
}
.dashboard-treasury-summary {
    margin-bottom: 0;
}
.dashboard-treasury-meta .balance-mtm-value {
    font-size: 0.95rem;
}
/* Dashboard card order: Today → Week → Month → YTD → Total MTM → Deals (Today) */
.balance-mtm-summary--dashboard {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}
/* Even share for the five MTM cards; Deals (Today) stays a compact trailing slot */
.balance-mtm-summary--dashboard .balance-mtm-stat--period-today,
.balance-mtm-summary--dashboard .balance-mtm-stat--period-week,
.balance-mtm-summary--dashboard .balance-mtm-stat--period-month,
.balance-mtm-summary--dashboard .balance-mtm-stat--period-ytd,
.balance-mtm-summary--dashboard [data-balance-stat-cached="ytd"],
.balance-mtm-summary--dashboard .balance-mtm-stat--total,
.balance-mtm-summary--dashboard [data-balance-stat-cached="total_mtm"] {
    flex: 1 1 0;
    min-width: 0;
}
.balance-mtm-summary--dashboard .balance-mtm-stat--period-today { order: 1; }
.balance-mtm-summary--dashboard .balance-mtm-stat--period-week { order: 2; }
.balance-mtm-summary--dashboard .balance-mtm-stat--period-month { order: 3; }
.balance-mtm-summary--dashboard .balance-mtm-stat--period-ytd,
.balance-mtm-summary--dashboard [data-balance-stat-cached="ytd"] { order: 4; }
.balance-mtm-summary--dashboard .balance-mtm-stat--total,
.balance-mtm-summary--dashboard [data-balance-stat-cached="total_mtm"] { order: 5; }
.balance-mtm-summary--dashboard .balance-mtm-stat--deals-today {
    order: 6;
    flex: 0 0 8rem;
    min-width: 7.5rem;
    max-width: 8.5rem;
    width: 8rem;
}
.balance-mtm-summary--dashboard .balance-mtm-live-warn {
    order: 10;
    flex: 1 1 100%;
}
/* Label top-left; figure bottom-right with room to breathe */
.balance-mtm-summary--dashboard > .balance-mtm-stat {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 5.25rem;
    padding: 0.7rem 0.85rem 0.75rem;
    box-sizing: border-box;
}
.balance-mtm-summary--dashboard .balance-mtm-label {
    margin-bottom: 0;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}
.balance-mtm-summary--dashboard .balance-mtm-value {
    margin-top: auto;
    margin-left: auto;
    padding-top: 0.55rem;
    text-align: right;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.balance-mtm-summary--dashboard .balance-mtm-stat--primary .balance-mtm-value,
.balance-mtm-summary--dashboard .balance-mtm-stat--total .balance-mtm-value {
    font-size: 1.22rem;
}
.balance-mtm-summary--dashboard .balance-mtm-stat--deals-today .balance-mtm-value {
    font-variant-numeric: tabular-nums;
    font-size: 1.2rem;
}
/* Cached YTD: refresh icon sits in the label row next to the badge */
.balance-mtm-summary--dashboard .balance-mtm-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1rem 0;
    line-height: 1.2;
}
.balance-mtm-summary--dashboard .balance-mtm-refresh-icon-btn {
    flex-shrink: 0;
}
.dashboard-empty {
    padding: 1.5rem;
    text-align: center;
}
.dashboard-empty h3 {
    margin: 0 0 0.35rem;
}
.table-panel--flush {
    margin: 0 -0.25rem;
}
@media (max-width: 640px) {
    .dashboard-op-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.entry-balance-hint {
    margin: 0.35rem 0 0;
}

.entry-approve-form {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}
.entry-detail-subheader {
    margin: 0 0 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.entry-approve-form--subheader {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: 100%;
}
.entry-approve-form__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
}
.entry-detail-subheader__label {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}
.entry-approve-form__overrides {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    padding-top: 0.15rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}
.entry-approve-form--subheader:not(:has(.entry-approve-form__overrides)) .entry-approve-form__toolbar {
    border-top: none;
    padding-top: 0;
}
.entry-approve-override {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}
.entry-approve-override--prohibited {
    border-color: #f5c6cb;
    background: #fff8f8;
    flex-direction: column;
    align-items: stretch;
}
.entry-approve-override--prohibited .entry-approve-override-check {
    margin-top: 0.15rem;
}
.entry-approve-override--prohibited .form-input {
    width: 100%;
}
.entry-approve-override-hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.45;
}
.entry-approve-override-desc {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.78rem;
    line-height: 1.45;
}
.entry-approve-override-warnings {
    margin: 0 0 0.5rem;
    padding-left: 1.1rem;
    font-size: 0.8125rem;
    color: #b45309;
    line-height: 1.45;
}
.entry-approve-override-warnings li + li {
    margin-top: 0.25rem;
}
.entry-approve-override-denied {
    margin: 0;
    font-size: 0.8125rem;
}
.entry-reopen-form {
    display: inline-flex;
    margin: 0;
}
.entry-approve-override-check {
    font-size: 0.8125rem;
    color: var(--muted);
}
.entry-prohibited-override {
    margin-top: 0.75rem;
    border: 1px solid #f5c6cb;
    background: #fff8f8;
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
}
.entry-prohibited-override__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.entry-prohibited-override__fields .form-input {
    flex: 1 1 16rem;
    min-width: 12rem;
}
.entry-prohibited-override__denied {
    margin: 0;
}
.wizard-bucket-option {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.8125rem;
    color: var(--muted);
}
.balance-bucket-cell {
    vertical-align: top;
}
.balance-bucket-line {
    display: block;
    font-size: 0.72rem;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.balance-bucket-line--unproc {
    color: var(--muted);
}
.balance-bucket-line--proc {
    font-weight: 600;
}

/* Deals list — 2-row blocks; table-panel scrolls when viewport < table min-width */
.deals-table {
    width: 100%;
    min-width: 1520px;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid var(--border);
}
.deals-table .deals-head-parties .deal-col-deal,
.deals-table .deal-row-parties .deal-col-deal {
    width: 18%;
}
.deals-table .deals-head-parties .deal-col-date,
.deals-table .deal-row-parties .deal-col-date {
    width: 8%;
}
.deals-table .deals-head-parties .deal-col-party,
.deals-table .deal-row-parties .deal-col-party {
    width: 7%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.deals-table .deal-row-parties .deal-col-party.deal-entry-lines {
    white-space: normal;
}
.deals-table .deals-head-parties .deal-col-status,
.deals-table .deal-row-parties .deal-col-status {
    width: 6%;
}
.deals-table .deals-head-parties .deal-col-entries,
.deals-table .deal-row-parties .deal-col-entries {
    width: 4%;
}
.deals-table .deals-head-parties .deal-col-refs,
.deals-table .deal-row-parties .deal-col-refs {
    width: 12%;
}
.deals-table .deal-row-fund-meta-wrap {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-top: none;
}
.deals-table .deal-row-fund-meta td {
    background: var(--deal-band-bg);
}
.deal-fund-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}
.deal-fund-meta__item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}
.deal-fund-meta__label {
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
.deal-fund-meta__value {
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deals-table .deal-row-flow-wrap {
    padding: 0;
    border-top: none;
    overflow: hidden;
}
.deal-flow-grid {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns:
        minmax(9rem, 0.95fr)
        minmax(7.25rem, 0.8fr)
        minmax(9.25rem, 1.1fr)
        minmax(7.25rem, 0.85fr)
        minmax(8rem, 0.85fr)
        minmax(8.5rem, 0.9fr)
        minmax(9.25rem, 1.1fr)
        minmax(7.25rem, 0.85fr)
        minmax(7.25rem, 0.8fr);
}
.deal-flow-grid--margins {
    grid-template-columns:
        minmax(9rem, 0.95fr)
        minmax(7.25rem, 0.8fr)
        minmax(9.25rem, 1.1fr)
        minmax(7.25rem, 0.85fr)
        minmax(8rem, 0.85fr)
        minmax(8.5rem, 0.9fr)
        minmax(9.25rem, 1.1fr)
        minmax(7.25rem, 0.85fr)
        minmax(7.25rem, 0.8fr)
        minmax(9.5rem, 1.1fr)
        minmax(9.5rem, 1.1fr);
}
.deal-flow-grid__cell {
    padding: 0.3rem 0.55rem;
    border-right: 1px solid #e2e8f0;
    min-width: 0;
    overflow: hidden;
}
.deal-flow-grid__cell:last-child {
    border-right: none;
}
.deal-flow-grid__cell--legend {
    min-width: 9rem;
}
.deal-flow-grid__cell--deposit,
.deal-flow-grid__cell--payout {
    min-width: 7.25rem;
}
.deal-flow-grid__cell--channel-fx,
.deal-flow-grid__cell--cp-fx {
    min-width: 9.25rem;
}
.deal-flow-grid__cell--channel-rate,
.deal-flow-grid__cell--cp-rate {
    min-width: 7.25rem;
}
.deal-flow-grid__cell--withdrawals {
    min-width: 8rem;
}
.deal-flow-grid__cell--cp-deposit {
    min-width: 8.5rem;
}
.deal-flow-grid__cell--channel-spread,
.deal-flow-grid__cell--house-margin {
    min-width: 9.5rem;
}
.deal-flow-grid__cell--legend .deal-flow-cell__value,
.deal-flow-grid__cell--cp-deposit .deal-flow-cell__label,
.deal-flow-grid__cell--withdrawals .deal-flow-cell__label,
.deal-flow-grid__cell--channel-spread .deal-flow-cell__label {
    white-space: normal;
    max-width: 100%;
}
.deals-table th,
.deals-table td {
    border: 1px solid #e2e8f0;
}
.deals-table .deals-head-parties th {
    border-bottom: 2px solid #cbd5e1;
    background: #f1f5f9;
}
.deals-table .deal-block tr:last-child td,
.deals-table .deal-block tr:last-child th {
    border-bottom: 2px solid #cbd5e1;
}
.deals-table .deal-block:last-child tr:last-child td,
.deals-table .deal-block:last-child tr:last-child th {
    border-bottom: 1px solid #e2e8f0;
}
.deals-table .deal-block {
    --deal-row-bg: var(--deal-band-bg);
    --deal-row-hover: var(--deal-band-hover);
}
.deals-table .deal-block--alt {
    --deal-row-bg: var(--deal-band-alt);
    --deal-row-hover: var(--deal-band-alt-hover);
}
.deals-table .deal-row-parties td {
    background: var(--deal-row-bg);
    vertical-align: top;
}
.deals-table .deal-row-flow td {
    background: var(--deal-row-bg, var(--deal-band-bg));
    vertical-align: top;
}
.deals-table tbody tr:hover td,
.deals-table tbody tr:hover th {
    background: inherit;
}
.deals-table .deal-block .deal-row-parties:hover td,
.deals-table .deal-block .deal-row-flow:hover td {
    background: var(--deal-row-hover, var(--deal-band-hover));
}
.deals-table .deal-flow-cell {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    gap: 0.35rem;
    min-height: 2.75rem;
    height: 100%;
}
.deals-table .deal-flow-cell__label {
    align-self: flex-start;
    font-size: 0.65rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
    white-space: nowrap;
}
.deals-table .deal-flow-cell__value {
    align-self: flex-end;
    text-align: right;
    font-size: 0.75rem;
    white-space: nowrap;
    color: #475569;
    font-weight: 500;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deals-table .deal-flow-cell__value--fx {
    white-space: pre-line;
    line-height: 1.35;
}
.deals-table .deal-flow-cell--legend .deal-flow-cell__value {
    font-size: 0.72rem;
    font-weight: 600;
}
.deals-table .deal-flow-cell--spread .deal-flow-cell__value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    max-width: 100%;
}
.deals-table .deal-flow-cell--spread .deal-flow-cell__value span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.deal-misc-entries {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.deal-misc-entries__label {
    margin: 0.35rem 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
}
.deal-misc-entries__list {
    margin: 0 0 0.5rem;
    padding-left: 1.1rem;
    font-size: 0.78rem;
    color: #475569;
}
.deals-table--detail .deal-row-flow-head th {
    font-size: 0.65rem;
    color: var(--muted);
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-bottom: 1px solid #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.deals-table--detail .deal-row-flow-head th {
    background: var(--deal-band-bg, #f8fafc);
}
.deals-table--detail .deal-row-flow td {
    background: var(--deal-band-bg, #f8fafc);
    vertical-align: middle;
    padding: 0.25rem 0.55rem;
}
.deals-table--detail .deal-flow-value {
    font-size: 0.75rem;
    white-space: nowrap;
    color: #475569;
    font-weight: 500;
}
.deals-table--detail .deal-flow-value--fx {
    white-space: pre-line;
    line-height: 1.35;
    vertical-align: top;
}
.deal-cell-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}
.deal-cell-identity {
    min-width: 0;
    flex: 1 1 auto;
}
.deal-duplicate-form {
    flex: 0 0 auto;
}
.deals-table .deal-uid {
    display: block;
    font-weight: 700;
}
.deals-table .deal-name {
    display: block;
    font-weight: 600;
    font-size: 0.78rem;
}
.deals-table .deal-desc {
    display: block;
    font-size: 0.72rem;
    margin-top: 0.1rem;
}

.deals-table .deal-spread span {
    display: block;
    white-space: nowrap;
}
.deals-table .deal-spread .hint {
    font-size: 0.68rem;
}
.deals-table .deal-refs span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deals-table .deal-entry-lines {
    font-size: 0.75rem;
    line-height: 1.45;
}
.deals-table .deal-entry-line + .deal-entry-line {
    margin-top: 0.15rem;
}

/* Deals list — Easy / Advanced display mode */
html[data-deals-list-mode="easy"] [data-deals-list-view="advanced"] {
    display: none;
}
html[data-deals-list-mode="advanced"] [data-deals-list-view="easy"] {
    display: none;
}

.deals-list-mode-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    text-align: center;
}
.deals-list-mode-toggle {
    flex-shrink: 0;
    cursor: help;
}
/* Combine deals: select column only while Select mode is on */
.deals-select-col {
    display: none;
    width: 2.25rem;
    min-width: 2.25rem;
    max-width: 2.5rem;
    text-align: center;
    vertical-align: middle;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
}
.deals-list-page.is-select-mode .deals-select-col {
    display: table-cell;
}
.deals-select-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
}
.deals-list-page.is-select-mode tr[data-deal-id].is-deal-selected {
    background: color-mix(in srgb, #0f766e 8%, var(--surface));
}
.deals-list-select-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem 1rem;
    width: 100%;
    max-width: 42rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.deals-list-select-bar[hidden] {
    display: none !important;
}
.deals-list-select-bar__count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}
.deals-list-select-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}
.deal-combine-modal__card {
    max-width: 28rem;
}
.deal-combine-modal__intro {
    margin: 0 0 0.5rem;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--muted);
}
.deal-combine-modal__selected {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    word-break: break-word;
}
.deal-combine-fieldset {
    margin: 0 0 1rem;
    padding: 0;
    border: none;
}
.deal-combine-legend {
    padding: 0;
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.deal-combine-mode {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 0.45rem 0 0.35rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}
.deal-combine-existing,
.deal-combine-new {
    margin: 0 0 0.65rem 1.45rem;
}
.deal-combine-existing__list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.deal-combine-target-option {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}
.deal-combine-modal__actions {
    margin-top: 0.25rem;
}

.deals-table--easy {
    table-layout: fixed;
    width: auto;
    min-width: 77rem;
    font-size: 0.75rem;
}
.deals-table--easy:has(.deals-easy-col-spread) {
    min-width: 102rem;
}
/* Multi–channel-FX (combined deals): stack each sell→buy pair */
.deals-table--easy .deals-easy-col-fx--legs {
    white-space: pre-line;
    line-height: 1.35;
    vertical-align: top;
}
.deals-table--easy .deals-easy-col-rate--legs {
    white-space: normal;
    line-height: 1.35;
    vertical-align: top;
}
.deals-table--easy thead th {
    background: var(--table-header-bg);
    box-shadow: 0 1px 0 var(--border);
}
.deals-table--easy th {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.01em;
    text-transform: none;
    white-space: nowrap;
}
.deals-table--easy td {
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deals-table--easy .deal-uid {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}
.deals-table--easy .deals-easy-col-deal {
    width: 16.5rem;
    min-width: 16.5rem;
    max-width: 16.5rem;
    overflow: visible;
    text-overflow: clip;
}
.deals-table--easy .deal-cell-head--easy {
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.deals-table--easy .deal-cell-identity--easy {
    min-width: 0;
    flex: 1 1 auto;
}
.deals-table--easy .deal-cell-head--easy .deal-uid {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.deals-table--easy .deal-cell-identity--easy .deal-date {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    margin-top: 0.1rem;
    white-space: nowrap;
}
.deals-table--easy .deals-easy-col-party {
    width: 9rem;
    min-width: 9rem;
    max-width: 9rem;
}
.deals-table--easy .deals-easy-col-fx {
    width: 15.5rem;
    min-width: 15.5rem;
    max-width: 15.5rem;
}
.deals-table--easy .deals-easy-col-rate {
    width: 5.25rem;
    min-width: 5.25rem;
    max-width: 5.25rem;
    font-variant-numeric: tabular-nums;
    white-space: normal;
    line-height: 1.25;
    vertical-align: middle;
}
.deals-table--easy .deals-easy-rate-bracket {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.05rem;
}
.deals-table--easy .deals-easy-col-spread {
    width: 12.5rem;
    min-width: 12.5rem;
    max-width: 12.5rem;
    white-space: normal;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
    overflow: visible;
    text-overflow: clip;
}
.deals-table--easy td.deals-easy-col-spread {
    overflow: visible;
    text-overflow: clip;
}
.deals-table--easy .deals-easy-col-status {
    width: 4.25rem;
    min-width: 4.25rem;
    max-width: 4.25rem;
}
.deals-table--easy .deals-easy-col-status .status-badge {
    font-size: 0.62rem;
    padding: 0.12rem 0.3rem;
    letter-spacing: 0.02em;
}
.deals-table--easy .deals-easy-col-entries {
    width: 4.25rem;
    min-width: 4.25rem;
    max-width: 4.25rem;
    font-variant-numeric: tabular-nums;
}
.deals-table--easy .deals-easy-col-refs {
    width: 8rem;
    min-width: 8rem;
    max-width: 8rem;
    white-space: normal;
    vertical-align: middle;
    line-height: 1.35;
}
.deals-table--easy .deals-easy-col-refs.deal-refs span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.deals-table--easy .deals-easy-spread {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    line-height: 1.25;
}
.deals-table--easy .deals-easy-spread span {
    display: block;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}
.deals-table--easy .deals-easy-spread .hint {
    font-size: 0.68rem;
}
.deals-table--easy .deals-easy-row--alt td {
    background: var(--deal-band-alt);
}
.deals-table--easy .deals-easy-row:hover td {
    background: var(--deal-band-hover);
}
.deals-table--easy .deals-easy-row--alt:hover td {
    background: var(--deal-band-alt-hover);
}
.deal-expand-toggle {
    flex: 0 0 auto;
}
.deal-expand-toggle__icon {
    display: inline-flex;
    transition: transform 0.2s ease;
}
.deal-expand-toggle.is-expanded .deal-expand-toggle__icon {
    transform: rotate(180deg);
}
.deals-list-expand-row > td {
    padding: 0;
    background: #f1f5f9;
    border-top: none;
    vertical-align: top;
    white-space: normal;
    overflow: hidden;
}
.deals-list-expand-row:not(.deals-list-expand-row--closed) > td:has(.app-collapse-grid:not(.is-open)) {
    border: none;
    background: transparent;
}
.deals-list-expand-row--closed {
    visibility: collapse;
}
.deals-list-expand-row--closed > td {
    padding: 0;
    height: 0;
    line-height: 0;
    border: none;
    background: transparent;
    overflow: hidden;
}
.deal-list-entries-panel .deal-entries-table tbody tr:hover,
.deal-list-entries-panel .deal-entry-row--editable:hover {
    background: transparent;
}
.deal-list-entries-panel .deal-entry-fx-amount {
    display: block;
    white-space: nowrap;
}
.deal-list-entries-panel .entry-amount .deal-entry-rate {
    display: block;
    margin-top: 0.1rem;
}

.deal-list-entries-panel {
    padding: 0 0 0.65rem 0.75rem;
}
.deal-list-entries-panel__table.table-panel {
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}
.deal-list-entries-panel .deal-entries-table {
    font-size: 0.78rem;
    /* Lets percentage heights on cells/inners resolve to full row height */
    height: 1px;
}
.deal-list-entries-panel .deal-entries-table tbody tr {
    height: 100%;
}
/* Leg column ~15% tighter than prior unconstrained badge strip (~8.3rem → ~7.05rem) */
.deal-list-entries-panel .deal-entries-table th.deal-col-leg,
.deal-list-entries-panel .deal-entries-table td.deal-entry-leg {
    width: 7.05rem;
    max-width: 7.05rem;
    box-sizing: border-box;
}
.deal-list-entries-panel .deal-entry-leg {
    white-space: normal;
}
.deal-list-entries-panel .deal-entry-leg .type-badge,
.deal-list-entries-panel .deal-entry-leg .tx-badge {
    margin-bottom: 0.12rem;
}
.deal-list-entries-panel .deal-entries-batch-actions {
    margin-top: 0.65rem;
    margin-right: 0;
    padding-right: 0;
}
/* Dependent cell: fill full row height even when empty */
.deal-list-entries-panel .deal-entry-dependent {
    vertical-align: top;
    height: 100%;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}
.deal-list-entries-panel .deal-entry-dependent__inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.2rem;
    min-height: 2.75rem;
    height: 100%;
    box-sizing: border-box;
}
.deal-list-entries-panel .deal-entry-dependent__inner--empty {
    justify-content: center;
    align-items: center;
}
.deal-list-entries-panel .deal-entry-dependent-empty {
    color: var(--muted);
    line-height: 1;
}
.deal-list-entries-panel .deal-entry-dependent-role {
    align-self: flex-start;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.3;
}
.deal-list-entries-panel .deal-entry-dependent-name {
    align-self: flex-end;
    text-align: right;
    line-height: 1.25;
}
.deal-entry-edit-drawer__panel {
    width: min(94vw, calc(100vw - 0.5rem));
}
@media (min-width: 768px) {
    .deal-entry-edit-drawer__panel {
        width: min(72rem, calc(100vw - 1rem));
    }
}
.deal-entry-edit-drawer__body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 1rem 1rem;
}
.deal-entry-edit-drawer__head {
    padding: 0.85rem 1rem;
}
.deal-entry-edit-drawer .deal-entry-edit-modal__frame {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
}
body.deal-entry-edit-open {
    overflow: hidden;
}
.deal-bulk-edit-drawer.entity-quick-view-drawer .entity-quick-view-drawer__backdrop {
    transition: opacity 0.28s ease;
}
.deal-bulk-edit-drawer.entity-quick-view-drawer .entity-quick-view-drawer__panel {
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.deal-bulk-edit-drawer__panel {
    max-width: min(72rem, 100vw);
}
@media (min-width: 768px) {
    .deal-bulk-edit-drawer.entity-quick-view-drawer .entity-quick-view-drawer__panel {
        width: min(72rem, calc(100vw - 1rem));
    }
}
.deal-bulk-edit-drawer__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.85rem 1rem 1.15rem;
    font-size: 0.8125rem;
}
body.deal-bulk-edit-open {
    overflow: hidden;
}
.deal-bulk-edit-layout--stacked {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.deal-bulk-edit-layout__details {
    padding: 0.75rem;
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
    background: var(--surface-muted, #f8fafc);
}
.deal-bulk-edit-entity-columns--stacked {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}
@media (max-width: 720px) {
    .deal-bulk-edit-entity-columns--stacked {
        grid-template-columns: 1fr;
    }
}
.deal-bulk-edit-layout__details .wizard-section-head {
    margin-bottom: 0.65rem;
}
.deal-bulk-edit-entity-columns {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.deal-bulk-edit-entity-columns .wizard-entity-columns__col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.deal-bulk-edit-meta {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-subtle, #e2e8f0);
}
.deal-bulk-edit-meta-grid {
    margin-top: 0.5rem;
}
.deal-bulk-edit-form__inner--compact {
    font-size: 0.8125rem;
    line-height: 1.4;
}
.deal-bulk-edit-form__inner--compact .form-input,
.deal-bulk-edit-form__inner--compact select.form-input,
.deal-bulk-edit-form__inner--compact textarea.form-input {
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
    min-height: 2rem;
}
.deal-bulk-edit-form__inner--compact label,
.deal-bulk-edit-form__inner--compact .entity-picker label {
    font-size: 0.75rem;
}
.deal-bulk-edit-form__inner--compact .wizard-section h2,
.deal-bulk-edit-form__inner--compact .deal-bulk-edit-section-title {
    font-size: 0.875rem;
}
.deal-bulk-edit-form__inner--compact .wizard-section-head .hint,
.deal-bulk-edit-form__inner--compact .hint,
.deal-bulk-edit-form__inner--compact .wizard-mode-bar__hint {
    font-size: 0.7rem;
}
.deal-bulk-edit-form__inner--compact .leg-badge {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.7rem;
}
.deal-bulk-edit-form__inner--compact .wizard-section {
    padding: 0.65rem 0.75rem;
}
.deal-bulk-edit-form__inner--compact .amount-input-wrap .amount-ccy {
    font-size: 0.7rem;
}
.deal-bulk-edit-form__inner--compact .deal-bulk-edit-cp-toggle {
    font-size: 0.8125rem;
    padding: 0.5rem 0.65rem;
}
.deal-bulk-edit-form__warnings {
    font-size: 0.75rem;
    margin-bottom: 0.65rem;
}
.deal-bulk-edit-fx-row .wizard-section--cp.deal-bulk-edit-cp-fx {
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
}
.deal-bulk-edit-form__inner--compact .deal-bulk-edit-rate-pair .rate-label {
    font-size: 0.7rem;
    min-width: 6.5rem;
}
.deal-bulk-edit-form__inner--compact .deal-bulk-edit-rate-pair .rate-input {
    flex: 1;
    min-width: 0;
}
.deal-edit-choice-modal .modal-card {
    max-width: 28rem;
}
.deal-edit-choice-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.deal-bulk-edit-form__actions {
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0;
    background: var(--surface, #fff);
    border-top: 1px solid var(--border-subtle, #e2e8f0);
    margin-top: 1rem;
}
.deal-bulk-edit-entry {
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
    margin-bottom: 0.75rem;
}
.deal-bulk-edit-entry.is-highlighted {
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 1px var(--accent, #2563eb);
}
.deal-bulk-edit-entry__head,
.deal-bulk-edit-entry__toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    text-align: left;
    background: var(--surface-muted, #f8fafc);
    border: 0;
    cursor: pointer;
}
.deal-bulk-edit-entry__body {
    padding: 0.75rem 0.85rem 0.85rem;
}
.deal-bulk-edit-entry--cp .deal-bulk-edit-entry__body {
    border-top: 1px solid var(--border-subtle, #e2e8f0);
}
.deal-bulk-edit-cp-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--surface-muted, #f8fafc);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
}
.balance-mtm-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: stretch;
    overflow: visible;
}
.balance-mtm-stat {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.7rem 0.85rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-sizing: border-box;
    /* Label top-left; figure bottom-right (balances + shared base) */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 5.25rem;
}
.balance-mtm-summary > .balance-mtm-stat .balance-mtm-label {
    margin-bottom: 0;
}
.balance-mtm-summary > .balance-mtm-stat .balance-mtm-value {
    margin-top: auto;
    margin-left: auto;
    padding-top: 0.55rem;
    text-align: right;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
/* Live settle: hide intermediate numbers; steady soft track + progress shimmer */
.balance-mtm-value.is-live-settling {
    position: relative;
    color: transparent !important;
    text-shadow: none;
    min-width: 5rem;
    min-height: 1.15em;
    pointer-events: none;
    user-select: none;
}
/* Persistent track (no opacity flash) */
.balance-mtm-value.is-live-settling::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0.14em;
    width: min(100%, 5.75rem);
    height: 0.7em;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border, #e2e8f0) 88%, var(--surface-muted, #f1f5f9));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border, #e2e8f0) 70%, transparent);
}
/* Indeterminate progress highlight sliding on the track */
.balance-mtm-value.is-live-settling::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0.14em;
    width: min(100%, 5.75rem);
    height: 0.7em;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 35%,
        color-mix(in srgb, var(--primary, #2563eb) 28%, transparent) 50%,
        transparent 65%,
        transparent 100%
    );
    background-size: 220% 100%;
    background-repeat: no-repeat;
    animation: balance-mtm-settle-progress 1.35s linear infinite;
    opacity: 1;
}
.balance-mtm-summary.is-live-settling .balance-mtm-stat--has-tip:not([data-balance-stat-cached]) {
    cursor: progress;
}
@keyframes balance-mtm-settle-progress {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .balance-mtm-value.is-live-settling::after {
        animation: none;
        background: color-mix(in srgb, var(--primary, #2563eb) 18%, transparent);
        width: 45%;
        right: 0;
        margin-right: 0;
        left: auto;
    }
}
[data-theme="dark"] body.app-body .balance-mtm-value.is-live-settling::before {
    background: color-mix(in srgb, #334155 75%, #0f172a);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #475569 50%, transparent);
}
[data-theme="dark"] body.app-body .balance-mtm-value.is-live-settling::after {
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 35%,
        color-mix(in srgb, #60a5fa 32%, transparent) 50%,
        transparent 65%,
        transparent 100%
    );
    background-size: 220% 100%;
}
.balance-mtm-summary > .balance-mtm-stat.balance-mtm-stat--primary .balance-mtm-value,
.balance-mtm-summary > .balance-mtm-stat.balance-mtm-stat--total .balance-mtm-value {
    font-size: 1.18rem;
}
.balance-mtm-summary > .balance-mtm-live-warn {
    flex: 1 1 100%;
    min-height: 0;
}
.balance-mtm-stat--has-tip {
    position: relative;
    cursor: help;
    /* Tips render outside the card box */
    overflow: visible;
    z-index: 1;
}
.balance-mtm-stat--has-tip:hover,
.balance-mtm-stat--has-tip:focus-within {
    z-index: 40;
}
/* Open below the card so top-of-page (balances/dashboard) tips are not clipped */
.balance-mtm-tip {
    position: absolute;
    left: 50%;
    top: calc(100% + 0.45rem);
    bottom: auto;
    transform: translateX(-50%) translateY(-0.25rem);
    min-width: 11rem;
    max-width: 14rem;
    padding: 0.45rem 0.6rem;
    border-radius: 0.45rem;
    background: var(--text, #1a1d23);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 50;
}
.balance-mtm-tip::after {
    content: "";
    position: absolute;
    bottom: 100%;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    border: 0.35rem solid transparent;
    border-bottom-color: var(--text, #1a1d23);
    border-top-color: transparent;
}
.balance-mtm-stat--has-tip:hover .balance-mtm-tip,
.balance-mtm-stat--has-tip:focus-within .balance-mtm-tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.balance-mtm-stat--has-tip .balance-mtm-tip {
    min-width: 12.5rem;
    max-width: 16.5rem;
    text-align: left;
}
.balance-mtm-live-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.2rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #b45309;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
    cursor: help;
}
.balance-mtm-stat--live-risk {
    border-color: #fcd34d;
    background: color-mix(in srgb, #fef3c7 45%, var(--surface, #fff));
}
/* Beat primary Total blue and dashboard value defaults when risk is on */
.balance-mtm-stat--live-risk .balance-mtm-value,
.balance-mtm-stat.balance-mtm-stat--primary.balance-mtm-stat--live-risk .balance-mtm-value,
.balance-mtm-summary--dashboard .balance-mtm-stat--live-risk .balance-mtm-value,
.balance-mtm-summary--dashboard .balance-mtm-stat--primary.balance-mtm-stat--live-risk .balance-mtm-value {
    color: #9a3412;
}
.balance-mtm-stat--live-risk .balance-mtm-live-flag {
    display: inline-flex;
}
.balance-mtm-live-warn {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.15rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.55rem;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.78rem;
    line-height: 1.4;
}
.balance-mtm-live-warn[hidden] {
    display: none !important;
}
.balance-mtm-live-warn__mark {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: #f59e0b;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}
.balance-mtm-live-warn__link {
    margin-left: 0.35rem;
    font-weight: 600;
    color: #b45309;
    text-decoration: underline;
}
[data-theme="dark"] body.app-body .balance-mtm-live-flag {
    background: color-mix(in srgb, #f59e0b 35%, #1e293b);
    color: #fcd34d;
}
[data-theme="dark"] body.app-body .balance-mtm-stat--live-risk {
    border-color: color-mix(in srgb, #f59e0b 55%, #334155);
    background: color-mix(in srgb, #f59e0b 12%, var(--surface, #0f172a));
}
[data-theme="dark"] body.app-body .balance-mtm-stat--live-risk .balance-mtm-value {
    color: #fdba74;
}
[data-theme="dark"] body.app-body .balance-mtm-live-warn {
    border-color: color-mix(in srgb, #f59e0b 50%, #334155);
    background: color-mix(in srgb, #f59e0b 14%, #0f172a);
    color: #fde68a;
}
[data-theme="dark"] body.app-body .balance-mtm-live-warn__link {
    color: #fbbf24;
}
.balance-mtm-stat--primary {
    border-color: #93c5fd;
    background: var(--primary-soft);
}
.balance-mtm-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.15rem;
}

.balance-mtm-value {
    display: block;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.balance-mtm-stat--primary .balance-mtm-value {
    font-size: 1.05rem;
    color: #1d4ed8;
}
/* Balances grid: full figures, grow wide, horizontal scroll when needed */
.table-panel.balance-table-panel {
    overflow: hidden;
}
.table-panel.balance-table-panel > .table-panel__scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
.balance-table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    --balance-col-entity: 12rem;
    --balance-col-mtm: 10.5rem;
    /* Room for "U " / "P " + large amounts with grouping + decimals */
    --balance-col-ccy: 14rem;
}
.balance-table .col-sticky {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 2;
    width: var(--balance-col-entity);
    min-width: var(--balance-col-entity);
    max-width: var(--balance-col-entity);
    box-shadow: 1px 0 0 var(--border);
}
.balance-table td.col-sticky a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}
.balance-table .col-sticky-mtm {
    position: sticky;
    left: var(--balance-col-entity);
    background: var(--surface);
    z-index: 2;
    width: var(--balance-col-mtm);
    min-width: var(--balance-col-mtm);
    max-width: none;
    box-shadow: 1px 0 0 var(--border);
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-left: 1.75rem;
}
.balance-table td.col-sticky-mtm {
    position: sticky;
}
.balance-table td.col-sticky-mtm .balance-mtm-badges {
    position: absolute;
    left: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    gap: 0.1rem;
    line-height: 1;
}
.balance-table .col-sticky-mtm .mtm-value {
    display: block;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.balance-table .col-ccy {
    width: auto;
    min-width: var(--balance-col-ccy);
    max-width: none;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    overflow: visible;
    white-space: nowrap;
}
.balance-table th.col-ccy {
    white-space: nowrap;
}
.balance-table .balance-bucket-line {
    display: block;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.balance-table thead .col-sticky,
.balance-table thead .col-sticky-mtm {
    z-index: 4;
}
.balance-table td.col-sticky .hint {
    display: block;
    font-size: 0.68rem;
    margin-top: 0.1rem;
}
.num-negative {
    color: #dc2626;
    font-weight: 700;
}

.deal-spread .num-negative.hint {
    color: #ef4444;
    font-weight: 700;
}

.deal-flow-negative-notice {
    color: #dc2626;
    font-size: 0.74rem;
    font-weight: 600;
}

/* Zero / near-zero amounts (0.00, ±0.0x) — light grey on balances page */
.balance-table .num-dim,
.balance-table .mtm-value.num-dim,
.balance-table .balance-bucket-line.num-dim,
.balance-mtm-value.num-dim {
    color: #cbd5e1;
    font-weight: 400;
}
.balance-table .balance-bucket-line.num-dim {
    opacity: 0.9;
}

.balance-missing-rates-alert {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.85rem;
    line-height: 1.45;
}
.balance-missing-rates-alert__lead {
    margin: 0 0 0.45rem;
    font-weight: 600;
}
.balance-missing-rates-alert__action {
    margin: 0;
}
.balance-missing-rates-alert a {
    color: #b45309;
    font-weight: 600;
}
.balance-stale-alert {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.85rem;
    line-height: 1.45;
}
.balance-stale-alert__lead {
    margin: 0 0 0.45rem;
    font-weight: 600;
}
.balance-stale-alert__action {
    margin: 0;
}
.balance-table-footnote {
    margin: 0.75rem 0 0;
    max-width: 42rem;
    line-height: 1.45;
}

h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-bottom: 1.5rem; }

.login-card {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.login-card h1 { margin-bottom: 0.25rem; }
.login-card .subtitle { margin-bottom: 1.5rem; }

.field { text-align: left; margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--input-border, var(--border));
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--input-bg, var(--surface));
    color: var(--text);
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.field-error { color: var(--danger); font-size: 0.8rem; }

/* Buttons — Flowbite-inspired variants on plain CSS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn:disabled,
.btn[disabled] {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-primary:disabled,
.btn-primary[disabled] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-secondary:disabled,
.btn-secondary[disabled] {
    background: var(--surface);
    border-color: var(--border);
    color: var(--muted);
}
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover {
    background: var(--bg);
    border-color: #94a3b8;
}
.btn-sample {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.12);
}
.btn-sample:hover {
    background: #bae6fd;
    border-color: #38bdf8;
    color: #075985;
}
.btn-sample:focus-visible {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.28);
}
.btn-sample .btn__icon,
.btn-sample .btn__label {
    color: inherit;
}
body:not(.mk-marketing-body) .btn-sample {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
}
body:not(.mk-marketing-body) .btn-sample:hover {
    background: #bae6fd;
    border-color: #38bdf8;
    color: #075985;
}
.btn-outline {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-outline:hover {
    background: var(--bg);
    border-color: #94a3b8;
}
.btn-outline-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: #fecaca;
}
.btn-outline-danger:hover {
    background: var(--danger-soft);
    border-color: #fca5a5;
    color: var(--danger-hover);
}
.btn-outline-danger:focus-visible {
    box-shadow: var(--focus-ring-danger);
}
.btn-danger {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
}
.btn-danger:hover,
.btn-danger:focus {
    background: #b91c1c;
    border-color: #991b1b;
    color: #fff;
}
.btn-danger:disabled,
.btn-danger[disabled] {
    background: #fca5a5;
    border-color: #fca5a5;
    color: #fff;
    cursor: not-allowed;
}
/* Material Deep Orange — used for entity Suspend (distinct from red Delete) */
.btn-deep-orange {
    background: #ff5722;
    border-color: #e64a19;
    color: #fff;
}
.btn-deep-orange:hover,
.btn-deep-orange:focus {
    background: #f4511e;
    border-color: #d84315;
    color: #fff;
}
.btn-deep-orange:disabled,
.btn-deep-orange[disabled] {
    background: #ffab91;
    border-color: #ffab91;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.85;
}
.btn-ghost {
    background: transparent;
    color: var(--primary);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--primary-soft);
}
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}
.btn-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: none;
}
.btn-xs {
    padding: 0.3rem 0.65rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}
.btn__icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}
.btn-xs .btn__icon {
    width: 0.9em;
    height: 0.9em;
}
.btn__label {
    line-height: 1.2;
}
body:not(.mk-marketing-body) .btn:not(.btn-link):not(.btn-ghost) {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
body:not(.mk-marketing-body) .btn-secondary,
body:not(.mk-marketing-body) .btn-outline,
body:not(.mk-marketing-body) .btn-outline-danger {
    background: var(--surface);
}
body:not(.mk-marketing-body) .btn:not(.btn-link):not(.btn-ghost):not(:disabled):not([disabled]):hover {
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.09);
}
body:not(.mk-marketing-body) .btn.btn:not(.btn-primary):not(.btn-secondary):not(.btn-sample):not(.btn-danger):not(.btn-deep-orange):not(.btn-outline):not(.btn-outline-danger):not(.btn-ghost):not(.btn-link) {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.login-card .btn-primary { width: 100%; }

/* Subscription conversion page (trial expired) */
.container--subscribe {
    max-width: 920px;
}
.subscribe-page {
    padding: 2rem 0 3rem;
}
.subscribe-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.subscribe-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
}
.subscribe-hero h1 {
    margin: 0 0 0.75rem;
    font-size: 2rem;
    line-height: 1.2;
}
.subscribe-lead {
    margin: 0 auto;
    max-width: 36rem;
    font-size: 1.05rem;
    color: #475569;
    line-height: 1.5;
}
.subscribe-section-title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}
.subscribe-benefits {
    margin-bottom: 2rem;
}
.subscribe-benefit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}
.subscribe-benefit-card {
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.subscribe-benefit-card h3 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}
.subscribe-benefit-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.45;
}
.subscribe-plans {
    margin-bottom: 2rem;
}
.subscribe-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}
.subscribe-plan-card {
    padding: 1rem 1.1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.subscribe-plan-card--featured {
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}
.subscribe-plan-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}
.subscribe-plan-seats {
    margin: 0 0 0.35rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}
.subscribe-plan-desc {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}
.subscribe-plan-note {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}
.subscribe-cta {
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    text-align: center;
}
.subscribe-cta p {
    margin: 0 0 1.25rem;
    font-size: 0.92rem;
    color: #475569;
    line-height: 1.5;
}
.subscribe-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}
@media (max-width: 720px) {
    .subscribe-benefit-grid,
    .subscribe-plan-grid {
        grid-template-columns: 1fr;
    }
    .subscribe-hero h1 {
        font-size: 1.55rem;
    }
}

/* Compact row actions (entries list, deal detail, etc.) */
.ui-action-cell {
    white-space: nowrap;
    text-align: right;
    vertical-align: top;
}
.ui-action-group {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0;
}
.ui-action-form {
    display: inline-flex;
    margin: 0;
}

.error-box {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.card h3 { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; }
.stat { font-size: 2rem; font-weight: 700; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 0.5rem 1rem; font-size: 0.95rem; }
.detail-list dt { color: var(--muted); font-weight: 600; }

.messages { list-style: none; margin-bottom: 1rem; }
.message { padding: 0.75rem; border-radius: var(--radius); margin-bottom: 0.5rem; }
.message.success { background: #ecfdf5; color: #065f46; }
.message.error { background: #fef2f2; color: var(--danger); }
.message.warning, .message.warn { background: #fffbeb; color: #92400e; }
.message.info { background: #eff6ff; color: #1e40af; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.btn-group { display: flex; gap: 0.5rem; }
.filter-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar .form-input { width: auto; min-width: 140px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.data-table a { color: var(--primary); text-decoration: none; }

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 600px; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.form-card .field select, .form-card .field textarea, .form-card .field input { width: 100%; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); }

.tabs { display: flex; gap: 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tab { padding: 0.6rem 1rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Settings — SaaS company admin layout */
.container--settings {
    max-width: 2560px;
}
.settings-page {
    /* Inner section headings (Test deal, Channel confirmation, etc.) */
    --settings-inner-heading: #5aabf1;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    gap: 1.5rem;
    align-items: start;
}
.settings-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 1rem;
}
.settings-page-header {
    grid-area: header;
    margin-bottom: 0;
}
.settings-main {
    grid-area: main;
    min-width: 0;
}
/* Desktop: section name as title (General, Account, …) */
.settings-page-header__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
}
.settings-page-header__title-root {
    display: none;
}
.settings-page-header__title-section {
    display: inline;
}
.settings-company-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
}
.settings-company-label {
    margin: 0 0 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.settings-company-name {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}
/* Desktop default: link list; mobile dropdown is shown under 860px */
.settings-nav-mobile {
    display: none;
}
.settings-nav-desktop {
    display: block;
}
.settings-nav-group + .settings-nav-group {
    margin-top: 1.1rem;
}
.settings-nav-label {
    margin: 0 0 0.35rem;
    padding: 0 0.65rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* Brand violet — aligns with --fx-nav-accent / module headers */
    color: var(--settings-nav-label, #7534df);
}
.settings-nav-link {
    display: block;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    line-height: 1.3;
}
.settings-nav-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}
.settings-nav-link.is-active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}
.settings-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.35rem;
}
.settings-page-header h1,
.settings-page-header__title {
    margin: 0;
    font-size: 1.5rem;
}
.settings-page-subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
    max-width: 42rem;
}
.settings-page-subtitle a {
    color: var(--primary);
    text-decoration: none;
}
.settings-page .form-input,
.settings-page select.form-input,
.settings-page textarea.form-input {
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
}
.settings-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
/* Preferences: topic tabs (Operations / Messages / KYC) */
.settings-prefs-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: -0.15rem 0 1.1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.settings-prefs-tabs__btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.settings-prefs-tabs__btn:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 40%, #e2e8f0);
}
.settings-prefs-tabs__btn.is-active {
    color: #0f766e;
    background: color-mix(in srgb, #0f766e 12%, var(--surface));
    border-color: color-mix(in srgb, #0f766e 35%, var(--border));
}
.settings-prefs-tabs__btn:focus-visible {
    outline: 2px solid #5eead4;
    outline-offset: 2px;
}
.settings-prefs-panel__intro {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--muted);
    max-width: 42rem;
}
.settings-prefs__actions {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.settings-panel + .settings-panel {
    margin-top: 1rem;
}
.settings-panel--flush {
    padding: 0;
    overflow: hidden;
}
.settings-panel-title {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--settings-inner-heading, #5aabf1);
}
.settings-toggle-form {
    margin: 0;
}
.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.settings-toggle__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.settings-toggle__track {
    position: relative;
    width: 2.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.15s;
}
.settings-toggle__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
    transition: transform 0.15s;
}
.settings-toggle__input:checked + .settings-toggle__track {
    background: #2563eb;
}
.settings-toggle__input:checked + .settings-toggle__track::after {
    transform: translateX(1rem);
}
.settings-toggle__input:focus-visible + .settings-toggle__track {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.settings-toggle__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    min-width: 1.5rem;
}
.settings-pairs-fetch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.settings-pairs-fetch-btn__icon {
    width: 1rem;
    height: 1rem;
}
.settings-pairs-table th,
.settings-pairs-table td {
    padding: 0.5rem 0.75rem;
}
.settings-pairs-table__row--manual {
    background: #fffbeb;
}
.settings-pairs-table__row--manual:hover {
    background: #fef3c7;
}
.settings-pairs-table__pair {
    display: inline-flex;
    align-items: baseline;
    gap: 0.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.settings-pairs-table__ccy {
    color: #0f172a;
}
.settings-pairs-table__sep {
    color: var(--muted);
    font-weight: 500;
}
.settings-pairs-table__rate {
    font-weight: 600;
    color: #0f172a;
}
.settings-pairs-table__source {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.settings-pairs-table__stale {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #b91c1c;
}
.settings-pairs-table__time {
    white-space: nowrap;
    font-size: 0.78rem;
}
.settings-pairs-table__empty {
    padding: 1.25rem 0.75rem !important;
}
.settings-toggle--compact .settings-toggle__track {
    width: 2rem;
    height: 1.1rem;
}
.settings-toggle--compact .settings-toggle__track::after {
    width: 0.85rem;
    height: 0.85rem;
}
.settings-toggle--compact .settings-toggle__input:checked + .settings-toggle__track::after {
    transform: translateX(0.85rem);
}
.settings-toggle--compact .settings-toggle__label {
    font-size: 0.75rem;
    min-width: 1.35rem;
}
.settings-pairs-manual-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}
.settings-pairs-manual-form__input {
    width: 6.5rem;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}
.settings-pairs-add {
    margin-top: 1rem;
}
.settings-pairs-add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.settings-pairs-add-form__select {
    width: auto;
    min-width: 5.5rem;
}
.settings-pairs-add-form__slash {
    color: var(--muted);
    font-weight: 600;
}
.settings-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.settings-overview-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.settings-overview-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08);
}
.settings-overview-card__label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}
.settings-overview-card__value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
}
.settings-overview-card__hint {
    font-size: 0.75rem;
    color: var(--muted);
}
.settings-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}
.settings-link-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    background: #f8fafc;
}
.settings-link-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.settings-link-card strong {
    font-size: 0.9rem;
    color: #0f172a;
}
.settings-link-card span {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}
.settings-io-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
}
.settings-io-group {
    padding: 1rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f8fafc 0%, var(--surface) 100%);
}
.settings-io-group__title {
    margin: 0 0 0.35rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--settings-inner-heading, #5aabf1);
}
.settings-io-group__desc {
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--muted);
}
.settings-io-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.settings-form-section + .settings-form-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.settings-form-section-title {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--settings-inner-heading, #5aabf1);
}
/* Shared accent for all settings inner section headings (preferences, account, shop TV, …). */
.settings-page .settings-form-section-title,
.settings-page .settings-panel-title:not(.settings-panel-title--danger),
.settings-page .settings-io-group__title,
.settings-page .settings-template-reference__title,
.settings-page .settings-role-card__title,
.settings-page .settings-role-visibility__title,
.settings-page .settings-role-perms__title,
.settings-page .shop-tv-layout-group__title {
    color: var(--settings-inner-heading, #5aabf1);
}
.settings-form-section-desc {
    margin: -0.45rem 0 0.85rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}
.settings-form-grid--single {
    grid-template-columns: minmax(0, 1fr);
    max-width: 420px;
}
.settings-form-grid--triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.settings-form-grid .field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.settings-form-grid .field .form-input {
    width: 100%;
}
.field-hint {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.35;
}
.settings-form-notice {
    margin: 0.85rem 0 0;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid #fde68a;
    background: #fffbeb;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #92400e;
}
.settings-template-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
}
/* Messages & receipts: editor | placeholders side-by-side */
.settings-template-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.95fr);
    gap: 1rem 1.15rem;
    align-items: stretch;
}
.settings-template-compose__editor {
    margin: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.settings-template-compose__editor .settings-template-input {
    flex: 1 1 auto;
    min-height: 18rem;
    width: 100%;
    resize: vertical;
}
.settings-template-compose__ref {
    margin-top: 0;
    min-width: 0;
    max-height: min(36rem, 70vh);
    overflow: auto;
}
@media (max-width: 900px) {
    .settings-template-compose {
        grid-template-columns: 1fr;
    }
    .settings-template-compose__ref {
        max-height: min(22rem, 50vh);
    }
}
.settings-template-reference {
    margin-top: 1rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid #dbeafe;
    border-radius: var(--radius);
    background: #f8fafc;
}
.settings-template-compose__ref.settings-template-reference {
    margin-top: 0;
}
.settings-template-reference__title {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--settings-inner-heading, #5aabf1);
}
.settings-template-reference__title + .settings-template-reference__title {
    margin-top: 1rem;
}
.settings-template-placeholders {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(9rem, auto) 1fr;
    gap: 0.35rem 0.75rem;
    font-size: 0.74rem;
}
.settings-template-placeholders dt {
    margin: 0;
}
.settings-template-placeholders dd {
    margin: 0;
    color: var(--muted);
    line-height: 1.35;
}
.settings-template-placeholders code {
    font-size: 0.72rem;
}
.settings-template-default {
    margin: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    background: #fff;
    font-size: 0.74rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* Preferences → Test deal: directed CCY pair chips */
.settings-test-deal-pairs__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0 0 0.75rem;
}
.settings-test-deal-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.35rem 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border, #d1d5db);
    background: var(--surface-2, #f3f4f6);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.settings-test-deal-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--muted, #6b7280);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0;
}
.settings-test-deal-chip__remove:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text, #111);
}
.settings-test-deal-chip__remove:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.settings-test-deal-pairs__add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.settings-test-deal-pairs__add .form-input {
    width: auto;
    min-width: 7.5rem;
}
.settings-test-deal-pairs__arrow {
    color: var(--muted, #6b7280);
    font-weight: 600;
}
[data-theme="dark"] .settings-test-deal-chip {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .settings-test-deal-chip__remove:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.settings-form-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.settings-inline-action {
    margin: 0;
}
.settings-readonly-note,
.settings-footnote {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.settings-roles-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.settings-role-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.settings-role-card__title {
    margin: 0;
    font-size: 1rem;
    color: var(--settings-inner-heading, #5aabf1);
}
.settings-role-card__code {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    font-family: ui-monospace, monospace;
}
.settings-role-card__desc {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: #475569;
}
.settings-role-suggestion {
    margin-bottom: 0.85rem;
}
.settings-role-suggestion .settings-role-card__desc {
    margin-bottom: 0;
}
.settings-role-visibility {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.settings-role-visibility__title,
.settings-role-perms__title {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--settings-inner-heading, #5aabf1);
}
.settings-role-visibility__row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
}
.settings-role-visibility__area {
    font-weight: 600;
    color: var(--text-secondary);
}
.settings-role-visibility__detail {
    color: var(--muted);
}
.settings-role-perms {
    display: grid;
    gap: 0.45rem;
}
.settings-role-perm-group {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
}
.settings-role-perm-module {
    font-weight: 600;
    color: var(--text-secondary);
}
.settings-role-perm-actions {
    color: var(--muted);
}
.settings-company-seats {
    margin: 0.55rem 0 0.15rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.settings-company-plan {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.settings-seat-pill {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
}
.settings-panel--focused {
    outline: 2px solid #2563eb;
    outline-offset: 4px;
    border-radius: 0.5rem;
    transition: outline-color 0.35s ease;
}

.settings-panel--spaced {
    margin-top: 1rem;
}
.settings-panel--danger {
    border-color: #fecaca;
    background: var(--danger-soft);
}
.settings-panel-title--danger {
    /* Keep danger zone titles red (not the blue inner-heading accent). */
    color: var(--danger);
}
.settings-danger-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.settings-danger-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--danger);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}
.settings-danger-toggle:focus-visible {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
    border-radius: 4px;
}
.settings-danger-toggle__icon {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.settings-danger-toggle__icon.is-collapsed {
    transform: rotate(-45deg);
}
.settings-danger-summary {
    margin: 0;
    padding-left: 1.05rem;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #7f1d1d;
}
.settings-danger-body {
    margin-top: 1rem;
}
.settings-nav-link--danger {
    color: var(--danger);
}
.settings-nav-link--danger:hover,
.settings-nav-link--danger.is-active {
    background: var(--danger-soft);
    color: var(--danger-hover);
}
.settings-danger-lead {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #7f1d1d;
}
.settings-danger-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.settings-danger-block__title {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #991b1b;
}
.settings-danger-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #7f1d1d;
}
.settings-danger-list--kept {
    color: #334155;
}
.settings-danger-phrase {
    margin: 0.35rem 0 0.65rem;
    padding: 0.65rem 0.75rem;
    border: 1px dashed #fca5a5;
    border-radius: var(--radius);
    background: #fff;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #7f1d1d;
}
.settings-danger-form__label {
    font-weight: 600;
    color: #7f1d1d;
}
.settings-danger-form__input {
    min-height: 5rem;
    resize: vertical;
}
.settings-danger-form__actions {
    margin-top: 1rem;
}
.settings-form-grid--add-user {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.settings-user-role-form .form-input {
    min-width: 7rem;
}
.settings-user-actions {
    text-align: right;
    white-space: nowrap;
}
.subscription-banner {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    line-height: 1.4;
}
.subscription-banner--warn {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.subscription-banner--info {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}
.subscription-banner--error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}
.settings-account-section + .settings-account-section {
    margin-top: 1rem;
}
.settings-account-access {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.65rem 1rem;
    margin: 0 0 0.85rem;
}
.settings-account-access--profile {
    margin-bottom: 0;
}
.settings-account-access dt {
    margin: 0 0 0.1rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}
.settings-account-access dd {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
}
.settings-account-perms {
    margin-top: 0.25rem;
}

/* Reports */
.reports-page .page-header h1 {
    font-size: 1.35rem;
}
.reports-tabs {
    margin-bottom: 1rem;
}
.reports-filter {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}
.reports-filter__quota-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.65rem;
}
.reports-filter-ytd-quota {
    flex-shrink: 0;
}
.reports-kpi-stat-label--tip {
    cursor: help;
}
.reports-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.65rem 1rem;
    margin-bottom: 0.65rem;
}
.reports-filter-grid--entity {
    grid-template-columns: 1fr;
    align-items: stretch;
}
.reports-filter-channel {
    min-width: 0;
}
.reports-channel-select {
    appearance: none;
    -webkit-appearance: none;
    min-height: 2.45rem;
    padding: 0.45rem 2.25rem 0.45rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.41 0 6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 12px 8px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.reports-channel-select:hover {
    border-color: #94a3b8;
}
.reports-channel-select:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.reports-channel-select:invalid {
    color: var(--muted);
}
.reports-filter-dates {
    display: flex;
    align-items: end;
    gap: 0.45rem;
    grid-column: span 2;
}
.reports-filter-grid:not(.reports-filter-grid--entity) .reports-filter-dates {
    grid-column: 1 / -1;
}
.reports-filter-dates .field {
    flex: 1;
    min-width: 0;
}
.reports-pending-msg {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}
.reports-range-cancelled {
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.85rem;
    font-weight: 600;
}
.reports-date-input {
    min-height: 2.45rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.reports-date-input:hover {
    border-color: #94a3b8;
}
.reports-date-input:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.reports-filter-grid .field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.reports-filter-dates-block {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    grid-column: 1 / -1;
}
.reports-filter-grid--entity .reports-filter-dates-block {
    grid-column: 1 / -1;
}
.reports-filter-dates-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}
.reports-date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.reports-date-preset {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.reports-date-preset:hover {
    border-color: #94a3b8;
    background: #fff;
}
.reports-date-preset.is-active {
    border-color: var(--primary, #2563eb);
    background: var(--primary, #2563eb);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}
.reports-date-preset:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.reports-date-preset.is-disabled,
.reports-date-preset:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
    box-shadow: none;
}
.reports-date-preset.is-disabled:hover,
.reports-date-preset:disabled:hover {
    border-color: #e2e8f0;
    background: #f1f5f9;
    color: #64748b;
}
.reports-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.reports-filter--loading {
    pointer-events: none;
}
.reports-filter--loading .reports-filter-actions {
    pointer-events: none;
}
.reports-large-range-modal__card h2 {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
}
.reports-large-range-modal__lead {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}
.reports-large-range-modal__actions {
    margin-top: 0;
    justify-content: flex-end;
}
.reports-plan-limit-modal__card h2 {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
}
.reports-plan-limit-modal__lead {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}
.reports-plan-limit-modal__current {
    margin: 0 0 1rem;
}
.reports-plan-limit-modal__choices {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1rem;
}
.reports-plan-limit-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.9rem;
    white-space: normal;
    height: auto;
}
.reports-plan-limit-choice__label {
    font-weight: 600;
    font-size: 0.88rem;
}
.reports-plan-limit-choice__range {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}
.reports-plan-limit-modal__actions {
    margin-top: 0;
    justify-content: flex-end;
    gap: 0.5rem;
}
body.reports-modal-open {
    overflow: hidden;
}
.reports-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.85rem;
}
.reports-panel-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.5rem 0.75rem;
}
.reports-share-copy-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.reports-share-copy-btn {
    flex-shrink: 0;
}
.reports-mso-meta {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.reports-mso-meta li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    line-height: 1.4;
}
.reports-mso-meta__label {
    font-weight: 700;
    color: var(--text);
}
.reports-mso-meta__label::after {
    content: ":";
    font-weight: 700;
}
.reports-mso-meta__value {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}
.reports-mso-side-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
}
.reports-mso-guidance {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.reports-mso-guidance li + li {
    margin-top: 0.35rem;
}
.reports-mso-ready-banner {
    border-left: 3px solid var(--settings-nav-label, #7534df);
}
.reports-mso-stored-hint {
    margin: 0 0 0.75rem;
}
.reports-mso-warn {
    margin: 0.5rem 0 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    background: #fef3c7;
    color: #92400e;
    font-size: 0.88rem;
}
[data-theme="dark"] .reports-mso-warn {
    background: #422006;
    color: #fde68a;
}
.reports-mso-row-unknown td {
    font-style: italic;
}
.reports-entity-balances {
    margin: 0 0 1.15rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.reports-entity-balances__hint {
    margin: 0 0 0.55rem;
}
.reports-entity-balances__panel {
    margin: 0;
}
.reports-entity-balances__table {
    min-width: 100%;
}
.reports-entity-balances__name {
    font-weight: 600;
    display: block;
}
.reports-entity-balances .balance-table-footnote {
    margin-top: 0.45rem;
    margin-bottom: 0;
}
.reports-pagination {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    min-width: min(100%, 18rem);
}
.reports-pagination__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    text-align: right;
}
.reports-pagination__count {
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.reports-pagination__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}
.reports-pagination__page {
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0 0.25rem;
}
.reports-pagination__expand {
    margin-left: 0.15rem;
}
.reports-pagination__single {
    margin: 0 0 0.65rem;
}
.reports-summary-footnote {
    margin-top: 0.45rem;
    font-size: 0.78rem;
}
.reports-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.reports-kpi {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    min-height: 9.5rem;
}
.reports-kpi h3 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    align-self: flex-start;
}
.reports-kpi-body {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    width: 100%;
}
.reports-kpi-body .hint {
    margin-top: 0.35rem;
}
.reports-kpi-value {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.reports-kpi-value--compact {
    font-size: 1.15rem;
    margin-top: 0.45rem;
}
.reports-kpi-inline-label {
    margin: 0.1rem 0 0;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.reports-kpi-sub {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
}
.reports-kpi-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
    width: 100%;
}
.reports-kpi-stats dt {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.1rem;
}
.reports-kpi-stats dd {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.reports-layout {
    display: grid;
    grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
    gap: 0.85rem;
    align-items: start;
}
.reports-layout--entity {
    grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
}
.reports-layout__main {
    min-width: 0;
}
.reports-layout__sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: sticky;
    top: 0.75rem;
    max-height: calc(100vh - 1.5rem);
}
.reports-layout__sidebar .reports-panel {
    margin-bottom: 0;
}
.reports-layout__sidebar .reports-panel--daily {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.reports-sidebar-table-panel {
    overflow-x: auto;
}
.reports-daily-table-panel {
    flex: 1;
    min-height: 0;
}
.reports-table--sidebar {
    font-size: 0.7rem;
}
.reports-table--sidebar th,
.reports-table--sidebar td {
    padding: 0.35rem 0.4rem;
    white-space: nowrap;
}
.reports-panel {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}
.reports-panel-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
}
.reports-table {
    font-size: 0.78rem;
}
.reports-table th,
.reports-table td {
    padding: 0.45rem 0.55rem;
}
.reports-table th.num,
.reports-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.reports-kpi-grid--company {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.reports-ccy-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}
.reports-ccy-list--compact .reports-ccy-figure {
    font-size: 0.92rem;
}
.reports-ccy-list li {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    font-size: 0.85rem;
    padding: 0.2rem 0;
    font-variant-numeric: tabular-nums;
}
.reports-ccy-figure {
    font-weight: 600;
    text-align: right;
    width: 100%;
}
.reports-ccy-code {
    font-weight: 600;
    color: var(--muted);
}
.reports-ccy-list--mtm li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 1rem;
    justify-content: stretch;
}
.reports-ccy-native {
    font-weight: 600;
    font-size: 0.85rem;
    text-align: right;
}
.reports-ccy-mtm {
    text-align: right;
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
}
.reports-kpi-mtm-total {
    margin: 0.5rem 0 0;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border);
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    width: 100%;
}
.reports-kpi-grid--entity {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.reports-kpi--entity .reports-kpi-body--entity {
    font-family: var(--font-mono, ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace);
    font-size: 0.9rem;
    line-height: 1.45;
    letter-spacing: 0.01em;
}
.reports-kpi-lines {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    flex: 1;
}
.reports-kpi-lines--compact .reports-kpi-line {
    font-size: 0.88rem;
}
.reports-kpi-line {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    padding: 0.28rem 0;
    font-variant-numeric: tabular-nums;
}
.reports-kpi-line__ccy {
    font-weight: 600;
    color: var(--text);
    min-width: 2.75rem;
    text-align: right;
}
.reports-kpi-line__amount {
    font-weight: 600;
    color: var(--text);
    text-align: right;
}
.reports-kpi-line__pair {
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
}
.reports-kpi-line__count {
    font-size: 0.82em;
    font-weight: 500;
    color: var(--muted);
}
.reports-kpi-divider {
    width: 100%;
    margin: 0.55rem 0 0.45rem;
    border-top: 1px solid var(--border);
}
.reports-kpi-divider + .reports-kpi-mtm-total {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
.reports-kpi-body--flow {
    font-size: 0.78rem;
    line-height: 1.35;
}
.reports-kpi-body--flow .reports-kpi-line {
    padding: 0.15rem 0;
}
.reports-kpi-body--flow .reports-kpi-line__count {
    font-size: 0.8em;
}
.reports-kpi-body--flow .reports-kpi-divider {
    margin: 0.3rem 0 0.25rem;
}
.reports-kpi-body--flow .reports-kpi-mtm-total {
    font-size: 0.92rem;
    font-weight: 700;
}
.reports-kpi-footer-total {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--muted);
    width: 100%;
}
.reports-panel--shareable {
    background: var(--surface-muted);
}
.reports-deal-breakdown {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}
.reports-deal-breakdown--warn {
    margin: 0 -0.55rem;
    padding: 0.85rem 0.55rem 0.85rem 0.75rem;
    border-left: 3px solid var(--danger);
    background: var(--danger-soft);
    border-bottom-color: #fecaca;
}
.reports-deal-breakdown:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.reports-deal-breakdown--warn:last-child {
    padding-bottom: 0.85rem;
}
.reports-deal-breakdown__title {
    margin: 0 0 0.15rem;
    font-size: 0.95rem;
    font-weight: 700;
}
.reports-deal-breakdown__title a {
    color: inherit;
    text-decoration: none;
}
.reports-deal-breakdown__title a:hover {
    text-decoration: underline;
}
.reports-deal-breakdown__meta {
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    color: var(--muted);
}
.reports-deal-breakdown__flag {
    display: inline-block;
    margin-left: 0.35rem;
    font-weight: 600;
    color: var(--danger);
}
.reports-deal-breakdown__section-label--warn {
    color: var(--danger);
}
.reports-formula-list--warn {
    border-color: #fca5a5;
    background: #fff;
}
.reports-deal-breakdown__section-label {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.reports-leg-list {
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
}
.reports-leg-list li {
    display: grid;
    grid-template-columns: 7.5rem 6.5rem 1fr;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px dashed #e5e7eb;
}
.reports-leg-list--with-payer li {
    grid-template-columns: 6.5rem 6rem 7rem 1fr;
}
.reports-leg-payer {
    color: var(--muted);
    font-size: 0.78rem;
}
.reports-leg-list li:last-child {
    border-bottom: none;
}
.reports-leg-label {
    font-weight: 600;
}
.reports-leg-uid {
    color: var(--muted);
    font-size: 0.76rem;
}
.reports-formula-list {
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.65rem;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.55;
}
.reports-formula-list li + li {
    margin-top: 0.35rem;
}
.reports-formula-list--numbered {
    list-style: decimal;
    padding-left: 1.35rem;
}
.reports-formula-list--numbered li {
    padding-left: 0.25rem;
}
.reports-breakdown-grand-totals {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--border);
}
.reports-breakdown-grand-total + .reports-breakdown-grand-total {
    margin-top: 0.65rem;
}
.reports-breakdown-grand-total .reports-deal-breakdown__section-label {
    font-size: 0.78rem;
}
.reports-formula-total {
    margin: 0.5rem 0 0.65rem;
    padding: 0.55rem 0.65rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    white-space: pre-line;
    font-variant-numeric: tabular-nums;
}
.reports-formula-total--loss {
    color: var(--danger);
    border-color: #fecaca;
    background: var(--danger-soft);
    font-weight: 600;
}
.reports-entry-list {
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
.reports-entry-line {
    display: grid;
    grid-template-columns: 5.5rem 5.5rem 6.5rem 1fr auto;
    gap: 0.45rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.reports-entry-line:last-child {
    border-bottom: none;
}
.reports-entry-type {
    font-weight: 600;
}
.reports-entry-uid {
    color: var(--muted);
    font-size: 0.76rem;
}
/* Entity report — wider ID columns, denser entry rows */
.reports-layout--entity .reports-entry-line {
    grid-template-columns:
        4.65rem
        4.35rem
        minmax(6.75rem, 8rem)
        minmax(9.5rem, 12rem)
        minmax(0, 1fr);
    gap: 0.3rem 0.45rem;
    padding: 0.16rem 0;
    line-height: 1.28;
    align-items: baseline;
}
.reports-layout--entity .reports-entry-deal {
    font-size: 0.76rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.reports-layout--entity .reports-entry-deal--empty {
    color: #cbd5e1;
}
.reports-layout--entity .reports-entry-amount {
    text-align: right;
    white-space: nowrap;
}
.reports-layout--entity .reports-deal-breakdown {
    padding: 0.55rem 0;
}
.reports-layout--entity .reports-deal-breakdown__meta {
    margin-bottom: 0.4rem;
    line-height: 1.35;
}
.reports-layout--entity .reports-deal-breakdown__section-label {
    margin-bottom: 0.2rem;
}
.reports-layout--entity .reports-deal-breakdown__legs .reports-leg-list {
    margin-bottom: 0.45rem;
}
.reports-layout--entity .reports-leg-list--with-payer li {
    grid-template-columns:
        5.25rem
        minmax(8.75rem, 11rem)
        minmax(5.5rem, 6.75rem)
        minmax(0, 1fr);
    gap: 0.28rem 0.4rem;
    padding: 0.14rem 0;
    line-height: 1.26;
    align-items: baseline;
}
.reports-layout--entity .reports-leg-uid {
    font-size: 0.74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.reports-layout--entity .reports-leg-amount {
    text-align: right;
    white-space: nowrap;
}
@media (max-width: 1100px) {
    .reports-kpi-grid--company,
    .reports-kpi-grid--entity {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .reports-layout {
        grid-template-columns: 1fr;
    }
    .reports-layout__sidebar {
        position: static;
        max-height: none;
    }
    .reports-layout__sidebar .reports-panel--daily {
        flex: none;
    }
    .reports-daily-table-panel {
        max-height: 22rem;
    }
}
@media (max-width: 768px) {
    .reports-filter-grid--entity {
        grid-template-columns: 1fr;
    }
    .reports-filter-dates {
        grid-column: auto;
        flex-direction: column;
        align-items: stretch;
    }

    .reports-leg-list li,
    .reports-entry-line {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
    .reports-layout--entity .reports-entry-amount,
    .reports-layout--entity .reports-leg-amount {
        text-align: left;
    }
}

@media (max-width: 860px) {
    .settings-form-grid,
    .settings-form-grid--triple {
        grid-template-columns: 1fr;
    }
    .settings-role-perm-group {
        grid-template-columns: 1fr;
    }
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    background: #f3f4f6;
    border: 1px solid transparent;
}
.status-active, .status-done { background: #d1fae5; color: #065f46; }
.status-waiting, .status-pending { background: #fef3c7; color: #92400e; }
.status-attention, .status-suspended { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #e5e7eb; color: #4b5563; }
.status-inactive, .status-outstanding { background: #f3f4f6; color: #6b7280; }
.status-not_started { background: #f3f4f6; color: #6b7280; }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-expired { background: #ffedd5; color: #9a3412; }
.status-badge-group {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    vertical-align: middle;
}
.status-test {
    background: #f3e8ff;
    color: #6b21a8;
}
/* Compact "T" mark next to Done / other status on deals & entries lists */
.status-test--mark {
    min-width: 1.15rem;
    padding: 0.12rem 0.32rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    justify-content: center;
    line-height: 1.15;
}
[data-theme="dark"] .status-test {
    background: #4c1d95;
    color: #e9d5ff;
}
.risk-low { background: #d1fae5; color: #065f46; }
.risk-medium { background: #fef3c7; color: #92400e; }
.risk-high { background: #ffedd5; color: #9a3412; }
.risk-prohibited { background: #fee2e2; color: #991b1b; }
.stat-warn { color: #dc2626; }
.badge-warn { background: #fee2e2; color: #991b1b; }
.check-item { display: block; margin: 0.5rem 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

.table-scroll { overflow-x: auto; }
.balance-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; }

.btn-inline { width: auto; }

/* Wizard steps */
.wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 1.5rem;
    max-width: 480px;
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.wizard-step.is-active { color: var(--primary); font-weight: 600; }
.wizard-step.is-done { color: #059669; }
.wizard-step-num {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}
.wizard-step.is-active .wizard-step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.wizard-step.is-done .wizard-step-num { background: #d1fae5; border-color: #059669; color: #059669; }
.wizard-step-connector { flex: 1; height: 2px; background: var(--border); margin: 0 0.75rem; min-width: 2rem; }
.wizard-step-connector.is-done { background: #86efac; }

/* Deal create form */
.deal-form-page .page-header {
    margin-bottom: 0.75rem;
    align-items: center;
}
.deal-form-page .page-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0.1rem;
}
.deal-form-page .page-header .subtitle {
    margin-bottom: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.deal-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.deal-form.card {
    padding: 1.1rem 1.25rem;
    max-width: none;
}
.deal-form .field {
    margin-bottom: 0.85rem;
}
.deal-form .field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.deal-form .field-optional {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.78rem;
}
.deal-form .form-input,
.deal-form input.form-input,
.deal-form textarea.form-input {
    font-size: 0.8125rem;
    padding: 0.45rem 0.6rem;
    line-height: 1.4;
}
.deal-form textarea.form-input {
    min-height: 5.5rem;
    resize: vertical;
}
.deal-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}
.deal-form-actions .btn-primary {
    min-width: 8.5rem;
}
.deal-form-actions .btn-secondary {
    background: #fff;
}
.deal-form-aside {
    padding: 1.1rem 1.25rem;
    background: linear-gradient(180deg, #f8fafc 0%, var(--surface) 100%);
    border-color: #dbeafe;
}
.deal-form-aside__callout {
    margin-bottom: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}
.deal-form-aside__callout-title {
    margin: 0 0 0.3rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a8a;
}
.deal-form-aside__callout-body {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #334155;
}
.deal-form-aside__link {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.deal-form-aside__link:hover {
    text-decoration: underline;
}
.deal-form-aside__title {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e40af;
}
.deal-form-aside__lead {
    margin: 0 0 0.8rem;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--text);
}
.deal-form-aside__section {
    margin-bottom: 0.8rem;
}
.deal-form-aside__section-label {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1d4ed8;
}
.deal-form-aside__list {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--muted);
}
.deal-form-aside__list li + li {
    margin-top: 0.35rem;
}
.deal-form-aside__note {
    margin-bottom: 0.65rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    background: #fff;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted);
}
.deal-form-aside__note p {
    margin: 0;
}
.deal-form-aside__note--emphasis {
    border-color: #fde68a;
    background: #fffbeb;
    color: #78350f;
}
.deal-form-aside__footnote {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
}
@media (max-width: 860px) {
    .deal-form-layout {
        grid-template-columns: 1fr;
    }
    .deal-form-aside {
        order: -1;
    }
}

/* Entry / wizard form pages */
@media (min-width: 768px) {
    .wizard-page,
    .wizard-review-page {
        max-width: 60%;
        margin-inline: auto;
        min-width: 1280px;
    }
}
.wizard-page .page-header,
.entry-form-page .page-header {
    margin-bottom: 0.75rem;
    align-items: center;
}
.wizard-page .page-header h1,
.entry-form-page .page-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0.1rem;
}
.wizard-page .page-header .subtitle,
.entry-form-page .page-header .subtitle {
    margin-bottom: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
}

/* Wizard layout */
.wizard-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 960px) {
    .wizard-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .wizard-form { order: 1; }
    .wizard-preview {
        order: 2;
        position: static;
        top: auto;
        width: 100%;
        min-width: 0;
    }
}
.wizard-form { min-width: 0; }
.wizard-flow-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin: 0.35rem 0 0.75rem;
    padding: 0.35rem 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: color 0.15s ease;
}
.wizard-flow-toggle:hover,
.wizard-flow-toggle:focus-visible {
    color: var(--text);
    outline: none;
}
.wizard-flow-toggle:focus-visible .wizard-flow-toggle__label {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}
.wizard-flow-toggle--collapse {
    margin-top: 0;
    margin-bottom: 0.65rem;
}
.wizard-flow-toggle__line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong, var(--border)) 12%, var(--border-strong, var(--border)) 88%, transparent);
}
.wizard-flow-toggle__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex-shrink: 0;
    min-width: 5.5rem;
    padding: 0 0.15rem;
}
.wizard-flow-toggle__state {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.wizard-flow-toggle .btn__icon {
    width: 14px;
    height: 14px;
    stroke-width: 2.25;
}
.wizard-mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.wizard-mode-bar__info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.wizard-mode-bar__title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}
.wizard-mode-bar__hint {
    font-size: 0.7rem;
    color: var(--muted);
    line-height: 1.35;
}
.wizard-segmented {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.1875rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    flex-shrink: 0;
}
.wizard-segmented__btn {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}
.wizard-segmented__btn:hover {
    color: var(--text);
}
.wizard-segmented__btn.is-active {
    color: var(--text);
    background: var(--primary-soft);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.wizard-segmented__btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.wizard-easy-cp-hint {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
}
.wizard-page .wizard-form-actions,
.wizard-review-page .wizard-form-actions {
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
}
.wizard-auto-approve-options {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    max-width: 36rem;
}
.wizard-auto-approve-all,
.wizard-auto-approve-fx {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.wizard-auto-approve-all__hint,
.wizard-auto-approve-fx__hint {
    margin: -0.05rem 0 0.35rem;
    font-size: 0.72rem;
    max-width: 36rem;
}
.wizard-form-actions__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}
.wizard-form-actions__divider {
    display: inline-block;
    width: 1px;
    align-self: stretch;
    min-height: 1.75rem;
    background: var(--border, #cbd5e1);
    margin: 0 0.15rem;
}
.entry-form {
    max-width: 820px;
}
.entry-form.entry-form--split {
    max-width: none;
}

/* Entry type select: soft outline by type (Alpine :data-entry-type). */
.entry-form .entry-type-select {
    border-width: 1.5px;
    border-style: solid;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
/* Default / rest (EXPENSES, BANK_CHARGES, OTHERS, empty) — light yellow */
.entry-form .entry-type-select,
.entry-form .entry-type-select[data-entry-type="EXPENSES"],
.entry-form .entry-type-select[data-entry-type="BANK_CHARGES"],
.entry-form .entry-type-select[data-entry-type="OTHERS"] {
    border-color: #f5d76e;
    background-color: rgba(253, 224, 71, 0.12);
    box-shadow: 0 0 0 1px rgba(245, 215, 110, 0.35);
}
/* Deposit — light green */
.entry-form .entry-type-select[data-entry-type="DEPOSIT"] {
    border-color: #86efac;
    background-color: rgba(134, 239, 172, 0.14);
    box-shadow: 0 0 0 1px rgba(134, 239, 172, 0.4);
}
/* Withdrawal — light brown */
.entry-form .entry-type-select[data-entry-type="WITHDRAWAL"] {
    border-color: #d2b48c;
    background-color: rgba(210, 180, 140, 0.18);
    box-shadow: 0 0 0 1px rgba(210, 180, 140, 0.4);
}
/* FX — light purple */
.entry-form .entry-type-select[data-entry-type="FX"] {
    border-color: #c4b5fd;
    background-color: rgba(196, 181, 253, 0.16);
    box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.4);
}
/* Adjustment — light orange */
.entry-form .entry-type-select[data-entry-type="ADJUSTMENT"] {
    border-color: #fdba74;
    background-color: rgba(253, 186, 116, 0.16);
    box-shadow: 0 0 0 1px rgba(253, 186, 116, 0.4);
}
.entry-form .entry-type-select:focus {
    outline: none;
}
.entry-form .entry-type-select[data-entry-type="DEPOSIT"]:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.28);
}
.entry-form .entry-type-select[data-entry-type="WITHDRAWAL"]:focus {
    border-color: #c4a574;
    box-shadow: 0 0 0 3px rgba(196, 165, 116, 0.3);
}
.entry-form .entry-type-select[data-entry-type="FX"]:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.3);
}
.entry-form .entry-type-select[data-entry-type="ADJUSTMENT"]:focus {
    border-color: #fb923c;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.28);
}
.entry-form .entry-type-select:focus:not([data-entry-type="DEPOSIT"]):not([data-entry-type="WITHDRAWAL"]):not([data-entry-type="FX"]):not([data-entry-type="ADJUSTMENT"]) {
    border-color: #eab308;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.28);
}
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="DEPOSIT"] {
    border-color: #4ade80;
    background-color: rgba(74, 222, 128, 0.1);
}
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="WITHDRAWAL"] {
    border-color: #c4a574;
    background-color: rgba(196, 165, 116, 0.12);
}
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="FX"] {
    border-color: #a78bfa;
    background-color: rgba(167, 139, 250, 0.12);
}
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="ADJUSTMENT"] {
    border-color: #fb923c;
    background-color: rgba(251, 146, 60, 0.1);
}
[data-theme="dark"] .entry-form .entry-type-select,
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="EXPENSES"],
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="BANK_CHARGES"],
[data-theme="dark"] .entry-form .entry-type-select[data-entry-type="OTHERS"] {
    border-color: #eab308;
    background-color: rgba(234, 179, 8, 0.1);
}
/* Full-page entry form: form · Recent Deal · Quick calc (animated columns). */
.entry-form-workspace {
    width: 100%;
}
.entry-form-workspace--with-deals {
    display: grid;
    /* Form 5/12 · Recent Deal 3/12 · Quick calc 3/12 — keep 3 tracks for smooth FX expand. */
    grid-template-columns: minmax(0, calc(100% * 5 / 12)) minmax(0, calc(100% * 3 / 12)) minmax(0, calc(100% * 3 / 12));
    gap: 1rem;
    align-items: start;
    justify-content: start;
    transition: grid-template-columns 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        gap 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
/* FX: form expands to 7/12; collapse quick-calc track to 0. */
.entry-form-workspace--with-deals.entry-form-workspace--fx {
    grid-template-columns: minmax(0, calc(100% * 7 / 12)) minmax(0, calc(100% * 3 / 12)) minmax(0, 0fr);
    gap: 1rem 1rem;
}
.entry-form-workspace--with-deals > .entry-form.entry-form--split {
    width: 100%;
    max-width: none;
    margin: 0;
    min-width: 0;
    transition: min-width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.entry-form-workspace--with-deals > .entry-quick-calc {
    min-width: 0;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.28s ease,
        transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.entry-form-workspace--with-deals.entry-form-workspace--fx > .entry-quick-calc,
.entry-form-workspace--with-deals > .entry-quick-calc.is-fx-collapsed {
    opacity: 0;
    transform: translateX(0.35rem);
    pointer-events: none;
    visibility: hidden;
}
/* Within form column, stack fields + documents. */
.entry-form-page:not(.entry-form-page--embed) .entry-form--deal-picker .entry-form-layout {
    grid-template-columns: 1fr;
}
.entry-form-page:not(.entry-form-page--embed) .entry-form--deal-picker .entry-form-layout__side {
    position: static;
}

/* Deal party quick-fill chips (people section) */
.entry-deal-party-fill {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
    border: 1px dashed var(--border, #cbd5e1);
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 0.15rem;
}
.entry-deal-party-fill__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted, #64748b);
}
.entry-deal-party-fill__groups {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.entry-deal-party-fill__group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.entry-deal-party-fill__role {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted, #64748b);
}
.entry-deal-party-fill__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.entry-deal-party-fill__chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.28rem 0.55rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 999px;
    background: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    cursor: pointer;
    text-align: left;
    word-break: break-word;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.entry-deal-party-fill__chip:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.entry-deal-party-fill__chip--channel:hover {
    border-color: #60a5fa;
    background: #eff6ff;
}
.entry-deal-party-fill__chip--cp:hover {
    border-color: #fbbf24;
    background: #fffbeb;
}
.entry-deal-party-fill__hint {
    margin: 0;
    font-size: 0.7rem;
}
[data-theme="dark"] .entry-deal-party-fill {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.25);
}
[data-theme="dark"] .entry-deal-party-fill__chip {
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
}

/* Selected deal summary (replaces long <select>). */
.entry-deal-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: var(--radius, 8px);
    background: var(--surface, #fff);
    min-height: 2.5rem;
}
.entry-deal-selected--set {
    border-color: #93c5fd;
    background: rgba(147, 197, 253, 0.12);
}
.entry-deal-selected__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.entry-deal-selected__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    word-break: break-word;
}
.entry-deal-selected--empty .entry-deal-selected__label {
    font-weight: 500;
    color: var(--muted, #64748b);
}
.entry-deal-selected__hint {
    margin: 0;
    font-size: 0.72rem;
}

/* Recent Deal side panel */
.entry-recent-deals {
    min-width: 0;
    position: sticky;
    top: 0.75rem;
    max-height: calc(100vh - 5rem);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 10px);
    background: var(--surface, #fff);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.entry-recent-deals__head h2 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 650;
}
.entry-recent-deals__head .hint {
    margin: 0;
    font-size: 0.75rem;
}
.entry-recent-deals__list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
    padding-right: 0.15rem;
}
.entry-recent-deals__empty {
    margin: 0.5rem 0;
}
.entry-recent-deal-card {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.65rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
.entry-recent-deal-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.entry-recent-deal-card.is-selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}
.entry-recent-deal-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}
.entry-recent-deal-card__uid {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted, #64748b);
}
.entry-recent-deal-card__badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
}
.entry-recent-deal-card__name {
    margin-top: 0.15rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    line-height: 1.3;
    word-break: break-word;
}
.entry-recent-deal-card__meta {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--muted, #64748b);
}
.entry-recent-deal-card__check {
    color: #2563eb;
    font-weight: 700;
}
.entry-recent-deal-card__parties {
    margin: 0.4rem 0 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.18rem 0.5rem;
}
.entry-recent-deal-card__party {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.25rem 0.4rem;
    align-items: baseline;
    font-size: 0.7rem;
    line-height: 1.3;
}
.entry-recent-deal-card__party dt {
    margin: 0;
    font-weight: 600;
    color: var(--muted, #64748b);
}
.entry-recent-deal-card__party dd {
    margin: 0;
    font-weight: 500;
    color: var(--text, #0f172a);
    word-break: break-word;
}
.entry-recent-deal-card__remarks {
    margin: 0.3rem 0 0;
    font-size: 0.7rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.entry-recent-deals__clear {
    align-self: flex-start;
    flex-shrink: 0;
}

/* Quick calc panel (col 3 — after Recent Deal) */
.entry-quick-calc {
    min-width: 0;
    position: sticky;
    top: 0.75rem;
    max-height: calc(100vh - 5rem);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 10px);
    background: var(--surface, #fff);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: auto;
}
.entry-quick-calc__head h2 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 650;
}
.entry-quick-calc__head .hint {
    margin: 0;
    font-size: 0.75rem;
}
.entry-quick-calc__empty {
    margin: 0.35rem 0 0;
}
.entry-quick-calc__body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}
.entry-quick-calc__deal {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    word-break: break-word;
}
.entry-quick-calc__section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.entry-quick-calc__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted, #64748b);
}
.entry-quick-calc__sources {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 14rem;
    overflow-y: auto;
}
.entry-quick-calc__source {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.5rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 7px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.entry-quick-calc__source:hover {
    border-color: #86efac;
    background: #f0fdf4;
}
.entry-quick-calc__source.is-selected {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}
.entry-quick-calc__source-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted, #64748b);
}
.entry-quick-calc__source-amt {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text, #0f172a);
    font-variant-numeric: tabular-nums;
}
.entry-quick-calc__methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
}
.entry-quick-calc__methods--direction {
    grid-template-columns: 1fr;
}
.entry-quick-calc__method {
    padding: 0.4rem 0.35rem;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 7px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    color: var(--text, #0f172a);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.entry-quick-calc__method:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.entry-quick-calc__method.is-selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}
.entry-quick-calc__method--increase.is-selected {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}
.entry-quick-calc__method--decrease.is-selected {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}
.entry-quick-calc__section--direction {
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.entry-quick-calc__result {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0.55rem;
    border-radius: 8px;
    background: #f1f5f9;
}
.entry-quick-calc__result-value {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text, #0f172a);
}
.entry-quick-calc__hint {
    margin: 0.15rem 0 0;
    font-size: 0.7rem;
}

[data-theme="dark"] .entry-recent-deals {
    background: var(--surface, #1e293b);
    border-color: rgba(148, 163, 184, 0.25);
}
[data-theme="dark"] .entry-recent-deal-card {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.22);
}
[data-theme="dark"] .entry-recent-deal-card:hover,
[data-theme="dark"] .entry-recent-deal-card.is-selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: #60a5fa;
}
[data-theme="dark"] .entry-deal-selected--set {
    background: rgba(59, 130, 246, 0.12);
    border-color: #60a5fa;
}
[data-theme="dark"] .entry-quick-calc {
    background: var(--surface, #1e293b);
    border-color: rgba(148, 163, 184, 0.25);
}
[data-theme="dark"] .entry-quick-calc__source {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.22);
}
[data-theme="dark"] .entry-quick-calc__source.is-selected {
    background: rgba(34, 197, 94, 0.15);
    border-color: #4ade80;
}
[data-theme="dark"] .entry-quick-calc__method {
    background: rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
}
[data-theme="dark"] .entry-quick-calc__method.is-selected {
    background: rgba(59, 130, 246, 0.2);
    border-color: #60a5fa;
    color: #93c5fd;
}
[data-theme="dark"] .entry-quick-calc__result {
    background: rgba(15, 23, 42, 0.55);
}

@media (max-width: 1280px) {
    .entry-form-workspace--with-deals {
        grid-template-columns: minmax(0, 1.4fr) minmax(12rem, 15rem) minmax(12rem, 15rem);
    }
    .entry-form-workspace--with-deals.entry-form-workspace--fx {
        grid-template-columns: minmax(0, 1.9fr) minmax(12rem, 15rem) minmax(0, 0fr);
    }
}
@media (max-width: 960px) {
    .entry-form-workspace--with-deals {
        grid-template-columns: 1fr 1fr;
        transition: none;
    }
    .entry-form-workspace--with-deals.entry-form-workspace--fx {
        grid-template-columns: 1fr 1fr;
    }
    .entry-form-workspace--with-deals > .entry-form {
        grid-column: 1 / -1;
    }
    .entry-recent-deals,
    .entry-quick-calc {
        position: static;
        max-height: none;
    }
    .entry-form-workspace--with-deals.entry-form-workspace--fx > .entry-quick-calc {
        display: none;
    }
}
@media (max-width: 640px) {
    .entry-form-workspace--with-deals,
    .entry-form-workspace--with-deals.entry-form-workspace--fx {
        grid-template-columns: 1fr;
    }
}
.entry-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    gap: 1rem;
    align-items: start;
}
.entry-form-layout__main {
    min-width: 0;
}
.entry-form-layout__side {
    min-width: 0;
    position: sticky;
    top: 0.75rem;
}
.entry-documents-panel {
    margin-bottom: 0;
    padding: 0.75rem 0.85rem;
}
.entry-documents-panel .wizard-section-head {
    margin-bottom: 0.55rem;
}
.entry-documents-panel .wizard-section-head h2 {
    font-size: 0.95rem;
}
.entry-documents-panel .wizard-section-head .hint {
    font-size: 0.72rem;
}
.entry-documents-zone {
    position: relative;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: #f8fafc;
    padding: 0.7rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.entry-documents-zone:hover,
.entry-documents-zone:focus,
.entry-documents-zone--active,
.entry-documents-zone--drag {
    border-color: var(--primary);
    background: var(--primary-soft);
    outline: none;
    box-shadow: var(--focus-ring);
}
.entry-documents-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.entry-documents-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}
.entry-documents-icon {
    font-size: 1.25rem;
    line-height: 1;
}
.entry-documents-title {
    font-size: 0.82rem;
    font-weight: 600;
}
.entry-documents-hint {
    font-size: 0.68rem;
    color: var(--muted);
    line-height: 1.35;
}
.entry-documents-browse {
    margin-top: 0.35rem;
}
.entry-documents-list,
.entry-documents-existing-list,
.entry-documents-detail-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.entry-documents-item {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    gap: 0.35rem;
    align-items: center;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
}
.entry-documents-thumb {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.entry-documents-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 4px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.62rem;
    font-weight: 700;
}
.entry-documents-name {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-documents-existing {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}
.entry-documents-existing-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.entry-documents-existing-list li {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.75rem;
}
.entry-documents-existing-list a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-documents-remove {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    color: var(--muted);
    cursor: pointer;
}
.entry-documents-status {
    margin: 0.4rem 0 0;
    min-height: 1rem;
    font-size: 0.68rem;
    text-align: center;
}
.entry-documents-detail-list li + li {
    margin-top: 0.2rem;
}
@media (max-width: 960px) {
    .entry-form-layout {
        grid-template-columns: 1fr;
    }
    .entry-form-layout__side {
        position: static;
        order: -1;
    }
}
.entity-form-page .entity-form {
    max-width: none;
}
.entity-form-page .page-header {
    margin-bottom: 0.5rem;
}
.entity-form-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.entity-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.45rem;
    align-items: start;
    min-width: 980px;
}
.entity-form-layout__main,
.entity-form-layout__side {
    min-width: 0;
}
.entity-form-layout .wizard-section {
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.4rem;
}
.entity-form-layout .wizard-section--deal-details {
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.35rem;
}
.entity-form-layout .wizard-section-head {
    margin-bottom: 0.35rem;
}
.entity-form-layout .wizard-grid--deal {
    gap: 0.35rem 0.5rem;
}
.wizard-grid--side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.5rem;
}
.entity-form .wizard-subhead {
    margin: 0.15rem 0 0;
    padding-top: 0.35rem;
}
.entity-form .wizard-subhead:first-child {
    margin-top: 0;
    padding-top: 0;
}
.entity-form .wizard-subhead h3 {
    margin: 0 0 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.entity-stakeholder-panel {
    padding: 0;
    overflow: visible;
}
.entity-stakeholder-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.entity-stakeholder-table th,
.entity-stakeholder-table td {
    padding: 0.35rem 0.4rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
}
.entity-stakeholder-table th {
    color: var(--muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 600;
}
.entity-stakeholder-table th.num,
.entity-stakeholder-table td.num {
    text-align: right;
    width: 2.5rem;
}
.entity-stakeholder-person,
.entity-relationship-person {
    min-width: 13rem;
}
.entity-stakeholder-person select.form-input,
.entity-relationship-person select.form-input {
    width: 100%;
    min-width: 12rem;
}
.entity-relationship-table th:first-child {
    min-width: 9rem;
}
.entity-formset-hint--empty {
    margin-bottom: 0.35rem;
}
.entity-stakeholder-table select.form-input,
.entity-stakeholder-table input.form-input {
    width: 100%;
    font-size: 0.8125rem;
}
.entity-stakeholder-remove {
    width: 4.5rem;
    white-space: nowrap;
}
.entity-stakeholder-remove .check-label {
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.entity-formset-add {
    margin-left: auto;
    flex-shrink: 0;
}
.entity-formset-hint {
    margin: 0 0 0.4rem;
}
.entity-form-layout .wizard-section-head {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.entity-form-page .page-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0.1rem;
}
.entity-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.entity-form .field--span-2 {
    grid-column: span 2;
}
.entity-form .field--span-full {
    grid-column: 1 / -1;
}
.entity-type-field ul.entity-type-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
}
.entity-type-field ul.entity-type-checks li {
    margin: 0;
}
.entity-type-field ul.entity-type-checks label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    cursor: pointer;
}
.entity-type-checks--readonly.entity-type-checks--stacked {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.1rem 0;
}
.entity-type-checks--readonly .entity-type-checks__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.entity-type-checks--readonly li {
    margin: 0;
    padding: 0.1rem 0.15rem;
}
.entity-type-checks--readonly label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted);
    cursor: default;
    white-space: nowrap;
}
.entity-type-checks--readonly input[type="checkbox"] {
    margin: 0;
    pointer-events: none;
    accent-color: #9ca3af;
}
.entity-type-checks--readonly input[type="checkbox"]:not(:checked) {
    opacity: 0.35;
}
.entity-type-checks--readonly .entity-type-checks__item--on label {
    color: #15803d;
    font-weight: 600;
}
.entity-type-checks--readonly .entity-type-checks__item--on input[type="checkbox"] {
    accent-color: #16a34a;
    opacity: 1;
}
.entity-list-types {
    min-width: 6.5rem;
    max-width: 9.5rem;
    white-space: nowrap;
}
/* Compact entity type codes (CH / CP / …) with fast tooltips */
.entity-type-codes {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.22rem;
}
.entity-type-code {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    height: 1.35rem;
    padding: 0 0.28rem;
    border-radius: 0.3rem;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface-raised, #f8fafc);
    color: var(--muted, #94a3b8);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    cursor: default;
    user-select: none;
}
.entity-type-code.is-on {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}
.entity-type-code.is-off {
    opacity: 0.55;
}
.entity-type-code:hover,
.entity-type-code:focus-visible {
    opacity: 1;
    outline: none;
    border-color: #64748b;
}
.entity-type-code.is-on:hover,
.entity-type-code.is-on:focus-visible {
    border-color: #16a34a;
}
/* Quick tooltip (hover / focus / click via .is-tip-open) */
.entity-type-code::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.35rem);
    transform: translateX(-50%) translateY(0.15rem);
    padding: 0.28rem 0.45rem;
    border-radius: 0.35rem;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1.2;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.06s ease, transform 0.06s ease;
}
.entity-type-code::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.12rem);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #0f172a;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.06s ease;
}
.entity-type-code:hover::after,
.entity-type-code:hover::before,
.entity-type-code:focus-visible::after,
.entity-type-code:focus-visible::before,
.entity-type-code.is-tip-open::after,
.entity-type-code.is-tip-open::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.entity-type-code:hover::before,
.entity-type-code:focus-visible::before,
.entity-type-code.is-tip-open::before {
    transform: translateX(-50%);
}
/* Compact KYC doc codes — corporate BR/CI/BD vs individual BS/ID/OI/TD */
.entity-doc-codes {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.22rem;
}
.entity-doc-code {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    height: 1.35rem;
    padding: 0 0.28rem;
    border-radius: 0.3rem;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface-raised, #f8fafc);
    color: var(--muted, #94a3b8);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    cursor: pointer;
    user-select: none;
}
.entity-doc-code.is-on {
    color: #1e40af;
    background: #dbeafe;
    border-color: #93c5fd;
}
.entity-doc-code.is-off {
    opacity: 0.55;
}
.entity-doc-code.is-busy {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}
.entity-doc-code:hover,
.entity-doc-code:focus-visible {
    opacity: 1;
    outline: none;
    border-color: #64748b;
}
.entity-doc-code.is-on:hover,
.entity-doc-code.is-on:focus-visible {
    border-color: #2563eb;
}
.entity-doc-code::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.35rem);
    transform: translateX(-50%) translateY(0.15rem);
    padding: 0.28rem 0.45rem;
    border-radius: 0.35rem;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1.2;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.06s ease, transform 0.06s ease;
}
.entity-doc-code::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.12rem);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #0f172a;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transition: opacity 0.06s ease;
}
.entity-doc-code:hover::after,
.entity-doc-code:hover::before,
.entity-doc-code:focus-visible::after,
.entity-doc-code:focus-visible::before,
.entity-doc-code.is-tip-open::after,
.entity-doc-code.is-tip-open::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.entity-doc-code:hover::before,
.entity-doc-code:focus-visible::before,
.entity-doc-code.is-tip-open::before {
    transform: translateX(-50%);
}
/* Bank account codes BA1–BA4 — hover tip, click to copy */
.entity-bank-codes {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.22rem;
}
.entity-bank-code {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border-radius: 0.3rem;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface-raised, #f8fafc);
    color: var(--muted, #94a3b8);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    cursor: copy;
    user-select: none;
}
.entity-bank-code.is-on {
    color: #9a3412;
    background: #ffedd5;
    border-color: #fdba74;
}
.entity-bank-code.is-on.is-primary {
    color: #9a3412;
    background: #fed7aa;
    border-color: #fb923c;
}
.entity-bank-code.is-off {
    opacity: 0.55;
}
.entity-bank-code.is-copied {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}
.entity-bank-code:hover,
.entity-bank-code:focus-visible {
    opacity: 1;
    outline: none;
    border-color: #ea580c;
}
/*
 * Multi-line bank details tooltip (paste format).
 * Opens *below* the chip so sticky thead + table overflow do not clip
 * the first rows (opening upward was hidden under the header).
 */
.entity-bank-code__tip {
    position: absolute;
    left: 0;
    top: calc(100% + 0.4rem);
    bottom: auto;
    transform: translateY(-0.1rem);
    min-width: 16rem;
    max-width: min(28rem, 70vw);
    max-height: min(18rem, 50vh);
    overflow: auto;
    padding: 0.5rem 0.6rem;
    border-radius: 0.4rem;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.68rem;
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.35;
    text-align: left;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    z-index: 80;
    transition: opacity 0.06s ease, transform 0.06s ease;
}
.entity-bank-code__tip::after {
    content: "";
    position: absolute;
    left: 0.75rem;
    top: auto;
    bottom: 100%;
    transform: none;
    border: 5px solid transparent;
    border-bottom-color: #0f172a;
    border-top-color: transparent;
}
.entity-bank-code:hover .entity-bank-code__tip,
.entity-bank-code:focus-visible .entity-bank-code__tip,
.entity-bank-code.is-tip-open .entity-bank-code__tip {
    opacity: 1;
    transform: translateY(0);
}
/* Lift bank cell above sticky header / neighboring cells while tip is open */
.entities-table td.col-banks {
    overflow: visible;
    position: relative;
}
.entities-table tbody tr:has(.entity-bank-code:hover),
.entities-table tbody tr:has(.entity-bank-code:focus-visible),
.entities-table tbody tr:has(.entity-bank-code.is-tip-open) {
    position: relative;
    z-index: 60;
}
.entities-table {
    table-layout: auto;
}
.entities-table .col-uid {
    width: 6.5rem;
    white-space: nowrap;
}
.entities-table .col-types {
    width: 7.5rem;
}
.entities-table .col-customer-type {
    width: 6.5rem;
}
.entities-table .col-display-name {
    min-width: 9rem;
    max-width: 12rem;
}
.entities-table .col-legal-name {
    min-width: 8rem;
    max-width: 12rem;
}
.entities-table .col-types {
    min-width: 13rem;
}
.entities-table .col-docs {
    min-width: 7.5rem;
}
.entities-table .col-banks {
    min-width: 6.5rem;
    white-space: nowrap;
    overflow: visible;
}
/* Full country names (not ISO) — keep one line so entity rows do not wrap taller */
.entities-table .col-country {
    min-width: 8.5rem;
    width: 9.5rem;
    max-width: 12rem;
    white-space: nowrap;
}
.entities-table .col-kyc,
.entities-table .col-risk,
.entities-table .col-status {
    white-space: nowrap;
}
.btn--icon-only {
    padding: 0.3rem 0.45rem;
    min-width: 1.85rem;
    justify-content: center;
}
.btn--icon-only .btn__icon {
    margin: 0;
}
.entity-quick-view-drawer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
}
.entity-quick-view-drawer.is-open {
    pointer-events: auto;
}
.entity-quick-view-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    opacity: 0;
    transition: opacity 0.22s ease;
}
.entity-quick-view-drawer.is-open .entity-quick-view-drawer__backdrop {
    opacity: 1;
}
.entity-quick-view-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(26rem, calc(100vw - 1rem));
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface, #fff);
    border-left: 1px solid var(--border-subtle, #e5e7eb);
    box-shadow: -8px 0 28px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (min-width: 768px) {
    .entity-quick-view-drawer__panel {
        width: min(52rem, calc(100vw - 1rem));
    }
}
.entity-quick-view-drawer.is-open .entity-quick-view-drawer__panel {
    transform: translateX(0);
}
.entity-quick-view-drawer__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
    flex-shrink: 0;
}
.entity-quick-view-drawer__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}
.entity-quick-view-drawer__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
}
.entity-quick-view-drawer__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.85rem 1rem;
}
.entity-quick-view-drawer__foot {
    flex-shrink: 0;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border-subtle, #e5e7eb);
}
.entity-quick-view-drawer__loading,
.entity-quick-view-drawer__error {
    margin: 0;
    padding: 1rem 0;
}
body.entity-quick-view-open {
    overflow: hidden;
}
.entity-quick-view-section {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.entity-quick-view-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.entity-quick-view-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}
.entity-quick-view-section__head h3,
.entity-quick-view-section__head h4 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.entity-quick-view-section__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.entity-quick-view-section--kyc .entity-quick-view-kyc-stats {
    margin-bottom: 0.65rem;
}
.entity-quick-view-scorecard {
    margin-top: 0;
}
.entity-quick-view-bank-list,
.entity-quick-view-rel-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.entity-quick-view-bank-item {
    padding: 0.55rem 0.65rem;
    border-radius: 0.45rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.entity-quick-view-bank-item--primary {
    border-color: #bae6fd;
    background: #f0f9ff;
}
.entity-quick-view-bank-item--inactive {
    opacity: 0.72;
}
.entity-quick-view-bank-item__main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.82rem;
}
.entity-quick-view-bank-item__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    margin-top: 0.25rem;
    font-size: 0.76rem;
}
.entity-quick-view-rel__label {
    margin: 0.35rem 0 0.25rem;
    font-size: 0.72rem;
}
.entity-quick-view-rel-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.45rem;
    font-size: 0.8rem;
    line-height: 1.35;
}
.entity-quick-view-rel__type {
    font-size: 0.72rem;
    color: #64748b;
}
.entity-quick-view-entries .data-table {
    font-size: 0.78rem;
}
.entity-quick-view-entries .deal-entry-date {
    display: block;
    font-size: 0.7rem;
}
.entity-stakeholder-share-cell {
    min-width: 5.5rem;
    vertical-align: middle;
}
.entity-stakeholder-share-cell .entity-stakeholder-share {
    max-width: 5.5rem;
    text-align: right;
}
.entity-stakeholder-share-na {
    display: inline-block;
    color: #94a3b8;
}
.entities-table .entity-row-actions {
    min-width: 11rem;
    width: 1%;
}
.entities-table .entity-row-actions .ui-action-group {
    flex-wrap: nowrap;
    gap: 0.25rem;
    align-items: center;
}
/* Extra space between Suspend and Delete */
.entities-table .entity-row-actions__spacer {
    display: inline-block;
    width: 0.55rem;
    flex: 0 0 0.55rem;
}
.entity-delete-modal__card {
    width: min(28rem, calc(100vw - 2rem));
    padding: 1.15rem 1.25rem 1rem;
    border: 1px solid #dc2626;
    box-shadow:
        0 0 0 1px rgba(220, 38, 38, 0.12),
        0 18px 40px rgba(127, 29, 29, 0.18);
}
[data-theme="dark"] .entity-delete-modal__card {
    border-color: #ef4444;
    box-shadow:
        0 0 0 1px rgba(239, 68, 68, 0.2),
        0 18px 40px rgba(0, 0, 0, 0.45);
}
.entity-delete-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -1.15rem -1.25rem 0.85rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(127, 29, 29, 0.35);
    border-radius: calc(var(--radius, 8px) + 2px) calc(var(--radius, 8px) + 2px) 0 0;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 55%, #991b1b 100%);
    color: #fff;
}
.entity-delete-modal__head h2 {
    margin: 0;
    color: #fff;
}
.entity-delete-modal__head .entity-delete-modal__subtitle,
.entity-delete-modal__head .hint {
    color: rgba(255, 255, 255, 0.88);
}
.entity-delete-modal__head #entity-delete-modal-close,
.entity-delete-modal__head .btn-secondary {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.entity-delete-modal__head #entity-delete-modal-close:hover,
.entity-delete-modal__head .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff;
}
[data-theme="dark"] .entity-delete-modal__head {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 55%, #7f1d1d 100%);
    border-bottom-color: rgba(0, 0, 0, 0.25);
}
.entity-delete-modal__warn {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: #b91c1c;
    font-weight: 600;
}
.entity-delete-modal__confirm-hint {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #334155);
}
.entity-delete-modal__names {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.45rem;
    margin: 0 0 0.85rem;
}

.entity-delete-modal__name-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid #fca5a5;
    background: linear-gradient(180deg, #fff7f7 0%, #fee2e2 100%);
    color: #991b1b;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.entity-delete-modal__name-sep {
    color: var(--muted, #6b7280);
    font-weight: 700;
    font-size: 0.85rem;
    user-select: none;
}

[data-theme="dark"] .entity-delete-modal__name-badge {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
}

.entity-delete-modal__actions {
    margin-top: 1rem;
}
.entity-activate-modal__card {
    width: min(38rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    padding: 1.15rem 1.25rem 1rem;
}
.entity-activate-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.entity-activate-modal__head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.entity-activate-modal__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
}
.entity-activate-modal__body {
    overflow: auto;
    flex: 1;
    min-height: 0;
}
.entity-activate-form__intro {
    margin: 0 0 0.85rem;
    font-size: 0.84rem;
    line-height: 1.45;
}
.entity-activate-form__section {
    margin: 0 0 0.85rem;
    padding: 0.85rem 0.95rem;
    border-radius: 0.55rem;
    border: 1px solid var(--border);
    background: var(--surface-muted, #fafbfc);
}
.entity-activate-form__section.wizard-section--deal-details {
    border-left: 3px solid var(--accent, #0891b2);
}
.entity-activate-form__grid {
    margin-bottom: 0;
}
.entity-activate-form__types {
    margin: 0 0 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.55rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
.entity-activate-form__types-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.65rem;
    margin-bottom: 0.55rem;
}
.entity-activate-form__types-head label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
}
.entity-activate-form__types-head .hint {
    font-size: 0.76rem;
    color: var(--muted);
}
.entity-activate-form__types ul.entity-type-checks {
    margin: 0;
    gap: 0.35rem 0.75rem;
}
.entity-activate-form__types .entity-type-checks label,
.entity-activate-form__types ul.entity-type-checks label {
    color: var(--text);
}
.entity-activate-form__types input[type="checkbox"] {
    accent-color: var(--primary, #2563eb);
}
.entity-activate-modal__guide {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.85rem;
    border-radius: 0.5rem;
    background: var(--primary-soft, #f0f9ff);
    border: 1px solid #bae6fd;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #0c4a6e;
}
.entity-activate-modal__guide p {
    margin: 0 0 0.5rem;
    color: inherit;
}
.entity-activate-modal__guide p:last-of-type {
    margin-bottom: 0.65rem;
}
.entity-activate-modal__edit-link {
    font-weight: 600;
    color: #0369a1;
    text-decoration: none;
}
.entity-activate-modal__edit-link:hover {
    text-decoration: underline;
}
.entity-activate-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.entities-table .entity-display-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.82rem;
}
.entities-table .entity-legal-name,
.entities-table .entity-full-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
}
.badge-customer-type {
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.badge-customer-type--corporate {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}
.badge-customer-type--individual {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #d8b4fe;
}
.form-error-banner {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: var(--radius);
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.65rem;
    font-size: 0.8125rem;
}
.form-warning-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: var(--radius);
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.65rem;
    font-size: 0.8125rem;
}
.entry-form .wizard-section textarea.form-input {
    min-height: 2rem;
    resize: vertical;
}
/* Bank info: multi-line paste / wizard details must be fully readable */
.entry-form .wizard-section textarea.form-input--bank-info {
    min-height: 8.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Segoe UI", monospace;
    font-size: 0.8125rem;
    line-height: 1.45;
    white-space: pre-wrap;
    field-sizing: content;
}
[x-cloak] { display: none !important; }
.wizard-form .form-input,
.wizard-form select.form-input,
.wizard-form textarea.form-input {
    font-size: 0.8125rem;
    padding: 0.4rem 0.55rem;
    line-height: 1.35;
}
.wizard-form .field { margin-bottom: 0; }
.wizard-form .field label {
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}
.wizard-form .check-label { font-size: 0.8125rem; gap: 0.35rem; }
.wizard-form .hint { font-size: 0.72rem; }
.entity-picker { margin-bottom: 0; }
.entity-picker-required { color: var(--danger, #b45309); margin-left: 0.15rem; }
.entity-picker-input { width: 100%; }
.entity-picker-hint { margin-top: 0.35rem; font-size: 0.72rem; }
.entity-picker-hint--new { color: #92400e; }
.status-entity-pending,
.entity-picker .entity-picker-hint--new strong { font-weight: 600; }
.field-error--span {
    display: block;
    grid-column: 1 / -1;
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
}
.wizard-form .amount-input-wrap {
    padding: 0 0.4rem 0 0;
    min-height: 2rem;
}
.wizard-form .amount-sign { font-size: 0.95rem; }
.wizard-form .amount-input-wrap .amount-ccy {
    font-size: 0.75rem;
    min-width: 2.5rem;
    padding: 0 0.35rem;
}
.wizard-form .rate-input { font-size: 0.8125rem; }
.wizard-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.wizard-section--deal-details {
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.65rem;
}
.wizard-section--deal-details .wizard-section-head {
    margin-bottom: 0.45rem;
}
.wizard-section--deal-details h2 {
    font-size: 0.9rem;
    margin-bottom: 0;
}
.wizard-section--deal-details .wizard-section-head .hint {
    font-size: 0.68rem;
}
.wizard-grid--deal {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem 0.65rem;
}
.wizard-grid-divider {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    margin: 0.05rem 0;
}
.wizard-entity-columns {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1.5rem;
    align-items: start;
}
.wizard-entity-columns__col {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}
@media (max-width: 640px) {
    .wizard-entity-columns {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }
}
@media (max-width: 800px) {
    .wizard-grid--deal { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .wizard-grid--deal { grid-template-columns: 1fr; }
}
.wizard-section--deal-details textarea.form-input {
    min-height: 2rem;
    resize: vertical;
}
.wizard-section--deal-details .field-check {
    padding-top: 0.1rem;
}
.wizard-section--channel {
    border-left: 3px solid #3b82f6;
    border-radius: 0;
}
.wizard-section--cp { border-left: 3px solid #d97706; }
.wizard-section--derived { background: #f8fafc; border-style: dashed; }
.wizard-section-head {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}
.wizard-section h2 { font-size: 1rem; color: var(--text); margin-bottom: 0.15rem; }
.wizard-section-head .hint { margin: 0; }
.wizard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.field-full { grid-column: 1 / -1; }
.field-grow { flex: 1; }
.check-label { font-weight: normal; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.label-optional { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.label-auto-hint {
    font-weight: 500;
    color: #2563eb;
    font-size: 0.72rem;
}
.wizard-section--deal-details .label-auto-hint {
    font-size: 0.68rem;
}

.wizard-fx-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
@media (max-width: 720px) { .wizard-fx-row { grid-template-columns: 1fr; } }

.leg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.leg-badge--channel { background: #dbeafe; color: #1d4ed8; }
.leg-badge--cp { background: #ffedd5; color: #c2410c; }
.leg-badge--muted { background: #f3f4f6; color: var(--muted); }

.amount-row { display: flex; gap: 0.65rem; align-items: flex-end; flex-wrap: wrap; }
/* Payee bank badges under fund destination — keep currency/amount top-aligned */
.amount-row.amount-row--align-top {
    align-items: flex-start;
}
.amount-row .field-amount {
    flex: 0 1 11.5rem;
    min-width: 9.5rem;
}
.amount-row .field-fund-dest {
    flex: 1 1 14rem;
    min-width: 10rem;
}
/* Payee bank accounts as selectable badges under Fund destination (FX wizard) */
.wizard-payee-banks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    /* Tips open above badges; avoid clipping in section overflow */
    position: relative;
    z-index: 2;
}
.wizard-payee-bank-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.22rem 0.5rem 0.22rem 0.3rem;
    border-radius: 999px;
    border: 1px solid var(--border, #cbd5e1);
    background: var(--surface-muted, #f8fafc);
    color: var(--muted, #64748b);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease,
        box-shadow 0.12s ease;
}
.wizard-payee-bank-badge:hover,
.wizard-payee-bank-badge:focus-visible {
    outline: none;
    border-color: #93c5fd;
    color: #1e40af;
    background: #eff6ff;
    z-index: 5;
}
.wizard-payee-bank-badge.is-selected {
    border-color: #2563eb;
    background: #dbeafe;
    color: #1e3a8a;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22);
}
.wizard-payee-bank-badge.is-selected.is-primary {
    border-color: #1d4ed8;
    background: #bfdbfe;
}
.wizard-payee-bank-badge__code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    padding: 0.12rem 0.28rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.wizard-payee-bank-badge.is-selected .wizard-payee-bank-badge__code {
    background: rgba(37, 99, 235, 0.18);
}
.wizard-payee-bank-badge__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 12rem;
}
/*
 * Full bank-details tooltip (fixed + JS-placed so it never clips the viewport).
 * Shows all lines — no inner scroll.
 */
.wizard-payee-bank-badge__tip {
    position: fixed;
    /* Park off-screen until JS sets the final coordinates (prevents top-left flash). */
    left: -9999px;
    top: 0;
    z-index: 1400;
    min-width: 18rem;
    width: max-content;
    max-width: min(26rem, calc(100vw - 1rem));
    max-height: none;
    overflow: visible;
    padding: 0.75rem 0.9rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Segoe UI", sans-serif;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    text-align: left;
    box-shadow:
        0 14px 36px rgba(15, 23, 42, 0.32),
        0 4px 12px rgba(15, 23, 42, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.2rem) scale(0.98);
    /* Only fade/scale — never animate left/top (that caused the flash). */
    transition:
        opacity 0.12s ease,
        transform 0.12s ease,
        visibility 0.12s ease;
}
.wizard-payee-bank-badge__tip::after {
    content: "";
    position: absolute;
    left: var(--tip-arrow-left, 1.1rem);
    width: 0;
    height: 0;
    border: 7px solid transparent;
}
/* Default: tip above badge → arrow points down */
.wizard-payee-bank-badge__tip:not(.is-below)::after {
    top: 100%;
    border-top-color: #0f172a;
}
/* Flipped below badge → arrow points up */
.wizard-payee-bank-badge__tip.is-below::after {
    bottom: 100%;
    top: auto;
    border-bottom-color: #0f172a;
}
.wizard-payee-bank-badge__tip.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.wizard-section {
    overflow: visible;
}
.wizard-section .amount-row {
    overflow: visible;
}
.wizard-section .field-fund-dest {
    overflow: visible;
}
.amount-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 0.5rem 0 0;
    background: #fff;
}
.amount-input-wrap:focus-within { outline: 2px solid var(--primary); border-color: transparent; }
.amount-input {
    border: none !important;
    outline: none !important;
    padding-left: 0.5rem !important;
    flex: 1;
}

/* Smart number field: calculator tip while editing */
.wn-tip-host {
    position: relative;
}
.amount-input-wrap.wn-tip-host,
.rate-pair.wn-tip-host,
.field.wn-tip-host {
    position: relative;
}
/* Elevate tip above following panels (e.g. Adjustment under Amount on entry form). */
.wn-tip-host.wn-editing {
    z-index: 40;
}
.wn-calc-tip {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.2rem);
    z-index: 50;
    padding: 0.35rem 0.5rem;
    border-radius: 0.35rem;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.72rem;
    line-height: 1.35;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
    pointer-events: none;
}
.wn-calc-tip[hidden] {
    display: none !important;
}
/*
 * Collapse panels use overflow:hidden for animation, which clips the tip and lets
 * the next section (Adjustment / Others) paint over it. While a tip is open,
 * open the overflow chain and raise the section stacking context.
 */
.wizard-section:has(.wn-editing),
.app-collapse-panel:has(.wn-editing),
.app-collapse-grid:has(.wn-editing),
.app-collapse-grid__inner:has(.wn-editing),
.entry-form-layout:has(.wn-editing),
.entry-form-layout__main:has(.wn-editing),
.entry-form:has(.wn-editing) {
    overflow: visible !important;
}
.wizard-section:has(.wn-editing),
.app-collapse-panel:has(.wn-editing) {
    position: relative;
    z-index: 25;
}
[data-theme="dark"] .wn-calc-tip {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.amount-input-wrap .amount-ccy {
    order: -2;
    flex-shrink: 0;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    padding: 0 0.45rem;
    margin-right: 0.1rem;
    border-right: 1px solid var(--border);
    background: #f8fafc;
    border-radius: var(--radius) 0 0 var(--radius);
    font-weight: 700;
    color: var(--text);
    font-size: 0.8rem;
    min-width: 2.75rem;
    justify-content: center;
}
.amount-input-wrap .amount-sign {
    order: -1;
    font-weight: 700;
    font-size: 1.1rem;
    width: 1rem;
    text-align: center;
}
.amount-sign--pos { color: #059669; }
.amount-sign--neg { color: #dc2626; }
.amount-ccy { font-weight: 600; color: var(--muted); font-size: 0.85rem; min-width: 2.5rem; }

.fx-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: end; }
.fx-arrow { color: var(--muted); font-size: 1.25rem; padding-bottom: 0.65rem; }
.mt-sm { margin-top: 0.35rem; }

.rate-pair {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.rate-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.rate-row--inverse .rate-label {
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.rate-row--inverse .rate-label__swap-icon {
    flex-shrink: 0;
    display: inline-flex;
    color: var(--muted);
    opacity: 0.9;
}
.rate-row--inverse .rate-label__swap-icon .btn__icon {
    width: 0.95rem;
    height: 0.95rem;
}
.rate-label { font-size: 0.85rem; font-weight: 600; min-width: 7.5rem; }
.rate-formula { color: var(--muted); font-weight: 500; }
.rate-formula--ccy { font-weight: 600; min-width: 2.5rem; }
.rate-input { width: 8rem; }

.fix-toggle {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.fix-toggle-label { color: var(--muted); }
.fix-option {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 500;
}
.fix-option:has(input:checked) { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.fix-option input { margin: 0; }

.derived-legs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.derived-leg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.derived-leg-label { color: var(--muted); }
.derived-leg-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.derived-leg-arrow { color: var(--muted); }

/* Live preview panel */
.wizard-preview { position: sticky; top: 1rem; }
.wizard-preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.wizard-preview-card h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }
.wizard-channel-share-card {
    margin-top: 0.75rem;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: var(--radius);
    padding: 0.85rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.wizard-channel-share-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.wizard-channel-share-head h3 {
    font-size: 0.88rem;
    margin-bottom: 0.1rem;
    color: #1e40af;
}
.wizard-channel-share-head .hint {
    font-size: 0.68rem;
    margin: 0;
    line-height: 1.35;
}
.wizard-channel-share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex-shrink: 0;
    justify-content: flex-end;
}
.wizard-channel-share-copy {
    flex-shrink: 0;
    min-width: 4.25rem;
}
.wizard-receipt-hint {
    font-size: 0.68rem;
    margin: 0 0 0.45rem;
    line-height: 1.35;
}
.wizard-side-meta {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.wizard-side-meta .field label {
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}
.wizard-side-meta .form-input {
    font-size: 0.8125rem;
    padding: 0.4rem 0.55rem;
}
.wizard-side-meta textarea.form-input {
    min-height: 3rem;
    resize: vertical;
}
.wizard-channel-share__text {
    width: 100%;
    min-height: 7.5rem;
    margin: 0;
    padding: 0.55rem 0.6rem;
    font-size: 0.78rem;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
    resize: vertical;
    user-select: text;
    cursor: text;
    background: #fff;
    border-color: #bfdbfe;
}
.preview-col { margin-top: 0.75rem; }
.preview-col-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 0.35rem;
}
.preview-col--channel .preview-col-title { color: #1d4ed8; }
.preview-col--cp .preview-col-title { color: #c2410c; }
.preview-leg {
    display: grid;
    grid-template-columns: auto 4.5rem 1fr;
    gap: 0.35rem 0.5rem;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.8rem;
}
.preview-leg-type { color: var(--muted); }
.preview-leg-amt { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }
.amt-pos { color: #059669; }
.amt-neg { color: #dc2626; }
.preview-col-summary {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #dbeafe;
    font-size: 0.75rem;
}
.preview-summary-line {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.15rem 0;
}
.preview-summary-label { color: var(--muted); }
.preview-summary-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #c2410c;
}

.spread-panel {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.spread-panel--preview { margin-top: 1rem; margin-bottom: 0; }
.spread-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: #1d4ed8; font-weight: 700; margin-bottom: 0.35rem; }
.spread-values { display: flex; gap: 0.5rem; align-items: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.spread-vs { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.spread-diff { margin-top: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.spread-diff.has-spread strong { color: #c2410c; }
.spread-metric {
    padding: 0.5rem 0;
    border-bottom: 1px solid #dbeafe;
    font-size: 0.82rem;
}
.spread-metric:last-child { border-bottom: none; padding-bottom: 0; }
.spread-metric-label {
    display: block;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.15rem;
}
.spread-metric-detail {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}
.spread-metric-value { font-variant-numeric: tabular-nums; }
.spread-metric-value.has-spread strong { color: #c2410c; }
.spread-metric-value--pos strong { color: #059669; }
.spread-metric-value--neg strong { color: #dc2626; }
.spread-metric-value--zero strong { color: var(--muted); }
.spread-metric-warn {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #dc2626;
    font-weight: 500;
}

.warn-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.warn-box ul { margin: 0.5rem 0 0 1.25rem; }

/* Review page */
.wizard-review-page .page-header {
    margin-bottom: 1rem;
}
.wizard-review-page .wizard-steps {
    max-width: none;
    margin-bottom: 1.25rem;
}
.review-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.wizard-review-page .review-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.85rem 1.25rem;
    background: linear-gradient(180deg, #f8fafc 0%, var(--surface) 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.review-summary-item {
    min-width: 0;
}
.review-summary-label { display: block; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.review-summary-value { font-weight: 600; font-size: 0.95rem; }
.wizard-review-page .spread-panel {
    box-shadow: 0 1px 2px rgba(29, 78, 216, 0.06);
}
.wizard-review-page .wizard-review-metrics {
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}
.wizard-review-page .wizard-review-metrics--spread-only,
.wizard-review-page .wizard-review-metrics--notes-only {
    grid-template-columns: 1fr;
}
.wizard-review-page .wizard-review-metrics .spread-panel,
.wizard-review-page .wizard-review-metrics .warn-box {
    margin-bottom: 0;
    min-width: 0;
}
.wizard-review-page .wizard-review-metrics__notes {
    height: 100%;
}
@media (max-width: 768px) {
    .wizard-review-page .wizard-review-metrics {
        grid-template-columns: 1fr;
    }
}

/* Entry detail */
.entry-detail-page .page-header {
    margin-bottom: 0.5rem;
}
.entry-detail-page:has(.entry-detail-subheader) .page-header {
    margin-bottom: 0.45rem;
}
.entry-detail-page .page-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0.1rem;
}
.entry-detail-subtitle {
    font-size: 0.8125rem;
    line-height: 1.45;
}
.entry-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16.5rem;
    gap: 0.85rem;
    align-items: start;
}
.entry-detail-layout--solo {
    grid-template-columns: 1fr;
}
.entry-detail-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.entry-detail-side {
    min-width: 0;
    position: sticky;
    top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.entry-detail-summary,
.entry-detail-section,
.entry-detail-documents {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
}
.entry-detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 1rem;
}
.entry-detail-summary-item--amount {
    grid-column: 1 / -1;
}
.entry-detail-summary-label {
    display: block;
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.12rem;
}
.entry-detail-summary-value {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.35;
}
.entry-detail-amount {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}
.entry-detail-fx-arrow {
    color: var(--muted);
    font-weight: 500;
    margin: 0 0.2rem;
}
.entry-detail-section-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
}
.entry-detail-section-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
}
.entry-detail-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 1rem;
    margin: 0;
}
.entry-detail-field {
    display: contents;
}
.entry-detail-field dt {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.entry-detail-field dd {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.entry-detail-field--full {
    grid-column: 1 / -1;
}
.entry-detail-documents-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}
.entry-detail-document-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.entry-detail-document-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.entry-detail-document-img {
    width: 100%;
    max-height: 11rem;
    object-fit: contain;
    border-radius: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.entry-detail-document-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.5rem;
    border-radius: 4px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.entry-detail-document-name {
    font-size: 0.72rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-detail-documents-empty {
    margin: 0;
    font-size: 0.78rem;
}
.entry-detail-add-docs {
    width: 100%;
    justify-content: center;
}
.entity-kyc-upload-form,
.entity-kyc-remove-docs {
    margin: 0.65rem 0;
}
.entity-kyc-remove-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.45rem;
}
@media (max-width: 960px) {
    .entry-detail-layout {
        grid-template-columns: 1fr;
    }
    .entry-detail-side {
        position: static;
        order: -1;
    }
    .entry-detail-documents-grid {
        grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    }
    .entity-detail-top {
        grid-template-columns: 1fr;
        /* Single column: fill width (align-items:start only affects height here) */
        justify-items: stretch;
    }
    .entity-detail-top__main,
    .entity-detail-top__cleardil {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .entity-detail-kyc {
        position: static;
        max-height: none;
        width: 100%;
    }
}

/* Deal & entity detail */
.deal-detail-page .page-header,
.entity-detail-page .page-header {
    margin-bottom: 0.5rem;
}
.deal-detail-page .page-header h1,
.entity-detail-page .page-header h1 {
    font-size: 1.2rem;
    margin-bottom: 0.1rem;
}
.deal-detail-subtitle,
.entity-detail-subtitle {
    font-size: 0.75rem;
    line-height: 1.45;
}
/* Desktop: UID + badges inline (badges after a mid-dot via gap spacing) */
.entity-detail-subtitle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
}
.entity-detail-subtitle__badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
}
.entity-detail-subtitle__badges::before {
    content: "·";
    color: var(--muted);
    margin-right: 0.05rem;
}
.deal-desc-inline {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
    max-width: 72ch;
}
.deal-detail-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.65rem;
}
.deal-detail-summary .deal-detail-section-head {
    margin-bottom: 0.55rem;
}
.deal-detail-meta .deal-meta-name-card {
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.65rem;
    border: 1px solid #dbeafe;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.deal-meta-name-row {
    display: grid;
    grid-template-columns: 7fr 3fr;
    align-items: start;
    gap: 0.65rem 1.25rem;
}
.deal-meta-name-field,
.deal-meta-date-field {
    min-width: 0;
}
.deal-meta-date-display {
    display: block;
    margin-top: 0.2rem;
}
.deal-meta-name-display {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
}
.deal-meta-name-hint {
    margin: 0.35rem 0 0;
    font-size: 0.68rem;
}
.deal-meta-groups {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 0.65rem;
}
.deal-meta-group {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}
.deal-meta-group__title {
    margin: 0 0 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.deal-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.4rem;
}
.deal-meta-grid--parties {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
}
.deal-meta-grid--overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.deal-meta-grid--overview .deal-meta-card--entries,
.deal-meta-grid--overview .deal-meta-card--flow {
    min-height: 3.35rem;
    padding: 0.55rem 0.7rem;
}
.deal-meta-grid--overview .deal-meta-card--entries .deal-detail-summary-value,
.deal-meta-grid--overview .deal-meta-card--flow .deal-detail-summary-value {
    font-size: 0.8rem;
}
.deal-meta-card--entries .deal-detail-summary-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.4rem;
}
.deal-meta-grid--overview .deal-meta-card--entries:only-child {
    grid-column: 1 / -1;
}
.deal-meta-card {
    padding: 0.4rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    min-height: 2.75rem;
}
.deal-detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem 1.25rem;
}
.deal-detail-summary-grid + .deal-detail-summary-grid {
    margin-top: 0.5rem;
}
.deal-detail-summary-label {
    display: block;
    font-size: 0.6rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.1rem;
}
.deal-detail-summary-value {
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1.35;
}
.deal-name-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 0.55rem;
    align-items: start;
    margin-top: 0.2rem;
}
.deal-name-form .deal-name-input {
    grid-column: 1 / -1;
    width: 100%;
    font-size: 0.78rem;
    padding: 0.42rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #fff;
}
.deal-name-form .deal-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.deal-name-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    grid-column: 1 / -1;
}
.deal-date-form {
    margin-top: 0.2rem;
}
.deal-date-form__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}
.deal-date-form__row .btn {
    margin-left: auto;
}
.deal-date-form .form-input--date {
    font-size: 0.74rem;
    padding: 0.32rem 0.48rem;
}
.deal-date-modal__card {
    max-width: 26rem;
}
.deal-date-modal__lead {
    margin: 0 0 0.85rem;
    line-height: 1.45;
}
.deal-date-modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}
.deal-delete-modal__card {
    max-width: 32rem;
    width: min(32rem, 94vw);
    padding: 1.1rem 1.15rem 1rem;
}
.deal-delete-modal__card h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}
.deal-delete-modal__head {
    margin-bottom: 0.85rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
}
.deal-delete-modal__lead {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #64748b;
}
.deal-delete-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.deal-delete-form__choices {
    border: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
    min-width: 0;
}
.deal-delete-form__legend {
    margin: 0 0 0.15rem;
    padding: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}
.deal-delete-choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.55rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.deal-delete-choice:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}
.deal-delete-choice:has(.deal-delete-choice__input:checked) {
    border-color: var(--primary);
    background: #f0f9ff;
    box-shadow: var(--focus-ring);
}
.deal-delete-choice:has(.deal-delete-choice__input[value="1"]:checked) {
    border-color: #f87171;
    background: #fef2f2;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.22);
}
.deal-delete-choice__input {
    width: 0.95rem;
    height: 0.95rem;
    margin: 0.12rem 0 0;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.deal-delete-choice:has(.deal-delete-choice__input[value="1"]) .deal-delete-choice__input {
    accent-color: #dc2626;
}
.deal-delete-choice__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.deal-delete-choice__title {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
}
.deal-delete-choice__hint {
    font-size: 0.72rem;
    line-height: 1.4;
    color: #64748b;
}
.deal-delete-form__remarks {
    padding: 0.65rem 0.7rem;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    background: #fff7f7;
}
.deal-delete-form__remarks-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b91c1c;
    margin-bottom: 0.35rem;
}
.deal-delete-form__remarks-input {
    width: 100%;
    min-height: 4.5rem;
    font-size: 0.78rem;
    resize: vertical;
}
.deal-delete-modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
@media (max-width: 900px) {
    .deal-meta-name-row {
        grid-template-columns: 1fr;
    }
    .deal-meta-groups {
        grid-template-columns: 1fr;
    }
}
.deal-detail-section {
    margin-bottom: 0.65rem;
}
.deal-detail-section-title {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.deal-detail-section-header,
.deal-detail-section-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.4rem;
}
.deal-detail-section-head .deal-detail-section-title {
    margin: 0;
}
.deal-detail-section-action {
    margin-left: auto;
}
.deal-side-title,
.deal-detail-side-title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}
.deal-side-hint {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
}
.deals-table--detail {
    /* Wide FX flow: force horizontal scroll before spread/margin cells crush */
    min-width: 1100px;
}
/* Deal detail FX flow: keep each column readable; scroll sooner on narrow viewports */
.deal-flow-table-panel:not(:has(> .table-panel__scroll)) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.deals-table--fx-flow {
    width: max-content;
    max-width: none;
    min-width: 1580px;
    table-layout: auto;
}
.deals-table--fx-flow .deal-flow-col-leg {
    min-width: 9.5rem;
}
.deals-table--fx-flow .deal-flow-col-amount {
    min-width: 7.25rem;
}
.deals-table--fx-flow .deal-flow-col-fx {
    min-width: 8.5rem;
}
.deals-table--fx-flow .deal-flow-col-rate {
    min-width: 6.5rem;
}
.deals-table--fx-flow .deal-flow-col-margin {
    min-width: 12.5rem;
    width: 12.5rem;
}
.deals-table--fx-flow .deal-spread {
    min-width: 12.5rem;
}
.deals-table--fx-flow .deal-spread span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.deals-table--fx-flow td.deal-flow-col-margin,
.deals-table--fx-flow th.deal-flow-col-margin {
    box-sizing: border-box;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}
.deals-table--detail .deal-flow-leg-label {
    font-size: 0.78rem;
    font-weight: 600;
}
.deal-entry-overview {
    padding: 0.75rem 1rem;
}
.deal-entry-overview .deal-entry-line + .deal-entry-line {
    margin-top: 0.35rem;
}
.deal-detail-entries {
    margin-bottom: 0.65rem;
}
.deal-detail-unassigned {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}
.deal-detail-page .data-table {
    font-size: 0.74rem;
}
.deal-detail-page .data-table th {
    font-size: 0.62rem;
}
.deal-detail-page .entry-uid {
    font-size: 0.74rem;
}
.deal-detail-page .type-badge,
.deal-detail-page .tx-badge,
.deal-detail-page .status-badge {
    font-size: 0.62rem;
}
.deal-entries-table .entry-amount .hint {
    display: block;
    font-size: 0.66rem;
}
.deal-entries-table .deal-entry-date {
    display: block;
    font-size: 0.66rem;
    margin-top: 0.05rem;
}
.deal-entries-check {
    width: 2rem;
    text-align: center;
}
.deal-entries-check input {
    margin: 0;
    cursor: pointer;
}
.deal-entries-batch-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    margin-top: 0.55rem;
}
.deal-entries-batch-label {
    font-size: 0.75rem;
    color: var(--muted);
}
.deal-entries-batch-overrides {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1 1 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}
.deal-entries-batch-overrides .form-input {
    font-size: 0.74rem;
    padding: 0.3rem 0.45rem;
}
.deal-entries-batch-select {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.deal-entries-batch-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.deal-entries-batch-remarks {
    flex: 1 1 16rem;
    min-width: 12rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    resize: vertical;
}
.deal-entry-leg {
    white-space: nowrap;
}
.deal-entry-leg .type-badge,
.deal-entry-leg .tx-badge {
    display: inline-block;
    margin-right: 0.2rem;
}
.deal-entry-remove-form {
    display: inline-flex;
}
.btn-link--danger {
    color: var(--danger-hover);
}
.btn-link--danger:hover {
    color: var(--danger);
}
.deal-detail-side-title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}
.deal-unassigned-table {
    min-width: 1080px;
}
.deal-unassigned-check {
    width: 2rem;
    text-align: center;
}
.deal-unassigned-check input {
    margin: 0;
    cursor: pointer;
}
.deal-unassigned-row {
    cursor: pointer;
}
.deal-unassigned-row:hover td {
    background: #f8fafc;
}
.deal-unassigned-entry-label {
    display: block;
    cursor: pointer;
    margin: 0;
}
/* Entity detail */
.entity-meta__head {
    align-items: flex-start;
}
.entity-meta__desc {
    margin: 0;
    flex: 1;
    text-align: right;
    max-width: 52ch;
    line-height: 1.4;
}
.entity-meta-group {
    margin-top: 0.7rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}
.entity-meta-group:first-of-type {
    margin-top: 0.15rem;
    padding-top: 0;
    border-top: none;
}
.entity-meta-group__title {
    margin: 0 0 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.entity-meta-group .deal-detail-summary-grid + .deal-detail-summary-grid {
    margin-top: 0.45rem;
}
.entity-meta__disable-reason {
    display: block;
    margin-top: 0.12rem;
    max-width: 28ch;
}
.entity-meta__link {
    font-weight: 600;
    text-decoration: none;
}
.entity-meta__link:hover {
    text-decoration: underline;
}
.deal-detail-summary-item--span-2 {
    grid-column: span 2;
}
.deal-detail-summary-item--span-full {
    grid-column: 1 / -1;
}
.entity-meta-group--ops .deal-detail-summary-value .hint {
    display: inline;
    margin-left: 0.25rem;
}
/* Business profile — violet accent (aligns with Tier Preset tab) */
.entity-meta-group--business-profile .entity-meta-group__title {
    color: #5b21b6;
}
.empty-value {
    color: #c5cdd8;
    font-weight: 400;
}
.entity-detail-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
    margin-bottom: 0.65rem;
}
.entity-detail-top__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.entity-detail-top__cleardil {
    min-width: 0;
}
.entity-detail-cleardil-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    position: sticky;
    top: 0.75rem;
}
.entity-detail-cleardil-aside {
    min-width: 0;
}
.entity-detail-cleardil-column .entity-kyc-section--upload {
    /* Upload under ClearDil — same card language as left-column KYC sections */
    margin: 0;
}
.entity-ocr-running-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0 0 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid #93c5fd;
    background: var(--primary-soft, #eff6ff);
    color: var(--text);
}
.entity-ocr-running-banner__icon {
    flex-shrink: 0;
    color: var(--primary, #2563eb);
    margin-top: 0.1rem;
}
.entity-ocr-running-banner__text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    font-size: 0.84rem;
    line-height: 1.45;
}
.entity-ocr-running-banner__text strong {
    font-weight: 700;
    color: var(--text);
}
.entity-ocr-running-banner__text .hint {
    margin: 0;
}
.entity-detail-top__main .entity-meta {
    margin-bottom: 0;
}
.entity-detail-top__main .deal-detail-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.entity-detail-top__main .deal-detail-summary-item--span-2 {
    grid-column: 1 / -1;
}
.entity-detail-tabs-area {
    min-width: 0;
}
.entity-detail-kyc {
    min-width: 0;
}
.entity-detail-main .entity-detail-kyc {
    position: static;
    max-height: none;
    overflow: visible;
}
/* Header: Save KYC | divider | Edit (primary stands out) */
.entity-detail-header-actions {
    align-items: center;
}
.entity-detail-header-actions__divider {
    display: inline-block;
    width: 1px;
    align-self: stretch;
    min-height: 1.75rem;
    margin: 0 0.15rem;
    background: var(--border-strong, #cbd5e1);
    flex-shrink: 0;
}
/* Stack of separate KYC sections under Person Snapshot */
.entity-kyc-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}
.entity-kyc-stack__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}
.entity-kyc-stack__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}
.entity-kyc-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    min-width: 0;
}
.entity-kyc-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.65rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}
.entity-kyc-section--upload .entity-kyc-section__head {
    flex-wrap: wrap;
}
.entity-kyc-upload-section__submit {
    flex-shrink: 0;
    margin-left: auto;
}
.entity-kyc-section__title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.entity-kyc-section__score-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1d4ed8;
    background: var(--primary-soft, #eff6ff);
    border: 1px solid rgba(37, 99, 235, 0.25);
}
.entity-kyc-section__body {
    min-width: 0;
}
.entity-kyc-section--score .entity-kyc-panel__stats {
    margin-bottom: 0.55rem;
}
.entity-kyc-section--score .entity-kyc-checklist__progress {
    margin-bottom: 0.5rem;
}
.entity-kyc-section--upload .entity-kyc-documents {
    margin: 0 0 0.65rem;
}
.entity-kyc-section--upload .entity-kyc-documents:last-child {
    margin-bottom: 0;
}
.entity-kyc-section--upload .entity-kyc-documents__head {
    /* Upload section title already names the card */
    display: none;
}
.entity-kyc-upload-block {
    margin-top: 0.15rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border);
}
.entity-kyc-override-readonly {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text);
}

/* Legacy single-panel wrapper (ClearDil aside, etc.) */
.entity-kyc-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
}
.entity-kyc-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}
.entity-kyc-panel__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.entity-kyc-panel__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: flex-end;
}
.entity-kyc-panel__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}
.entity-kyc-stat {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.32rem 0.42rem;
}
.entity-kyc-stat__label {
    display: block;
    font-size: 0.62rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.08rem;
}
.entity-kyc-stat__value {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
}
.entity-kyc-documents__head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}
.entity-kyc-documents__title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}
.entity-kyc-input-block--scorecard {
    background: var(--surface);
    margin-top: 0.5rem;
    padding: 0.5rem 0.55rem;
}
.entity-kyc-input-block__title--compact {
    margin-bottom: 0.3rem;
}
.entity-kyc-input-block--scorecard .entity-kyc-checklist__progress {
    margin-bottom: 0.4rem;
}
.entity-kyc-scorecard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.22rem 0.3rem;
}
.entity-kyc-scorecard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem;
    padding: 0.24rem 0.34rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.68rem;
    min-height: 0;
}
.entity-kyc-scorecard-row--passed {
    border-color: #86efac;
    background: #f0fdf4;
}
.entity-kyc-scorecard-row--failed {
    background: #f8fafc;
}
.entity-kyc-scorecard-row--penalty {
    border-color: #fca5a5;
    background: #fef2f2;
}
.entity-kyc-scorecard-row--na {
    background: #f8fafc;
    opacity: 0.85;
}
.entity-kyc-scorecard-row--override {
    border-color: #93c5fd;
    background: #eff6ff;
}
.entity-kyc-scorecard-row__label {
    line-height: 1.25;
    color: #334155;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entity-kyc-scorecard-row__points {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
}
.entity-kyc-scorecard-row--penalty .entity-kyc-scorecard-row__points {
    color: #b91c1c;
}
.entity-kyc-override-reason,
.entity-kyc-override-hint {
    margin: 0.45rem 0 0;
    font-size: 0.72rem;
    line-height: 1.35;
}
.entity-kyc-upload-intro {
    margin: -0.1rem 0 0.4rem;
    font-size: 0.68rem;
    line-height: 1.35;
}
.entity-kyc-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}
.entity-kyc-upload-slot {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}
.entity-kyc-upload-slot__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 6.25rem);
    gap: 0.3rem 0.35rem;
    align-items: start;
}
.entity-kyc-upload-slot:hover {
    border-color: #cbd5e1;
}
.entity-kyc-upload-slot--uploaded {
    border-color: #86efac;
    background: linear-gradient(180deg, #f0fdf4 0%, #fff 2.5rem);
}
.entity-kyc-upload-slot__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
}
.entity-kyc-upload-slot__title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.25;
}
.entity-kyc-upload-slot__status {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.entity-kyc-upload-slot__status-icon {
    font-size: 0.68rem;
    line-height: 1;
}
.entity-kyc-upload-slot__expiry {
    margin: 0;
    min-width: 0;
}
.entity-kyc-upload-slot__expiry label {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.6rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.entity-kyc-upload-slot__expiry .form-input--date {
    padding: 0.28rem 0.35rem;
    font-size: 0.68rem;
}
.entity-kyc-upload-slot__actions {
    display: flex;
    justify-content: flex-end;
}
.entity-kyc-upload-slot .entity-kyc-documents-upload .entry-documents-zone {
    padding: 0.35rem 0.4rem;
    min-height: 3.35rem;
}
.entity-kyc-upload-slot .entry-documents-title {
    font-size: 0.66rem;
    font-weight: 600;
    color: #334155;
}
.entity-kyc-upload-slot .entry-documents-hint {
    font-size: 0.58rem;
    line-height: 1.25;
}
.entity-kyc-upload-slot .entry-documents-browse {
    padding: 0.15rem 0.4rem;
    font-size: 0.62rem;
}
.entity-kyc-document-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.entity-kyc-document-item {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface, #fff);
    color: var(--text, inherit);
}
.entity-kyc-document-item__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-decoration: none;
    background: var(--surface-muted, #f8fafc);
}
.entity-kyc-document-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.entity-kyc-document-item__pdf {
    font-size: 0.62rem;
    font-weight: 700;
    color: #b91c1c;
}
.entity-kyc-document-item__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}
.entity-kyc-document-item__name {
    display: block;
    flex: 1;
    min-width: 0;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary, #334155);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entity-kyc-document-item__delete {
    margin: 0;
    flex-shrink: 0;
}
.entity-kyc-document-item__delete-btn {
    color: #b91c1c;
    border-color: #fecaca;
    background: var(--surface, #fff);
}
.entity-kyc-document-item__delete-btn:hover {
    color: #fff;
    background: #dc2626;
    border-color: #dc2626;
}
.entity-kyc-document-item__name:hover {
    text-decoration: underline;
}
.entity-kyc-document-item__meta {
    margin: 0.15rem 0 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    font-size: 0.68rem;
}
.entity-kyc-document-item__edit {
    margin: 0;
}
.entity-kyc-document-item__fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 6.75rem auto;
    gap: 0.35rem;
    align-items: center;
}
.entity-kyc-document-item__fields .form-input,
.entity-kyc-document-item__fields .form-select-wrap .form-input {
    font-size: 0.72rem;
    padding: 0.32rem 0.45rem;
}
.entity-kyc-form-fields {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
}
.entity-kyc-form-fields .field label {
    font-size: 0.75rem;
    color: var(--muted);
}
.entity-kyc-checklist__title {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.entity-kyc-checklist--readonly .entity-kyc-checklist-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.45rem;
    align-items: center;
    font-size: 0.8125rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border);
}
.entity-kyc-checklist--readonly .entity-kyc-checklist-row:last-child {
    border-bottom: none;
}
.entity-kyc-remove-label {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    color: var(--muted);
}
.entity-kyc-panel__empty {
    margin: 0;
}
.entity-cleardil-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 0.55rem;
}
.entity-cleardil-screen-name {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted, #f8fafc);
}
.entity-cleardil-screen-name__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    min-width: 0;
}
.entity-cleardil-screen-name__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}
.entity-cleardil-screen-name__sublabel {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    flex-shrink: 0;
    min-width: 5.5rem;
}
.entity-cleardil-screen-name__value {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}
.entity-cleardil-screen-name__value--empty {
    color: var(--muted);
    font-weight: 500;
    letter-spacing: normal;
}
.entity-cleardil-screen-name__part {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}
.entity-cleardil-screen-name__hint {
    margin: 0.15rem 0 0;
}
.entity-cleardil-panel__title {
    margin: 0;
    flex-shrink: 0;
}
.entity-cleardil-quota {
    margin: 0 0 0 auto;
    text-align: right;
    font-size: 0.72rem;
    white-space: nowrap;
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}
.entity-cleardil-quota__label {
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.64rem;
}
.entity-cleardil-quota__value {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.entity-cleardil-quota__remaining {
    color: var(--muted);
    font-size: 0.68rem;
}
.entity-cleardil-errors {
    margin: 0 0 0.5rem;
    padding-left: 1.1rem;
    color: #b91c1c;
    font-size: 0.78rem;
}
.entity-cleardil-latest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: #fff;
    border-left-width: 3px;
}
.entity-cleardil-latest--clear {
    border-left-color: #22c55e;
    background: linear-gradient(90deg, #f0fdf4 0%, #fff 1.5rem);
}
.entity-cleardil-latest--hit,
.entity-cleardil-latest--mixed {
    border-left-color: #ef4444;
    background: linear-gradient(90deg, #fef2f2 0%, #fff 1.5rem);
}
.entity-cleardil-latest__info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.55rem;
    min-width: 0;
    flex: 1 1 10rem;
}
.entity-cleardil-latest__label {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}
.entity-cleardil-latest__label::after {
    content: "·";
    margin-left: 0.45rem;
    font-weight: 400;
    color: #cbd5e1;
}
.entity-cleardil-latest__date {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}
.entity-cleardil-latest__time {
    margin-left: 0.35rem;
    font-weight: 500;
    color: #64748b;
    font-size: 0.76rem;
}
.entity-cleardil-latest__by {
    font-size: 0.72rem;
    color: #94a3b8;
}
.entity-cleardil-latest__by::before {
    content: "·";
    margin-right: 0.4rem;
    color: #cbd5e1;
}
.status-badge.cleardil-result-clear {
    background: #dcfce7;
    color: #166534;
}
.status-badge.cleardil-result-hit,
.status-badge.cleardil-result-mixed {
    background: #fee2e2;
    color: #991b1b;
}
.entity-kyc-input-block--cleardil {
    position: relative;
}
.entity-cleardil-panel--loading {
    pointer-events: none;
}
.entity-cleardil-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: inherit;
    background: rgba(248, 250, 252, 0.82);
    backdrop-filter: blur(2px);
}
.entity-cleardil-loading[hidden] {
    display: none !important;
}
.entity-cleardil-loading__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    max-width: 16rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    text-align: center;
}
.entity-cleardil-loading__spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: cleardil-spin 0.75s linear infinite;
}
.entity-cleardil-loading__title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
}
.entity-cleardil-loading__hint {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
}
.btn[data-cleardil-submit] {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.btn[data-cleardil-submit] .btn__spinner {
    display: none;
}
.btn[data-cleardil-submit].btn--loading .btn__spinner {
    display: inline-block;
}
@keyframes cleardil-spin {
    to {
        transform: rotate(360deg);
    }
}
.entity-cleardil-run-form {
    margin: 0.5rem 0 0.75rem;
}
.entity-cleardil-run-form--confirm {
    margin-top: 0.85rem;
    padding: 0.75rem 0.85rem;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    background: #f8fafc;
}
.entity-cleardil-run-form__message {
    margin: 0 0 0.55rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #475569;
}
.entity-cleardil-hits__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.entity-cleardil-hits__count {
    font-weight: 500;
    color: var(--muted);
}
.entity-cleardil-hit {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.35rem;
    background: #fff;
}
.entity-cleardil-hit__summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.35rem 0.5rem;
    align-items: center;
    padding: 0.45rem 0.55rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.78rem;
}
.entity-cleardil-hit__summary::-webkit-details-marker {
    display: none;
}
.entity-cleardil-hit__name {
    font-weight: 600;
    color: #1e293b;
}
.entity-cleardil-hit__category {
    font-size: 0.68rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.entity-cleardil-hit__body {
    padding: 0 0.55rem 0.55rem;
    border-top: 1px solid var(--border);
}
.entity-cleardil-hit__summary-text {
    margin: 0.45rem 0;
    font-size: 0.76rem;
    color: #475569;
}
.entity-cleardil-mitigate-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}
.status-badge.cleardil-mitigation-pending {
    background: #fef3c7;
    color: #92400e;
}
.status-badge.cleardil-mitigation-approved {
    background: #fee2e2;
    color: #991b1b;
}
.status-badge.cleardil-mitigation-dismissed {
    background: #dcfce7;
    color: #166534;
}
.entity-cleardil-hits__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.45rem;
}
.entity-cleardil-hits-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.entity-cleardil-hit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem 0.85rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.entity-cleardil-hit-row:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.entity-cleardil-hit-row--pending {
    border-left: 3px solid #f59e0b;
    background: linear-gradient(90deg, #fffbeb 0%, var(--surface) 1.5rem);
}
.entity-cleardil-hit-row--approved {
    border-left: 3px solid #dc2626;
    background: linear-gradient(90deg, #fef2f2 0%, var(--surface) 1.5rem);
}
.entity-cleardil-hit-row--dismissed {
    border-left: 3px solid #16a34a;
    background: linear-gradient(90deg, #f0fdf4 0%, var(--surface) 1.5rem);
    opacity: 0.95;
}
.entity-cleardil-hit-row__main {
    min-width: 0;
}
.entity-cleardil-hit-row__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.25rem;
}
.entity-cleardil-hit-row__category {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: var(--surface-muted, #f1f5f9);
    border: 1px solid var(--border);
}
.entity-cleardil-hit-row__name {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.entity-cleardil-hit-row__summary {
    margin: 0.2rem 0 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.entity-cleardil-hit-row__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .entity-cleardil-hit-row {
        grid-template-columns: 1fr;
    }
    .entity-cleardil-hit-row__meta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
}
.cleardil-hit-score--compact {
    font-size: 0.72rem;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: var(--primary-soft, #eff6ff);
    color: var(--primary, #1d4ed8);
    border: 1px solid transparent;
}
.cleardil-hit-modal__card {
    width: min(52rem, 100%);
    max-height: min(90vh, 100dvh);
    /* Flex column: fixed header + scrollable body (content never slides under title) */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.cleardil-hit-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    margin: 0;
    padding: 1.15rem 1.35rem 0.85rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 3;
}
.cleardil-hit-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.35rem 1.35rem;
}
.cleardil-hit-modal__head-text {
    min-width: 0;
}
.cleardil-hit-modal__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}
.cleardil-hit-modal__counter {
    margin: 0.2rem 0 0;
}
/* Resolved decision + reviewer comments (not a one-line hint) */
.cleardil-hit-modal__decision-record {
    margin: 0.85rem 0;
}
.cleardil-decision-record {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted, #f8fafc);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.cleardil-decision-record__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1.25rem;
}
.cleardil-decision-record__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
}
.cleardil-decision-record__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.cleardil-decision-record__value {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}
.cleardil-decision-record__comments {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}
.cleardil-decision-record__notes {
    margin: 0;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.cleardil-decision-record__empty {
    margin: 0;
}
.cleardil-hit-report-letterhead,
.cleardil-hit-report-footer {
    display: none;
}
.cleardil-hit-modal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    align-items: center;
    margin-bottom: 0.65rem;
}
.cleardil-hit-score {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary, #1d4ed8);
}
.cleardil-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}
.cleardil-compare-col {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.65rem;
    background: var(--surface-muted, #f8fafc);
}
.cleardil-compare-col--match {
    background: #fff7ed;
    border-color: #fed7aa;
}
.cleardil-compare-col__title {
    margin: 0 0 0.45rem;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.cleardil-compare-dl__row {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.35rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    font-size: 0.76rem;
}
.cleardil-compare-dl__row:last-child {
    border-bottom: none;
}
.cleardil-compare-dl__row dt {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}
.cleardil-compare-dl__row dd {
    margin: 0;
    color: var(--text);
}
.cleardil-bullet-list {
    margin: 0;
    padding-left: 1rem;
}
.cleardil-bullet-list li {
    margin: 0.1rem 0;
}
.cleardil-hit-modal__section-title {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.cleardil-hit-modal__occupations,
.cleardil-hit-modal__associations {
    margin-bottom: 0.75rem;
}
.cleardil-occupations-table th,
.cleardil-occupations-table td {
    font-size: 0.74rem;
}
.cleardil-associations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.45rem;
}
.cleardil-association-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted, #f8fafc);
}
.cleardil-association-card__name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.cleardil-association-card__relationship {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}
.cleardil-association-card__meta {
    font-size: 0.68rem;
}
.cleardil-score-table {
    margin-bottom: 0.65rem;
}
.cleardil-note-excerpt {
    margin: 0;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted, #f8fafc);
    color: var(--text);
    font-family: inherit;
    font-size: 0.72rem;
    line-height: 1.45;
    white-space: pre-wrap;
    max-height: 50rem;
    overflow: auto;
}
.cleardil-hit-modal__decision {
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface-muted, #f8fafc) 0%, var(--surface) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.cleardil-hit-modal__decision-hint {
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    line-height: 1.45;
}
.cleardil-hit-modal__remarks label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
}
.cleardil-hit-modal__remarks textarea {
    width: 100%;
    min-height: 4.5rem;
    resize: vertical;
}
.cleardil-hit-modal__decision-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}
.btn-cleardil-dismiss {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
}
.btn-cleardil-dismiss:hover,
.btn-cleardil-dismiss:focus {
    background: #15803d;
    border-color: #166534;
    color: #fff;
}
.btn-cleardil-reject {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
}
.btn-cleardil-reject:hover,
.btn-cleardil-reject:focus {
    background: #b91c1c;
    border-color: #991b1b;
    color: #fff;
}
@media (max-width: 768px) {
    .cleardil-compare-grid {
        grid-template-columns: 1fr;
    }
}
.entity-bank-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.55rem;
}
.entity-bank-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
}
a.entity-bank-card--link {
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
a.entity-bank-card--link:hover,
a.entity-bank-card--link:focus-visible {
    border-color: #64748b;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    outline: none;
}
a.entity-bank-card--link.entity-bank-card--editing {
    border-color: var(--primary, #2563eb);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}
.entity-bank-card--primary {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.entity-bank-card--inactive {
    opacity: 0.72;
}
.entity-bank-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
}
.entity-bank-card__bank {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}
.entity-bank-card__account {
    margin: 0.12rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}
.entity-bank-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
    align-items: center;
}
.entity-bank-card__edit-hint {
    font-size: 0.68rem;
}
.entity-bank-card__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.65rem;
    margin: 0;
}
.entity-bank-card__field dt {
    margin: 0;
    font-size: 0.62rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.entity-bank-card__field dd {
    margin: 0.05rem 0 0;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
/* IBAN is often long — full width row under other fields */
.entity-bank-card__field--iban {
    grid-column: 1 / -1;
}
.entity-bank-card__field--iban dd {
    font-size: 0.75rem;
    line-height: 1.35;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.entity-inline-form-section--secondary {
    opacity: 0.92;
}
/* Entity relationship spider map (detail → Relationships tab) */
.entity-detail-section--relationships {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.entity-rel-spider__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.85rem;
}
.entity-rel-spider__toolbar .deal-detail-section-title {
    margin: 0;
}
.entity-rel-spider__toolbar .hint {
    margin: 0.2rem 0 0;
}
.entity-rel-spider__map,
.entity-rel-spider__map--vertical {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1.1rem 0.85rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background:
        radial-gradient(circle at 50% 45%, rgba(14, 165, 233, 0.08) 0%, transparent 48%),
        linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    overflow: hidden;
}
.entity-rel-spider__links {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}
.entity-rel-link {
    opacity: 0.9;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.08));
}
.entity-rel-spider__band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}
.entity-rel-spider__wing-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.entity-rel-spider__wing-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.entity-rel-spider__wing-dot--in {
    background: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.entity-rel-spider__wing-dot--out {
    background: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}
.entity-rel-spider__wing-dot--corp {
    background: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.entity-rel-hub--corp {
    border-color: #8b5cf6;
    background: linear-gradient(165deg, #fff 0%, #f5f3ff 100%);
    box-shadow:
        0 0 0 6px rgba(139, 92, 246, 0.1),
        0 12px 28px rgba(139, 92, 246, 0.16);
}
.entity-rel-hub--corp .entity-rel-hub__ring {
    border-color: rgba(139, 92, 246, 0.35);
}
.entity-rel-hub--corp .entity-rel-hub__avatar {
    background: linear-gradient(145deg, #7c3aed, #8b5cf6);
}
.entity-rel-hub--corp .entity-rel-hub__name {
    color: #4c1d95;
}
.entity-rel-hub--corp .entity-rel-hub__badge {
    color: #6d28d9;
    background: #ede9fe;
}
.entity-rel-spider__cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.85rem 1.1rem;
    width: 100%;
}
.entity-rel-spoke {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 0;
    position: relative;
    z-index: 1;
}
/* Satellite cards match hub (Ben To) vertical layout */
.entity-rel-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    flex: 0 1 auto;
    min-width: 8.5rem;
    max-width: 11rem;
    width: 100%;
    padding: 1rem 0.9rem 0.85rem;
    border-radius: 1rem;
    border: 2px solid #0ea5e9;
    background: linear-gradient(165deg, #fff 0%, #f0f9ff 100%);
    box-shadow:
        0 0 0 6px rgba(14, 165, 233, 0.08),
        0 10px 24px rgba(14, 165, 233, 0.12);
    text-align: center;
    text-decoration: none;
    color: inherit;
    z-index: 2;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.entity-rel-card--in {
    border-color: #6366f1;
    background: linear-gradient(165deg, #fff 0%, #eef2ff 100%);
    box-shadow:
        0 0 0 6px rgba(99, 102, 241, 0.08),
        0 10px 24px rgba(99, 102, 241, 0.12);
}
.entity-rel-card--corp {
    border-color: #8b5cf6;
    background: linear-gradient(165deg, #fff 0%, #f5f3ff 100%);
    box-shadow:
        0 0 0 6px rgba(139, 92, 246, 0.08),
        0 10px 24px rgba(139, 92, 246, 0.12);
}
.entity-rel-card:hover,
.entity-rel-card:focus-visible {
    transform: translateY(-2px);
    outline: none;
    box-shadow:
        0 0 0 6px rgba(14, 165, 233, 0.14),
        0 14px 30px rgba(14, 165, 233, 0.18);
}
.entity-rel-card--in:hover,
.entity-rel-card--in:focus-visible {
    box-shadow:
        0 0 0 6px rgba(99, 102, 241, 0.14),
        0 14px 30px rgba(99, 102, 241, 0.18);
}
.entity-rel-card--corp:hover,
.entity-rel-card--corp:focus-visible {
    box-shadow:
        0 0 0 6px rgba(139, 92, 246, 0.14),
        0 14px 30px rgba(139, 92, 246, 0.18);
}
.entity-rel-card__ring {
    position: absolute;
    inset: -8px;
    border-radius: 1.15rem;
    border: 1px dashed rgba(14, 165, 233, 0.3);
    pointer-events: none;
}
.entity-rel-card--in .entity-rel-card__ring {
    border-color: rgba(99, 102, 241, 0.3);
}
.entity-rel-card--corp .entity-rel-card__ring {
    border-color: rgba(139, 92, 246, 0.3);
}
.entity-rel-card__avatar,
.entity-rel-hub__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 800;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(145deg, #0284c7, #0ea5e9);
    margin-bottom: 0.15rem;
}
.entity-rel-card--in .entity-rel-card__avatar {
    background: linear-gradient(145deg, #4f46e5, #6366f1);
}
.entity-rel-card--corp .entity-rel-card__avatar {
    background: linear-gradient(145deg, #7c3aed, #8b5cf6);
}
.entity-rel-card__name {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0c4a6e;
    line-height: 1.25;
    word-break: break-word;
}
.entity-rel-card--in .entity-rel-card__name {
    color: #312e81;
}
.entity-rel-card--corp .entity-rel-card__name {
    color: #4c1d95;
}
.entity-rel-card__uid {
    font-size: 0.7rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.entity-rel-card__badge {
    margin: 0.15rem 0 0;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0369a1;
    background: #e0f2fe;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entity-rel-card--in .entity-rel-card__badge {
    color: #4338ca;
    background: #e0e7ff;
}
.entity-rel-card--corp .entity-rel-card__badge {
    color: #6d28d9;
    background: #ede9fe;
}
.entity-rel-card__remarks {
    margin-top: 0.15rem;
    font-size: 0.7rem;
    color: #94a3b8;
    line-height: 1.3;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.entity-rel-spider__hub-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0 0.5rem;
    position: relative;
    z-index: 2;
}
.entity-rel-hub {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 8.5rem;
    max-width: 11rem;
    padding: 1rem 0.9rem 0.85rem;
    border-radius: 1rem;
    border: 2px solid #0ea5e9;
    background: linear-gradient(165deg, #fff 0%, #f0f9ff 100%);
    box-shadow:
        0 0 0 6px rgba(14, 165, 233, 0.1),
        0 12px 28px rgba(14, 165, 233, 0.16);
    text-align: center;
    z-index: 2;
}
.entity-rel-spider__band,
.entity-rel-spider__cards {
    position: relative;
    z-index: 1;
}
.entity-rel-hub__ring {
    position: absolute;
    inset: -10px;
    border-radius: 1.15rem;
    border: 1px dashed rgba(14, 165, 233, 0.35);
    pointer-events: none;
    animation: entity-rel-hub-pulse 3.2s ease-in-out infinite;
}
@keyframes entity-rel-hub-pulse {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.02); }
}
.entity-rel-hub__avatar {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(145deg, #0284c7, #0ea5e9);
    margin-bottom: 0.15rem;
}
.entity-rel-hub__name {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0c4a6e;
    line-height: 1.25;
    word-break: break-word;
}
.entity-rel-hub__uid {
    font-size: 0.7rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.entity-rel-hub__badge {
    margin-top: 0.25rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0369a1;
    background: #e0f2fe;
}
.entity-rel-spider__hub-hint {
    margin: 0;
    text-align: center;
    font-size: 0.72rem;
}
.entity-rel-spider__empty {
    margin: 0;
    padding: 0.5rem 0.25rem;
}
.entity-rel-spider__empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 1.5rem 1rem;
    border-radius: 0.75rem;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    text-align: center;
}
.entity-rel-hub--solo {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
@media (max-width: 640px) {
    .entity-rel-spider__cards {
        gap: 0.75rem;
    }
    .entity-rel-card,
    .entity-rel-hub {
        min-width: 7.5rem;
        max-width: 10rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .entity-rel-hub__ring {
        animation: none;
    }
    .entity-rel-card {
        transition: none;
    }
}

/* OCR: compact purple legend + per-field borders (no bulk modal) */
.entity-ocr-field-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    margin: 0 0 0.85rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d8b4fe;
    border-radius: var(--radius, 0.35rem);
    background: #faf5ff;
}
.entity-ocr-field-legend[hidden] {
    display: none !important;
}
.entity-ocr-field-legend__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 0.45rem;
    border: 1px solid #d8b4fe;
    background: linear-gradient(145deg, #f3e8ff 0%, #ede9fe 55%, #fae8ff 100%);
    color: #7c3aed;
    box-shadow: 0 1px 2px rgba(88, 28, 135, 0.08);
}
.entity-ocr-field-legend__icon .btn__icon,
.entity-ocr-field-legend__icon svg {
    width: 1.1rem;
    height: 1.1rem;
}
.entity-ocr-field-legend__text {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b21a8;
}
.entity-ocr-field-legend__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
}
.entity-ocr-field-legend__title-row [data-ocr-legend-count] {
    line-height: 1.3;
}
.entity-ocr-field-legend__text .hint {
    font-weight: 500;
    color: #7c3aed;
}
.entity-ocr-field-legend__title-row .module-info-tip__trigger {
    width: 1.25rem;
    height: 1.25rem;
    color: #7c3aed;
    border-color: #d8b4fe;
    background: #faf5ff;
}
.entity-ocr-field-legend__title-row .module-info-tip__trigger:hover,
.entity-ocr-field-legend__title-row .module-info-tip__trigger:focus-visible,
.entity-ocr-field-legend__title-row .module-info-tip.is-open .module-info-tip__trigger {
    color: #6b21a8;
    border-color: #c084fc;
    background: #f3e8ff;
}
.entity-ocr-field-legend__dismiss {
    flex-shrink: 0;
    margin-left: auto;
}
/* Purple border on fields with a pending OCR reading */
.entity-form .entity-ocr-field-suggest,
.entity-form select.entity-ocr-field-suggest,
.entity-form input.entity-ocr-field-suggest,
.entity-form textarea.entity-ocr-field-suggest {
    border-color: #9333ea !important;
    box-shadow: 0 0 0 1px rgba(147, 51, 234, 0.35);
    background-color: #faf5ff;
}
.entity-form .entity-ocr-field-suggest:focus,
.entity-form select.entity-ocr-field-suggest:focus,
.entity-form input.entity-ocr-field-suggest:focus {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.28);
}
/* Per-field OCR picker (same idea as compose display name) */
.entity-ocr-field-popover {
    position: absolute;
    z-index: 210;
    min-width: 15rem;
    max-width: min(24rem, 94vw);
    padding: 0.7rem 0.75rem;
    border-radius: 0.45rem;
    border: 1px solid #d8b4fe;
    background: #faf5ff;
    box-shadow: 0 12px 32px rgba(88, 28, 135, 0.16);
}
.entity-ocr-field-popover[hidden] {
    display: none !important;
}
.entity-ocr-field-popover__title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #6b21a8;
    margin: 0 0 0.2rem;
}
.entity-ocr-field-popover__hint {
    margin: 0 0 0.5rem;
    font-size: 0.74rem;
    color: #7c3aed;
    line-height: 1.35;
}
.entity-ocr-field-popover__compare {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a78bfa;
    margin-bottom: 0.3rem;
}
.entity-ocr-field-popover__list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}
.entity-ocr-field-popover__option {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: left;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid #d8b4fe;
    border-radius: 0.35rem;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.entity-ocr-field-popover__option:hover,
.entity-ocr-field-popover__option:focus-visible {
    border-color: #9333ea;
    background: #f3e8ff;
    outline: none;
}
.entity-ocr-field-popover__formula {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7c3aed;
}
.entity-ocr-field-popover__value {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.4rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}
.entity-ocr-field-popover__from {
    color: #64748b;
    font-weight: 500;
}
.entity-ocr-field-popover__to-arrow {
    color: #c4b5fd;
}
.entity-ocr-field-popover__to {
    color: #6b21a8;
    font-weight: 700;
}
.entity-ocr-field-popover__actions {
    display: flex;
    justify-content: flex-end;
}
/* Display / client name composition picker */
.entity-name-suggest-popover {
    position: absolute;
    z-index: 210;
    min-width: 16rem;
    max-width: min(26rem, 94vw);
    padding: 0.7rem 0.75rem;
    border-radius: 0.45rem;
    border: 1px solid #93c5fd;
    background: #f0f9ff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}
.entity-name-suggest-popover[hidden] {
    display: none !important;
}
.entity-name-suggest-popover__title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #1e40af;
    margin: 0 0 0.2rem;
}
.entity-name-suggest-popover__hint {
    margin: 0 0 0.5rem;
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.35;
}
.entity-name-suggest-popover__list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 16rem;
    overflow: auto;
    margin-bottom: 0.5rem;
}
.entity-name-suggest-popover__option {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.1rem 0.5rem;
    align-items: start;
    text-align: left;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid #bfdbfe;
    border-radius: 0.35rem;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.entity-name-suggest-popover__option:hover,
.entity-name-suggest-popover__option:focus-visible {
    border-color: #3b82f6;
    background: #eff6ff;
    outline: none;
}
.entity-name-suggest-popover__option.is-current {
    border-color: #86efac;
    background: #f0fdf4;
}
.entity-name-suggest-popover__formula {
    grid-column: 1;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}
.entity-name-suggest-popover__value {
    grid-column: 1;
    font-size: 0.84rem;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}
.entity-name-suggest-popover__badge {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #15803d;
    background: #dcfce7;
    border-radius: 999px;
    padding: 0.15rem 0.4rem;
}
.entity-name-suggest-popover__actions {
    display: flex;
    justify-content: flex-end;
}
.entity-ocr-popover {
    position: absolute;
    z-index: 200;
    min-width: 14rem;
    max-width: min(24rem, 92vw);
    padding: 0.7rem 0.8rem;
    border-radius: 0.45rem;
    border: 1px solid #fb923c;
    background: #fffbeb;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.entity-ocr-popover__title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #9a3412;
    margin: 0 0 0.45rem;
}
.entity-ocr-popover__compare {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}
.entity-ocr-popover__row {
    display: grid;
    grid-template-columns: 4.2rem 1fr;
    gap: 0.35rem;
    align-items: start;
    font-size: 0.8125rem;
}
.entity-ocr-popover__k {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    padding-top: 0.15rem;
}
.entity-ocr-popover__row--ocr .entity-ocr-popover__k {
    color: #c2410c;
}
.entity-ocr-popover__row--ocr .entity-ocr-popover__v {
    font-weight: 700;
    color: #9a3412;
    word-break: break-word;
}
.entity-ocr-popover__row--cur .entity-ocr-popover__v {
    color: #475569;
    word-break: break-word;
}
.entity-ocr-popover__ask {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    color: #57534e;
    line-height: 1.35;
}
.entity-ocr-popover__actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.entity-form .entity-ocr-applied {
    outline: 2px solid #22c55e;
    outline-offset: 1px;
    transition: outline-color 0.2s ease;
}
/* OCR review modal (empty + all diffs) */
.entity-ocr-review-modal.modal-overlay {
    z-index: 1200;
}
.entity-ocr-review-modal__card {
    width: min(36rem, calc(100vw - 1.5rem));
    max-height: min(88vh, 40rem);
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.2rem 1rem;
    max-width: none;
}
.entity-ocr-review-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.entity-ocr-review-modal__head-text {
    min-width: 0;
}
.entity-ocr-review-modal__head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.entity-ocr-review-modal__lead {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
}
.entity-ocr-review-modal__modes {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
    padding: 0.2rem;
    border-radius: 0.45rem;
    background: #f1f5f9;
}
.entity-ocr-review-modal__mode {
    flex: 1;
    border: 0;
    background: transparent;
    border-radius: 0.35rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}
.entity-ocr-review-modal__mode[aria-selected="true"] {
    background: #fff;
    color: #9a3412;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
.entity-ocr-review-modal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
    font-size: 0.8rem;
}
.entity-ocr-review-modal__select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}
.entity-ocr-review-modal__body {
    overflow: auto;
    flex: 1;
    min-height: 8rem;
    max-height: 22rem;
    border: 1px solid #fed7aa;
    border-radius: 0.45rem;
    background: #fffbeb;
}
.entity-ocr-review-modal__row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem 0.65rem;
    align-items: start;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #ffedd5;
}
.entity-ocr-review-modal__row:last-child {
    border-bottom: 0;
}
.entity-ocr-review-modal__row input[type="checkbox"] {
    margin-top: 0.2rem;
}
.entity-ocr-review-modal__row-main {
    min-width: 0;
}
.entity-ocr-review-modal__field {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #9a3412;
    margin: 0 0 0.3rem;
}
.entity-ocr-review-modal__compare {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.4rem;
    font-size: 0.8125rem;
    line-height: 1.4;
}
.entity-ocr-review-modal__col-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.4rem;
    padding: 0.45rem 0.75rem 0.25rem 2.15rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    border-bottom: 1px solid #ffedd5;
}
.entity-ocr-review-modal__arrow {
    color: #cbd5e1;
    font-weight: 600;
    flex-shrink: 0;
}
.entity-ocr-review-modal__v--cur {
    color: #475569;
    word-break: break-word;
}
.entity-ocr-review-modal__v--ocr {
    font-weight: 700;
    color: #9a3412;
    word-break: break-word;
}
.entity-ocr-review-modal__empty {
    padding: 1.25rem 1rem;
    text-align: center;
    color: #57534e;
    font-size: 0.85rem;
    line-height: 1.45;
    border: 1px dashed #fdba74;
    border-radius: 0.45rem;
    background: #fff7ed;
}
.entity-ocr-review-modal__empty[hidden],
.entity-ocr-review-modal__body[hidden] {
    display: none !important;
}
.entity-ocr-review-modal__foot {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle, #e5e7eb);
}
.entity-bank-form--paste-edit .entity-bank-paste {
    border: 1px solid #fdba74;
    border-radius: var(--radius, 0.35rem);
    padding: 0.65rem 0.75rem;
    background: #fff7ed;
}
.entity-detail-tabs {
    margin-bottom: 0.65rem;
}
/* Tier Preset tab — distinct accent (violet) vs default primary blue */
.entity-detail-tabs .tab.tab--tier-preset {
    color: #6d28d9;
}
.entity-detail-tabs .tab.tab--tier-preset:hover {
    color: #5b21b6;
    border-bottom-color: #c4b5fd;
}
.entity-detail-tabs .tab.tab--tier-preset.active {
    color: #5b21b6;
    border-bottom-color: #7c3aed;
    font-weight: 600;
}
.entity-detail-section--tier-preset .deal-detail-section-title {
    color: #5b21b6;
}
.entity-detail-section {
    margin-bottom: 0.65rem;
}
.entity-detail-remarks-head {
    margin-top: 0.85rem;
}
.entity-detail-remarks {
    margin: 0;
    padding: 0.65rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    line-height: 1.45;
    white-space: pre-wrap;
}
.entity-detail-hint {
    margin: 0 0 0.65rem;
    font-size: 0.8125rem;
}
.entity-detail-form-panel {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}
.entity-bank-form-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}
.entity-bank-form-panel .deal-detail-section-head {
    margin-bottom: 0.65rem;
}
.entity-bank-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.entity-bank-paste__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}
.entity-bank-paste__head .entity-inline-form-section__title {
    margin-bottom: 0.2rem;
}
.entity-bank-paste__head .entity-inline-form-section__desc {
    margin: 0;
}
.entity-bank-paste__input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.4;
    min-height: 6.5rem;
}
.entity-bank-paste__status {
    margin: 0.4rem 0 0;
}
.entity-bank-paste__status.is-ok {
    color: #166534;
}
.entity-bank-paste__status.is-error {
    color: #b91c1c;
}
.entity-inline-form-section {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.entity-inline-form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}
.entity-inline-form-section__title {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}
.entity-inline-form-section__desc {
    margin: -0.35rem 0 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
}
.entity-inline-form-grid {
    display: grid;
    gap: 0.65rem 1rem;
}
.entity-inline-form-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.entity-inline-form-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.entity-inline-form-grid .field label,
.entity-kyc-review-grid .field label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}
.entity-inline-form-grid .field .form-input,
.entity-kyc-review-grid .field .form-input {
    width: 100%;
}
.entity-inline-form-grid .field--full,
.entity-kyc-review-grid .field--full {
    grid-column: 1 / -1;
}
.entity-inline-form-section--flags {
    padding-bottom: 0.65rem;
}
.entity-flag-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}
.entity-flag-toggle {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0.05rem 0.55rem;
    align-items: start;
    min-width: 11rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.entity-flag-toggle:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.entity-flag-toggle input {
    margin: 0.15rem 0 0;
    grid-row: 1 / span 2;
}
.entity-flag-toggle__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}
.entity-flag-toggle__hint {
    font-size: 0.68rem;
    color: var(--muted);
    line-height: 1.3;
}
.entity-inline-form-actions,
.entity-kyc-form__actions,
.entity-kyc-upload-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    padding-top: 0.15rem;
}
.entity-kyc-input-block {
    margin-top: 0.75rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}
.entity-kyc-input-block--remove {
    background: #fff;
}
.entity-kyc-input-block__title {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
}
.entity-kyc-panel .entity-kyc-documents-upload {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}
.entity-kyc-panel .entity-kyc-documents-upload .entry-documents-placeholder {
    gap: 0.15rem;
}
.entity-kyc-panel .entity-kyc-documents-upload .entry-documents-icon {
    font-size: 1rem;
}
.entity-kyc-panel .form-input,
.entity-detail-page .entity-kyc-panel .form-input {
    width: 100%;
    padding: 0.42rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #1e293b;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.entity-kyc-panel .form-input:hover,
.entity-detail-page .entity-kyc-panel .form-input:hover {
    border-color: #94a3b8;
}
.entity-kyc-panel .form-input:focus,
.entity-detail-page .entity-kyc-panel .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring), inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.entity-kyc-panel .form-input--date,
.entity-detail-page .entity-kyc-panel .form-input--date {
    font-variant-numeric: tabular-nums;
}
.entity-kyc-panel .form-select-wrap,
.entity-detail-page .entity-kyc-panel .form-select-wrap {
    position: relative;
    display: block;
}
.entity-kyc-panel .form-select-wrap::after,
.entity-detail-page .entity-kyc-panel .form-select-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.55rem;
    width: 0.45rem;
    height: 0.45rem;
    pointer-events: none;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: translateY(-65%) rotate(45deg);
}
.entity-kyc-panel .form-select-wrap .form-input,
.entity-kyc-panel .form-select-wrap select,
.entity-detail-page .entity-kyc-panel .form-select-wrap .form-input,
.entity-detail-page .entity-kyc-panel .form-select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 1.75rem;
    cursor: pointer;
}
.entity-kyc-panel .field label,
.entity-kyc-panel .entity-kyc-review-grid .field label,
.entity-kyc-panel .entity-kyc-upload-slot__expiry label {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
}
.entity-kyc-input-block--uploads {
    background: #f1f5f9;
    padding: 0.5rem 0.55rem;
}
.entity-kyc-remove-docs {
    margin: 0;
}
.entity-kyc-remove-chips {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
}
.entity-kyc-doc-chip {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.78rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.entity-kyc-doc-chip:has(input:checked) {
    border-color: #fca5a5;
    background: #fef2f2;
}
.entity-kyc-doc-chip:has(input:checked) .entity-kyc-doc-chip__action {
    color: #b91c1c;
    font-weight: 600;
}
.entity-kyc-doc-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.entity-kyc-doc-chip__icon {
    font-size: 0.9rem;
    line-height: 1;
}
.entity-kyc-doc-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334155;
}
.entity-kyc-doc-chip__action {
    font-size: 0.68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.entity-kyc-review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.65rem;
}
.entity-kyc-form {
    margin-top: 0.75rem;
}
.entity-kyc-checklist__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
}
.entity-kyc-checklist__score {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1d4ed8;
    font-variant-numeric: tabular-nums;
}
.entity-kyc-checklist__progress {
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-bottom: 0.55rem;
}
.entity-kyc-checklist__progress-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
}
.entity-kyc-checklist-items {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.entity-kyc-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.78rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.entity-kyc-checklist-item:has(input:checked) {
    border-color: #86efac;
    background: #f0fdf4;
}
.entity-kyc-checklist-item input {
    margin: 0.12rem 0 0;
    flex-shrink: 0;
}
.entity-kyc-checklist-item__body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    flex: 1;
    min-width: 0;
}
.entity-kyc-checklist-item__label {
    line-height: 1.35;
    color: #334155;
}
.entity-kyc-checklist-item__weight {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.entity-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.5rem 0.85rem;
    margin-bottom: 0.55rem;
}
.entity-form-grid .field label {
    font-size: 0.75rem;
    color: var(--muted);
}
.entity-kyc-checklist {
    margin: 0.65rem 0;
}
.entity-kyc-checklist .check-item {
    display: block;
    font-size: 0.8125rem;
    margin-bottom: 0.35rem;
}
@media (max-width: 720px) {
    .entity-inline-form-grid--2,
    .entity-inline-form-grid--3,
    .entity-kyc-review-grid,
    .entity-kyc-upload-grid,
    .entity-kyc-scorecard {
        grid-template-columns: 1fr;
    }
    .entity-kyc-upload-slot__top {
        grid-template-columns: 1fr;
    }
    .entity-kyc-scorecard-row__label {
        white-space: normal;
    }
    .entity-flag-toggles {
        flex-direction: column;
    }
    .entity-flag-toggle {
        min-width: 0;
        width: 100%;
    }
}
.entity-entries-table .entry-amount .hint {
    display: block;
    font-size: 0.72rem;
}
.entity-balance-table .balance-bucket-line {
    font-size: 0.8125rem;
}
.entity-profile-table th {
    width: 11rem;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}
.entity-formset-row {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
}
.entity-formset-row:last-child {
    border-bottom: none;
}
.entity-formset-rows {
    margin-top: 0.35rem;
}

.deal-add-entries-actions {
    margin-top: 0.55rem;
}

.review-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}
@media (max-width: 720px) { .review-cols { grid-template-columns: 1fr; } }
.wizard-review-page .review-cols {
    gap: 1.25rem;
    align-items: start;
}
.wizard-review-page .review-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem 1.15rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    min-width: 0;
}
.wizard-review-page .review-col--channel {
    border-top: 3px solid #3b82f6;
}
.wizard-review-page .review-col--cp {
    border-top: 3px solid #f97316;
}
.review-col-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.review-col--channel .review-col-title { color: #1d4ed8; border-color: #bfdbfe; }
.review-col--cp .review-col-title { color: #c2410c; border-color: #fed7aa; }
.wizard-review-page .review-col-title {
    margin: 0 0 0.55rem;
    padding-bottom: 0.35rem;
    font-size: 0.7rem;
}
.wizard-review-page .review-col {
    padding: 0.85rem 1rem 1rem;
}
.wizard-review-page .review-leg-name {
    font-size: 0.8rem;
    font-weight: 500;
}
.wizard-review-page .review-leg-card {
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.55rem;
}
.wizard-review-page .review-leg-head .type-badge {
    font-size: 0.65rem;
    padding: 0.06rem 0.35rem;
}
.wizard-review-page .repeater-head h4 {
    font-size: 0.8125rem;
    font-weight: 600;
}
.wizard-review-page .repeater-head .hint {
    font-size: 0.72rem;
}
.wizard-review-page .form-input-amount-sm,
.wizard-review-page .form-input-ccy-sm,
.wizard-review-page .form-input-entity {
    font-size: 0.8125rem;
    padding: 0.4rem 0.55rem;
}
.wizard-review-page .field-inline-label {
    font-size: 0.75rem;
}
.wizard-review-page .ccy-tag {
    font-size: 0.75rem;
}
.wizard-page .form-actions .btn,
.wizard-review-page .form-actions--sticky .btn {
    font-size: 0.8125rem;
}

.review-leg-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}
.wizard-review-page .review-leg-card {
    background: #fafbfc;
    border-color: #e5e7eb;
    transition: border-color 0.15s ease;
}
.wizard-review-page .review-leg-card:focus-within {
    border-color: #93c5fd;
}
.review-leg-card--warn { border-color: #fcd34d; background: #fffdf5; }
.review-leg-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.review-leg-name { font-weight: 600; font-size: 0.9rem; }
.review-leg-entity { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.review-leg-fields { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.wizard-review-page .review-leg-fields {
    gap: 0.55rem 0.65rem;
}
.wizard-review-page .review-leg-fields .rate-pair {
    flex: 1 1 100%;
    margin-top: 0.15rem;
}
.wizard-review-page .review-leg-fields .rate-input {
    width: 7rem;
    font-size: 0.8125rem;
    padding: 0.4rem 0.55rem;
}
.wizard-review-page .review-leg-fields .rate-label,
.wizard-review-page .review-leg-fields .rate-formula,
.wizard-review-page .review-leg-fields .rate-formula--ccy {
    font-size: 0.75rem;
}

.type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: #f3f4f6;
    color: var(--muted);
}
.type-deposit { background: #d1fae5; color: #065f46; }
.type-withdrawal { background: #fee2e2; color: #991b1b; }
.type-fx { background: #e0e7ff; color: #3730a3; }

.field-inline { display: flex; align-items: center; gap: 0.35rem; }
.field-inline-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.form-input-sm { width: 7rem; padding: 0.4rem 0.5rem; font-variant-numeric: tabular-nums; }
.wizard-review-page .form-input-amount-sm {
    width: 8rem;
    min-width: 6.5rem;
    font-variant-numeric: tabular-nums;
}
.wizard-review-page .form-input-ccy-sm {
    width: 5.5rem;
    min-width: 5rem;
}
.wizard-review-page .form-input-entity {
    flex: 1 1 12rem;
    min-width: 11rem;
    max-width: none;
    width: 100%;
}
.wizard-review-page .field-inline--entity {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    gap: 0.5rem;
}
.wizard-review-page .field-inline--entity .field-inline-label {
    flex: 0 0 auto;
    min-width: 4.5rem;
}
.wizard-review-page .field-inline--full {
    flex: 1 1 100%;
    min-width: 12rem;
}
.wizard-review-page .field-inline--full .form-input {
    flex: 1;
    min-width: 0;
}
.wizard-review-page .field-inline--entity select {
    flex: 1 1 auto;
    min-width: 0;
}
.ccy-tag { font-weight: 700; font-size: 0.8rem; min-width: 2.25rem; }

.form-actions--sticky {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}
.wizard-review-page .form-actions--sticky {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: 1rem;
    padding: 0.85rem 0 0.25rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, var(--bg) 35%);
}

.modal-overlay[hidden] {
    display: none !important;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(2px);
}
/* Above entity/outstanding drawers (1200) so approve works from Launchpad drawer. */
.entry-approve-modal.modal-overlay,
.entry-batch-approve-modal.modal-overlay,
.deal-edit-choice-modal.modal-overlay {
    z-index: var(--z-batch-approve-modal, 1280);
    pointer-events: auto;
}
.modal-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    position: relative;
    z-index: 1;
}
/* ClearDil review: stay above app sidebar and fit in main content (not full viewport) */
.cleardil-hit-modal.modal-overlay {
    z-index: var(--z-batch-approve-modal, 1280);
    padding: 1rem;
    box-sizing: border-box;
    /* Prefer centering over the main column so the sidebar never covers the card */
    justify-content: center;
    align-items: center;
}
@media (min-width: 1181px) {
    body.app-body:not(.app-sidebar-collapsed) .cleardil-hit-modal.modal-overlay {
        padding-left: calc(var(--app-sidebar-width) + 1rem);
    }
    body.app-body.app-sidebar-collapsed .cleardil-hit-modal.modal-overlay {
        padding-left: calc(var(--app-sidebar-width-collapsed) + 1rem);
    }
}
.modal-card.cleardil-hit-modal__card {
    width: min(52rem, 100%);
    max-width: min(52rem, 100%);
    max-height: min(90vh, 100dvh);
    padding: 0;
}
.modal-card h2 { margin-bottom: 0.5rem; }
.modal-warnings { margin: 1rem 0 1rem 1.25rem; font-size: 0.9rem; color: #92400e; }
.entry-approve-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -0.15rem 0 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.entry-approve-modal__head-text {
    min-width: 0;
}
.entry-approve-modal__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.entry-approve-modal__uid {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
}
.entry-batch-approve-modal__uids {
    margin: 0 0 1rem;
}
.entry-approve-form--modal {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.entry-approve-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
body.modal-open {
    overflow: hidden;
}

.modal-card--entry-edit {
    max-width: min(1120px, 96vw);
    width: 96vw;
    height: min(90vh, 920px);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 1rem 1rem;
}

.deal-entry-edit-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.deal-entry-edit-modal__head-start {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.deal-entry-edit-modal__tabs {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.15rem;
    border-radius: 8px;
    background: #f1f5f9;
}

.deal-entry-edit-tab {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
}

.deal-entry-edit-tab.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.deal-entry-edit-modal__head h2 {
    margin: 0;
    font-size: 1rem;
}

.entry-form-embed-head__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.deal-edit-embed__head {
    margin-bottom: 0.85rem;
}

.deal-edit-embed__title {
    margin: 0;
    font-size: 1rem;
}

.deal-edit-embed__subtitle {
    margin: 0.2rem 0 0;
}

.deal-edit-embed__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.deal-edit-embed__actions-main {
    display: flex;
    gap: 0.5rem;
}

.deal-edit-embed__hint {
    margin: 0.45rem 0 0;
}

.deal-entry-edit-modal__frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.deal-entry-row--editable {
    cursor: pointer;
}

.deal-entry-row--editable:hover {
    background: #f8fafc;
}

.container--embed {
    padding-top: 0.75rem;
    padding-bottom: 1rem;
}

.entry-form-page--embed .entry-form-embed-head {
    margin-bottom: 0.75rem;
}

.entry-form-page--embed .entry-form-embed-title {
    margin: 0;
    font-size: 1rem;
}

.entry-form-page--embed .entry-form-embed-subtitle {
    margin: 0.2rem 0 0;
}

.entry-form-page--embed .form-actions--embed {
    position: static;
    margin-top: 0.75rem;
}


.repeater-section {
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}
.wizard-review-page .repeater-section {
    background: #fff;
    border-style: solid;
    border-color: #e2e8f0;
}
.wizard-review-page .repeater-row {
    display: grid;
    grid-template-columns: auto 5.5rem minmax(7rem, 9rem) minmax(11rem, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.wizard-review-page .repeater-row:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}
@media (max-width: 900px) {
    .wizard-review-page .repeater-row {
        grid-template-columns: auto 5rem 1fr;
    }
    .wizard-review-page .repeater-row .form-input-entity {
        grid-column: 1 / -2;
    }
    .wizard-review-page .repeater-row .btn-sm {
        grid-column: -1;
        grid-row: 1 / span 2;
        align-self: start;
    }
}
.repeater-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.65rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.repeater-head h4 { font-size: 0.9rem; }
.repeater-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.repeater-dependent { min-width: 7.5rem; max-width: 10rem; }
.wizard-review-page .repeater-dependent {
    min-width: 11rem;
    max-width: none;
}
.repeater-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.amount-input-wrap--sm { padding: 0 0.35rem; }
.amount-input-wrap--sm .amount-input { padding: 0.35rem 0 !important; font-size: 0.85rem; }
.wizard-review-page .amount-input-wrap--sm {
    min-width: 0;
    padding: 0 0.4rem;
}
.wizard-review-page .amount-input-wrap--sm .amount-input {
    font-size: 0.8125rem;
}
.wizard-review-page .btn-remove-repeater-row {
    padding: 0.35rem 0.45rem;
    min-width: 2rem;
}

/* Real-time balance toast (subtle, non-blocking) */
#balance-toast-root {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    pointer-events: none;
}
.balance-toast {
    font-size: 0.8rem;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.7rem;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 16rem;
}
.balance-toast--visible {
    opacity: 1;
    transform: translateY(0);
}
.balance-table tr.balance-row--flash td {
    animation: balance-row-flash 1.1s ease;
}
@keyframes balance-row-flash {
    0% { background-color: transparent; }
    18% { background-color: #eff6ff; }
    100% { background-color: transparent; }
}
.balance-live-indicator {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.balance-live-indicator--on {
    background: #86efac;
    box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.35);
}
.balance-live-indicator--off {
    background: #cbd5e1;
}

/* === App drawer navigation (mobile/tablet < 1181px) — in main.css so it always loads === */
#app-shell-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.app-shell-nav {
    position: relative;
}
.topbar-fx-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    text-decoration: none;
    flex-shrink: 0;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border: 1px solid rgba(91, 33, 182, 0.45);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.28), 0 2px 6px rgba(15, 23, 42, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.topbar-fx-mobile__orb {
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar-fx-mobile__orb .nav-icon {
    width: 1.2rem;
    height: 1.2rem;
    color: #fff;
    opacity: 1;
    stroke-width: 2.25;
}
.topbar-fx-mobile:hover,
.topbar-fx-mobile:focus-visible {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.34), 0 4px 10px rgba(15, 23, 42, 0.1);
}
.topbar-fx-mobile.is-active {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22), 0 10px 24px rgba(124, 58, 237, 0.3);
}
.app-nav-drawer__fx-spotlight {
    padding: 0.75rem 0.85rem 0.35rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #f5f3ff 0%, #fff 100%);
}
.app-nav-drawer__fx-eyebrow {
    margin: 0 0 0.45rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7c3aed;
}
.app-nav-drawer__fx-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 0.8rem;
    border-radius: 0.85rem;
    text-decoration: none;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 52%, #0891b2 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 14px 34px rgba(79, 70, 229, 0.35), 0 4px 12px rgba(15, 23, 42, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.app-nav-drawer__fx-card:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 18px 40px rgba(79, 70, 229, 0.42), 0 6px 16px rgba(15, 23, 42, 0.14);
}
.app-nav-drawer__fx-card.is-active {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35), 0 16px 36px rgba(79, 70, 229, 0.38);
}
.app-nav-drawer__fx-glow {
    position: absolute;
    inset: -40% auto auto -20%;
    width: 9rem;
    height: 9rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.34) 0%, transparent 68%);
    pointer-events: none;
}
.app-nav-drawer__fx-orb {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    flex-shrink: 0;
}
.app-nav-drawer__fx-orb .nav-icon {
    width: 1.35rem;
    height: 1.35rem;
    color: #fff;
    opacity: 1;
}
.app-nav-drawer__fx-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    flex: 1;
}
.app-nav-drawer__fx-copy strong {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.app-nav-drawer__fx-copy span {
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.88);
}
.app-nav-drawer__fx-arrow {
    position: relative;
    z-index: 1;
    font-size: 1.15rem;
    font-weight: 700;
    opacity: 0.9;
}
.list-filter-backdrop {
    display: none;
}
.entries-filter-toggle.is-active,
.deals-filter-toggle.is-active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

/* Applied filter conditions (entries / deals / entities) */
.entries-filter-field.is-filter-active,
.deals-filter-field.is-filter-active {
    border-radius: 0.55rem;
    padding: 0.35rem 0.45rem 0.45rem;
    margin: -0.35rem -0.45rem -0.15rem;
    background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}

.entries-filter-field.is-filter-active > label,
.deals-filter-field.is-filter-active > label {
    color: var(--primary, #2563eb);
    font-weight: 700;
}

.entries-filter-field.is-filter-active .form-input,
.entries-filter-field.is-filter-active .form-select,
.deals-filter-field.is-filter-active .form-input,
.deals-filter-field.is-filter-active .form-select {
    border-color: #93c5fd;
    background-color: #fff;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}
.list-filter-close {
    margin-right: auto;
}
.app-nav-open-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}
.app-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 0.55rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #334155;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.app-nav-toggle .nav-icon {
    width: 1.2rem;
    height: 1.2rem;
    stroke-width: 2.25;
}
.app-nav-toggle:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
.app-nav-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
.app-nav-open-input:checked ~ header .app-nav-toggle {
    border-color: #93c5fd;
    background: var(--primary-soft);
    color: var(--primary);
}
body.app-nav-open {
    overflow: hidden;
}
.app-nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    visibility: hidden;
}
.app-nav-open-input:checked ~ .app-nav-drawer {
    pointer-events: auto;
    visibility: visible;
}
.app-nav-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.22s ease;
    cursor: pointer;
}
.app-nav-open-input:checked ~ .app-nav-drawer .app-nav-drawer__backdrop {
    opacity: 1;
}
.app-nav-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18.5rem, 88vw);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.app-nav-open-input:checked ~ .app-nav-drawer .app-nav-drawer__panel {
    transform: translateX(0);
}
.app-nav-drawer__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.85rem 0.85rem 0.65rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.app-nav-drawer__user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}
.app-nav-drawer__user .topbar-user-meta {
    display: flex;
}
.app-nav-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.app-nav-drawer__close:hover {
    background: #f1f5f9;
    color: var(--text);
}
.app-nav-drawer__company {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
}
.app-nav-drawer__company-form,
.app-nav-drawer__company .topbar-company-badge {
    width: 100%;
}
.app-nav-drawer__nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.app-nav-drawer__link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.62rem 0.7rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}
.app-nav-drawer__link:hover {
    background: #f1f5f9;
    color: var(--primary);
}
.app-nav-drawer__link.is-active {
    background: var(--primary-soft);
    color: var(--primary);
}
.app-nav-drawer__link .nav-icon {
    width: 1.05rem;
    height: 1.05rem;
    opacity: 0.82;
}
.app-nav-drawer__footer {
    padding: 0.75rem 0.85rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: #f8fafc;
}
.app-nav-drawer__footer .topbar-lang {
    justify-content: flex-start;
}
.app-nav-drawer__logout {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

/* Drawer mode default (< 1181px) — #app-shell-nav ID beats any .topbar-nav rule */
#app-shell-nav .topbar.app-topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 0.5rem 0.75rem;
}
#app-shell-nav .topbar.app-topbar.topbar--has-fx-wizard {
    padding-bottom: 0.5rem !important;
    overflow: visible;
}
#app-shell-nav .app-nav-toggle {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
#app-shell-nav .topbar .topbar-nav,
#app-shell-nav .topbar-nav.topbar-nav--desktop {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
}
#app-shell-nav .topbar-item--desktop-only {
    display: none !important;
}
#app-shell-nav .topbar-fx-mobile {
    display: inline-flex !important;
}

@media (min-width: 1181px) {
    #app-shell-nav .topbar.app-topbar {
        grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto) !important;
    }
    #app-shell-nav .app-nav-toggle {
        display: none !important;
    }
    #app-shell-nav .topbar .topbar-nav,
    #app-shell-nav .topbar-nav.topbar-nav--desktop {
        display: flex !important;
        visibility: visible !important;
        height: auto !important;
        overflow: visible !important;
        pointer-events: auto !important;
    }
    #app-shell-nav .app-nav-drawer {
        display: none !important;
    }
    #app-shell-nav .topbar-item--desktop-only {
        display: block !important;
    }
    #app-shell-nav .topbar-start .topbar-item--desktop-only.topbar-control,
    #app-shell-nav .topbar-start .topbar-item--desktop-only.topbar-company-badge {
        display: inline-flex !important;
    }
    /* Restore flex layouts — blanket display:block breaks topbar-end chips */
    #app-shell-nav .topbar-end .topbar-user-chip.topbar-item--desktop-only {
        display: inline-flex !important;
        align-items: center !important;
        flex-shrink: 0;
    }
    #app-shell-nav .topbar-end .topbar-user-chip .topbar-user-meta {
        display: flex !important;
        flex-direction: column !important;
    }
    #app-shell-nav .topbar-end .topbar-logout-form.topbar-item--desktop-only {
        display: inline-flex !important;
        flex-shrink: 0;
    }
    #app-shell-nav .topbar-end > .topbar-item--desktop-only:has(.topbar-lang) {
        display: inline-flex !important;
        flex-shrink: 0;
    }
    #app-shell-nav .topbar-end .topbar-divider.topbar-item--desktop-only {
        display: block !important;
    }
    #app-shell-nav .topbar-fx-mobile {
        display: none !important;
    }
}

/* === App shell: left sidebar + top header === */
body.app-body {
    background: var(--bg);
}
.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: stretch;
    margin: 0;
    padding: 0;
}
.app-shell__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.app-shell__main > .container,
.app-shell__main > .container--wide,
.app-shell__main > .container--full {
    flex: 1;
}

.app-sidebar-open-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}
.app-sidebar {
    flex-shrink: 0;
    width: var(--app-sidebar-width);
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 70;
    overflow: visible;
}
.app-sidebar__backdrop {
    display: none;
}
.app-sidebar__panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 100dvh;
    position: sticky;
    top: 0;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: linear-gradient(180deg, #1e293b 0%, #111827 55%, #0f172a 100%);
    border: none;
    border-right: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: none;
    color: #e2e8f0;
    overflow: visible;
    isolation: isolate;
}
.app-sidebar__head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-bottom: none;
    margin-bottom: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 30;
    background: transparent;
}
/* Desktop classic head: company + collapse in a row */
.app-sidebar__head--desktop {
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.85rem 0.65rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
}
.app-sidebar__head--mobile {
    display: flex;
}
.app-sidebar__head .app-sidebar__trial-chip--head {
    margin: 0.55rem 0.65rem 0.55rem;
    width: auto;
}
.app-sidebar__account {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.app-sidebar__account .app-sidebar__user-menu {
    flex: 1 1 auto;
    min-width: 0;
}

/* Dark overlay when account sheet is open (nav stays put underneath) */
.app-sidebar__account-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 25;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: none;
}
.app-sidebar__panel.is-account-menu-open {
    position: relative;
}
.app-sidebar__panel.is-account-menu-open .app-sidebar__account-overlay {
    display: block;
    pointer-events: auto;
}

/*
 * Account section — full-bleed aurora header (no white card border).
 */
.app-sidebar__account-section {
    position: relative;
    width: 100%;
    border-radius: 0;
    border: 0;
    /* Clip aurora so it never peeks outside the drawer when closed */
    overflow: hidden;
    margin: 0;
    padding-top: env(safe-area-inset-top, 0px);
    background: #0f172a;
    z-index: 30;
}
.app-sidebar__account-section.is-open {
    overflow: visible; /* company dropdown */
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.45);
}
.app-sidebar__account-photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 30%;
    background-repeat: no-repeat;
    /* No scale — scale leaked past translateX(-100%) when drawer closed */
    transform: none;
    z-index: 0;
    pointer-events: none;
}
.app-sidebar__account-wash {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    /* Darker wash so avatar / name stay readable over aurora */
    background:
        linear-gradient(
            165deg,
            rgba(15, 23, 42, 0.58) 0%,
            rgba(30, 58, 138, 0.52) 38%,
            rgba(15, 23, 42, 0.78) 100%
        ),
        linear-gradient(
            180deg,
            rgba(2, 6, 23, 0.42) 0%,
            rgba(15, 23, 42, 0.55) 45%,
            rgba(2, 6, 23, 0.72) 100%
        );
}
.app-sidebar__account-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
    min-height: 11.5rem;
    /* Extra top/bottom padding inside avatar section */
    padding: 1.15rem 0 1.35rem;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.app-sidebar__account-bar .app-sidebar__account-trigger {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 10.5rem;
    padding: 1.55rem 0.95rem 1.65rem;
    gap: 0.75rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.app-sidebar__account-bar .app-sidebar__collapse {
    position: absolute;
    top: 0.55rem;
    right: 0.4rem;
    margin: 0;
    flex-shrink: 0;
    z-index: 3;
}
.app-sidebar__account-section .app-user-menu__meta {
    align-items: center;
    width: 100%;
}
.app-sidebar__account-name-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    max-width: 100%;
}
.app-sidebar__account-live {
    flex-shrink: 0;
}
.app-sidebar__account-section .app-user-menu__name {
    color: #f8fafc;
    font-size: 1.08rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    text-shadow: 0 1px 8px rgba(15, 23, 42, 0.45);
}
.app-sidebar__account-section .app-user-menu__role {
    color: rgba(219, 234, 254, 0.95);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    text-align: center;
    text-shadow: 0 1px 6px rgba(15, 23, 42, 0.4);
}
.app-sidebar__account-section .app-sidebar__account-avatar,
.app-sidebar__account-section .app-user-menu__avatar {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 1.65rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.35),
        0 8px 20px rgba(15, 23, 42, 0.35);
}
.app-sidebar__account-section .app-user-menu__chevron {
    position: absolute;
    bottom: 0.6rem;
    right: 0.7rem;
    opacity: 0.85;
    color: #fff;
}
.app-sidebar__account-section .app-user-menu__chevron .nav-icon {
    width: 1.05rem;
    height: 1.05rem;
}
.app-sidebar__account-section .app-user-menu__trigger:hover {
    background: rgba(255, 255, 255, 0.06);
}

/*
 * Expanded account = overlay sheet (covers nav; does not push links).
 */
.app-sidebar__account-section .app-sidebar__account-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    bottom: auto;
    margin: 0;
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0 0 0.85rem 0.85rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.55);
    padding: 0.75rem 0.75rem 0.85rem;
    overflow: visible;
    z-index: 35;
    max-height: min(70vh, 28rem);
    overflow-y: auto;
}
.app-sidebar__account-section .app-sidebar__account-panel[hidden] {
    display: none !important;
}
.app-sidebar__account-company {
    width: 100%;
    margin: 0 0 0.65rem;
    position: relative;
    z-index: 6;
}
.app-sidebar__account-company .app-sidebar__company-switcher,
.app-sidebar__account-company .app-sidebar__company-badge {
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148, 163, 184, 0.28);
    padding: 0.15rem;
}
.app-sidebar__account-company .app-sidebar__company-trigger {
    padding: 0.65rem 0.7rem;
}
.app-sidebar__account-company .app-sidebar__company-menu {
    z-index: 50;
}
/* Even tools: language · notification · theme (live sits next to name) */
.app-sidebar__account-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.35rem 0.15rem 0.55rem;
}
.app-sidebar__account-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.35rem;
}
.app-sidebar__account-tools:has(.app-sidebar__account-tool:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* Larger, squarer language switcher */
.app-sidebar__account-tools .app-sidebar__lang.topbar-lang,
.app-sidebar__lang--square.topbar-lang {
    display: inline-flex;
    padding: 0.15rem;
    gap: 0.15rem;
    border-radius: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: none;
    overflow: hidden;
}
.app-sidebar__account-tools .app-sidebar__lang-btn,
.app-sidebar__lang--square .app-sidebar__lang-btn {
    min-width: 2.15rem;
    height: 2.15rem;
    padding: 0 0.45rem;
    border-radius: 0.35rem;
    font-size: 0.72rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: 0.02em;
}
.app-sidebar__account-tools .app-sidebar__lang-btn.is-active {
    background: rgba(37, 99, 235, 0.55);
    color: #f8fafc;
    box-shadow: none;
}
.app-sidebar__account-tools .app-theme-toggle,
.app-sidebar__account-tools .app-notification-bell {
    width: 2.25rem;
    height: 2.25rem;
}
.app-sidebar__account-tools .app-theme-toggle .nav-icon,
.app-sidebar__account-tools .app-theme-toggle svg,
.app-sidebar__account-tools .app-notification-bell .nav-icon {
    width: 1.1rem;
    height: 1.1rem;
}
.app-sidebar__account-section .app-user-menu__divider {
    margin: 0.2rem 0.15rem;
    background: rgba(148, 163, 184, 0.22);
}
.app-sidebar__account-item {
    padding: 0.75rem 0.85rem !important;
    border-radius: 0.55rem;
    min-height: 2.75rem;
}
.app-sidebar__account-section .app-user-menu__item {
    margin: 0.1rem 0;
}
.app-sidebar__company-wrap {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}
.app-sidebar__company-switcher,
.app-sidebar__company-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.app-sidebar__company-switcher {
    position: relative;
    padding: 0;
    /* Avoid clipping the floating menu */
    overflow: visible;
}
.app-sidebar__company-switcher:hover,
.app-sidebar__company-switcher:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.35);
}
.app-sidebar__company-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    color: #93c5fd;
}
.app-sidebar__company-icon .nav-icon {
    width: 1rem;
    height: 1rem;
}
/* Custom company menu (native <select> options cannot be themed reliably on Windows). */
.app-sidebar__company-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0.45rem 0.55rem;
    border: 0;
    background: transparent;
    color: #f8fafc;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.app-sidebar__company-trigger:focus {
    outline: none;
}
.app-sidebar__company-trigger:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.55);
}
.app-sidebar__company-trigger-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar__company-chevron {
    flex-shrink: 0;
    width: 0.7rem;
    height: 0.7rem;
    margin-left: 0.15rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.9;
    transition: transform 0.15s ease;
}
.app-sidebar__company-switcher:has(.app-sidebar__company-trigger[aria-expanded="true"]) .app-sidebar__company-chevron {
    transform: rotate(180deg);
}
.app-sidebar__company-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: min(16rem, 50vh);
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.5rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.35),
        0 14px 32px rgba(2, 6, 23, 0.55);
}
.app-sidebar__company-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: #e2e8f0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.app-sidebar__company-option:hover,
.app-sidebar__company-option:focus-visible {
    background: rgba(59, 130, 246, 0.22);
    color: #f8fafc;
    outline: none;
}
.app-sidebar__company-option.is-selected {
    background: rgba(59, 130, 246, 0.28);
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}
.app-sidebar__company-option-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-sidebar__company-option-check {
    flex-shrink: 0;
    color: #93c5fd;
    font-size: 0.75rem;
    font-weight: 800;
}
.app-sidebar__company-name {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.18s ease, width 0.18s ease;
}
.app-sidebar__collapse {
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.app-sidebar__collapse:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.35);
}
.app-sidebar__collapse .nav-icon {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}
body.app-sidebar-collapsed .app-sidebar__collapse .nav-icon {
    transform: rotate(180deg);
}
.app-sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow: visible;
    padding: 0.35rem 0 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.app-sidebar__nav-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.app-sidebar__fx-rail {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    pointer-events: none;
}
.app-sidebar__group-label {
    margin: 0.55rem 0.65rem 0.2rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    white-space: nowrap;
    transition: opacity 0.18s ease;
}
/* Desktop defaults (compact). Mobile overrides under max-width: 1023px. */
.app-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.58rem 0.85rem;
    min-height: 0;
    border-radius: 0;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
}
.app-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}
.app-sidebar__link.is-active {
    background: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}
.app-sidebar__link .nav-icon {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    opacity: 0.92;
}
.app-sidebar__link-text {
    white-space: nowrap;
    transition: opacity 0.18s ease, width 0.18s ease;
}
.app-sidebar__fx-spotlight {
    position: relative;
    margin: 0;
    padding: 0;
    overflow: visible;
    pointer-events: auto;
}
.app-sidebar__fx-inline {
    display: none;
}
.app-sidebar--fx-compact .app-sidebar__fx-rail {
    display: none;
}
.app-sidebar--fx-compact .app-sidebar__fx-inline {
    display: flex;
}
/* Compact fallback: inline nav row keeps featured FX styling (icon + label layout) */
.app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx {
    width: 100%;
    margin: 0;
    padding: 0.58rem 0.85rem;
    border-left: none;
    border-right: none;
    box-shadow: 0 4px 14px rgba(91, 33, 182, 0.32);
}
.app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx.is-active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 48%, #4338ca 100%);
    color: #fff;
    box-shadow:
        0 6px 16px rgba(91, 33, 182, 0.38),
        inset 0 0 0 1px rgba(221, 214, 254, 0.28);
}
.app-sidebar__link--fx {
    position: relative;
    margin: 0;
    width: calc(100% + 0.4rem);
    padding: 0.62rem 0.7rem 0.62rem 0.85rem;
    border-radius: 0;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 48%, #4f46e5 100%);
    border: 1px solid rgba(196, 181, 253, 0.45);
    border-left: none;
    border-right: 1px solid rgba(221, 214, 254, 0.55);
    color: #fff;
    box-shadow:
        0 8px 20px rgba(91, 33, 182, 0.42),
        0 3px 10px rgba(15, 23, 42, 0.28),
        4px 0 14px rgba(124, 58, 237, 0.32);
    overflow: hidden;
    isolation: isolate;
    transition:
        box-shadow 0.32s ease,
        border-color 0.32s ease,
        background 0.32s ease;
}
/*
 * FX-under-Launchpad list row: mobile only (hidden on desktop — rail used instead).
 * Soft purple fill, same geometry as sibling nav links.
 */
.app-sidebar__link--fx-nav {
    display: none;
}
.app-sidebar__link--fx::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 0;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0.14) 0%,
        rgba(196, 181, 253, 0.22) 38%,
        rgba(129, 140, 248, 0.18) 62%,
        rgba(255, 255, 255, 0.08) 100%
    );
    background-size: 220% 100%;
    background-position: 100% 0;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition:
        opacity 0.35s ease,
        background-position 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-sidebar__link--fx::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.06) 42%,
        rgba(233, 213, 255, 0.28) 50%,
        rgba(255, 255, 255, 0.06) 58%,
        transparent 100%
    );
    transform: translateX(-120%);
    pointer-events: none;
    z-index: 1;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-sidebar__link--fx:hover,
.app-sidebar__link--fx.is-active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 48%, #4338ca 100%);
    color: #fff;
    border-color: rgba(221, 214, 254, 0.65);
    box-shadow:
        0 10px 24px rgba(91, 33, 182, 0.5),
        0 4px 12px rgba(15, 23, 42, 0.32),
        5px 0 18px rgba(124, 58, 237, 0.38);
}
.app-sidebar__link--fx:hover::before,
.app-sidebar__link--fx.is-active::before {
    opacity: 1;
    background-position: 0% 0;
}
.app-sidebar__link--fx:hover::after,
.app-sidebar__link--fx.is-active::after {
    transform: translateX(120%);
}
.app-sidebar__link--fx .nav-icon {
    display: none;
}
/* Compact inline row: standard nav icon (not orb), above FX shine overlays */
.app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx::before,
.app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx::after {
    display: none;
}
.app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx .nav-icon {
    display: block;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    color: #fff;
    opacity: 1;
}
.app-sidebar__fx-orb {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.95rem;
    height: 1.95rem;
    border-radius: 999px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
    transition: background 0.32s ease, border-color 0.32s ease;
}
.app-sidebar__link--fx:hover .app-sidebar__fx-orb,
.app-sidebar__link--fx.is-active .app-sidebar__fx-orb {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.38);
}
.app-sidebar__fx-orb .nav-icon {
    display: block;
    width: 1.05rem;
    height: 1.05rem;
    color: #fff;
    opacity: 1;
}
.app-sidebar__link--fx .app-sidebar__link-text {
    position: relative;
    z-index: 2;
    font-weight: 800;
    letter-spacing: -0.01em;
}
body.app-sidebar-collapsed .app-sidebar__link--fx {
    margin: 0;
    width: 100%;
    padding: 0.55rem 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    justify-content: center;
    gap: 0;
    box-shadow:
        0 6px 16px rgba(91, 33, 182, 0.42),
        0 0 12px rgba(124, 58, 237, 0.28);
}
body.app-sidebar-collapsed .app-sidebar__link--fx:hover,
body.app-sidebar-collapsed .app-sidebar__link--fx.is-active {
    box-shadow:
        0 8px 20px rgba(91, 33, 182, 0.48),
        4px 0 14px rgba(124, 58, 237, 0.36);
}
body.app-sidebar-collapsed .app-sidebar__fx-rail {
    transform: translateY(-50%);
}
@media (prefers-reduced-motion: reduce) {
    .app-sidebar__link--fx::before,
    .app-sidebar__link--fx::after {
        transition-duration: 0.15s;
    }
    .app-sidebar__link--fx:hover::after,
    .app-sidebar__link--fx.is-active::after {
        transform: none;
        opacity: 0.35;
    }
}
.nav-attention-badge {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.55);
}
.app-sidebar__footer {
    margin-top: auto;
    padding: 0.7rem 0.65rem 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
    flex-shrink: 0;
}
/* Classic desktop footer (lang / live / bell / theme + avatar) */
.app-sidebar__footer--desktop {
    display: none;
}
.app-sidebar__footer--desktop .app-sidebar__trial-chip {
    margin-bottom: 0.55rem;
}
.app-sidebar__footer--desktop .app-sidebar__trial-chip-btn {
    width: 100%;
}
.app-sidebar__footer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}
.app-sidebar__trial-chip--head {
    width: 100%;
    margin: 0.1rem 0 0;
}
.app-sidebar__trial-chip--head .app-sidebar__trial-chip-btn {
    width: 100%;
}
/* Desktop footer avatar: menu opens upward */
.app-user-menu--sidebar-footer .app-user-menu__panel {
    top: auto;
    bottom: calc(100% + 0.35rem);
}
.app-user-menu--sidebar-footer .app-user-menu__chevron {
    transform: rotate(-90deg);
}
.app-user-menu--sidebar-footer
    .app-user-menu__trigger[aria-expanded="true"]
    .app-user-menu__chevron {
    transform: rotate(90deg);
}
/* Dark mode toggle — same control size as notification bell */
.app-theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    border-radius: 0.375rem;
    flex-shrink: 0;
}
.app-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}
.app-theme-toggle .nav-icon,
.app-theme-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}
.app-theme-toggle[aria-pressed="true"] {
    color: #fbbf24;
}
body.app-sidebar-collapsed .app-theme-toggle {
    /* keep icon hit target when sidebar is icon-only */
    margin: 0;
}
.app-sidebar__lang {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    border-radius: 0;
}
.app-sidebar__lang-btn {
    color: #94a3b8;
    border-radius: 0;
}
.app-sidebar__lang-btn:hover {
    color: #e2e8f0;
}
.app-sidebar__lang-btn.is-active {
    color: #f8fafc;
    background: rgba(59, 130, 246, 0.28);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}
.app-sidebar__footer-controls .balance-live-indicator {
    flex-shrink: 0;
}
.app-sidebar__user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.45rem 0.55rem;
    min-width: 0;
}
.app-sidebar__user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}
.app-sidebar__user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: opacity 0.18s ease, width 0.18s ease;
}
.app-sidebar__user-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar__user-role {
    font-size: 0.68rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar__nav-logout {
    display: none;
}
.app-sidebar__logout-form {
    margin: 0;
}
.app-sidebar__logout {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.app-sidebar__logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.28);
}
.app-sidebar__logout .nav-icon {
    width: 1rem;
    height: 1rem;
}

body.app-sidebar-collapsed .app-sidebar {
    width: var(--app-sidebar-width-collapsed);
}
body.app-sidebar-collapsed .app-sidebar__company-name,
body.app-sidebar-collapsed .app-sidebar__company-trigger-label,
body.app-sidebar-collapsed .app-sidebar__company-chevron,
body.app-sidebar-collapsed .app-sidebar__link-text,
body.app-sidebar-collapsed .app-sidebar__group-label,
body.app-sidebar-collapsed .app-sidebar__user-meta,
body.app-sidebar-collapsed .app-sidebar__lang,
body.app-sidebar-collapsed .nav-attention-badge {
    display: none;
}
.app-sidebar__company-name,
.app-sidebar__company-trigger-label,
.app-sidebar__link-text,
.app-sidebar__group-label,
.app-sidebar__user-meta,
.app-sidebar__lang,
.nav-attention-badge {
    transition: opacity 0.22s ease, max-width 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
body.app-sidebar-collapsed .app-sidebar__company-trigger {
    justify-content: center;
    padding: 0.45rem 0;
}
body.app-sidebar-collapsed .app-sidebar__company-menu {
    top: 0;
    left: calc(100% + 0.45rem);
    right: auto;
    width: max-content;
    min-width: 11.5rem;
    max-width: 16rem;
}
body.app-sidebar-collapsed .app-sidebar__link {
    justify-content: center;
    gap: 0;
    padding: 0.58rem 0;
}
body.app-sidebar-collapsed .app-sidebar__link .nav-icon {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
}
body.app-sidebar-collapsed .app-sidebar__company-switcher,
body.app-sidebar-collapsed .app-sidebar__company-badge {
    justify-content: center;
    gap: 0;
    padding: 0.45rem 0;
}
body.app-sidebar-collapsed .app-sidebar__company-icon {
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
}
body.app-sidebar-collapsed .app-sidebar__head {
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding-inline: 0;
}
body.app-sidebar-collapsed .app-sidebar__account {
    flex-direction: column;
    width: 100%;
    align-items: center;
}
body.app-sidebar-collapsed .app-sidebar__account-section {
    border-radius: 0.65rem;
}
body.app-sidebar-collapsed .app-sidebar__account-bar {
    flex-direction: column;
    width: 100%;
}
body.app-sidebar-collapsed .app-sidebar__account-panel {
    display: none !important;
}
body.app-sidebar-collapsed .app-sidebar__company-wrap {
    width: 100%;
}
body.app-sidebar-collapsed .app-sidebar__collapse {
    margin-inline: auto;
}
body.app-sidebar-collapsed .app-sidebar__footer-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}
body.app-sidebar-collapsed .app-sidebar__footer-controls .balance-live-indicator {
    opacity: 1;
    width: auto;
}
body.app-sidebar-collapsed .app-sidebar__trial-chip--head {
    display: none;
}
body.app-sidebar-collapsed .app-sidebar__user {
    justify-content: center;
    gap: 0;
}
body.app-sidebar-collapsed .app-sidebar__logout {
    justify-content: center;
    gap: 0;
    padding: 0.58rem 0;
}
body.app-sidebar-collapsed .app-sidebar__fx-inline {
    justify-content: center;
    gap: 0;
    padding: 0.58rem 0;
}
body.app-sidebar-collapsed .app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx {
    width: 100%;
    padding: 0.55rem 0;
    border-right: none;
}
body.app-sidebar-collapsed .app-sidebar--fx-compact .app-sidebar__fx-inline.app-sidebar__link--fx .nav-icon {
    display: block;
    width: 1.15rem;
    height: 1.15rem;
}

.app-mobile-menu {
    display: none;
}

@media (max-width: 1023px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: auto;
        pointer-events: none;
        /* Prevent account aurora from painting outside closed drawer */
        overflow: hidden;
    }
    .app-sidebar__backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 72;
        background: rgba(15, 23, 42, 0.55);
        opacity: 0;
        transition: opacity 0.22s ease;
        pointer-events: none;
        cursor: pointer;
    }
    .app-sidebar__panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(18rem, 88vw);
        margin: 0;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 73;
        pointer-events: auto;
        /* Clip aurora photo scale / shadows so nothing peeks when drawer is closed */
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    body.app-sidebar-mobile-open .app-sidebar {
        pointer-events: auto;
    }
    body.app-sidebar-mobile-open .app-sidebar__backdrop {
        opacity: 1;
        pointer-events: auto;
    }
    body.app-sidebar-mobile-open .app-sidebar__panel {
        transform: translateX(0);
        /* Allow company dropdown while open */
        overflow-x: hidden;
        overflow-y: auto;
    }
    .app-sidebar__nav {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    .app-sidebar__nav-scroll {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding-bottom: 0.35rem;
    }
    .app-sidebar__footer-logout,
    .app-sidebar__nav-logout {
        display: none !important;
    }
    .app-sidebar__footer--minimal {
        display: block;
        /* Only safe-area padding at bottom of panel — no chrome-blocking controls */
        min-height: env(safe-area-inset-bottom, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .app-sidebar__footer:not(.app-sidebar__footer--minimal) {
        padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0.5rem));
    }
    .app-sidebar__collapse {
        display: none !important;
    }
    .app-sidebar__head {
        /* No top padding — account aurora fills flush to panel edge */
        padding-top: 0;
    }
    .app-sidebar__nav-scroll {
        /* Nav fills remaining height; no forced logout spacer at bottom */
        margin-top: 0;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.5rem));
    }
    body.app-sidebar-collapsed .app-sidebar {
        width: auto;
    }
    /* —— Mobile chrome: account header; hide classic desktop head/footer —— */
    .app-sidebar__head--desktop {
        display: none !important;
    }
    .app-sidebar__footer--desktop {
        display: none !important;
    }
    .app-sidebar__head--mobile {
        display: flex;
    }
    /* —— Mobile nav list: taller rows; FX under Launchpad (no desktop rail) —— */
    .app-sidebar__fx-rail--desktop-only {
        display: none !important;
    }
    .app-sidebar__link {
        gap: 0.8rem;
        padding: 0.95rem 1.05rem;
        min-height: 3.25rem;
        font-size: 0.92rem;
    }
    .app-sidebar__link .nav-icon {
        width: 1.2rem;
        height: 1.2rem;
    }
    .app-sidebar__link--fx-nav {
        display: flex;
        width: 100%;
        margin: 0;
        padding: 0.95rem 1.05rem;
        min-height: 3.25rem;
        border-radius: 0;
        border: none;
        border-left: none;
        border-right: none;
        background: rgba(124, 58, 237, 0.28);
        color: #e9d5ff;
        box-shadow: none;
        overflow: hidden;
    }
    .app-sidebar__link--fx-nav::before,
    .app-sidebar__link--fx-nav::after {
        display: none;
    }
    .app-sidebar__link--fx-nav .nav-icon {
        opacity: 1;
        color: #ddd6fe;
    }
    .app-sidebar__link--fx-nav .app-sidebar__link-text {
        font-weight: 600;
        letter-spacing: normal;
    }
    .app-sidebar__link--fx-nav:hover {
        background: rgba(124, 58, 237, 0.38);
        color: #f5f3ff;
        box-shadow: none;
        border-color: transparent;
    }
    .app-sidebar__link--fx-nav.is-active {
        background: rgba(124, 58, 237, 0.42);
        color: #f5f3ff;
        box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.28);
    }
    .app-sidebar__nav-scroll {
        padding-top: 0.35rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0.75rem));
        gap: 0.05rem;
    }
    .app-sidebar__group-body {
        padding-bottom: 0.25rem;
    }
    .app-sidebar__group-toggle {
        padding: 0.85rem 1.05rem 0.45rem;
    }
    .app-mobile-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0.5rem;
        left: 0.5rem;
        z-index: 44;
        width: 2.85rem;
        height: 2.85rem;
        border: none;
        border-radius: 50%;
        background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 42%, #4f46e5 100%);
        color: #fff;
        cursor: pointer;
        box-shadow:
            0 10px 28px rgba(15, 23, 42, 0.28),
            0 6px 16px rgba(91, 33, 182, 0.42),
            0 2px 6px rgba(91, 33, 182, 0.28);
    }
    .app-mobile-menu .nav-icon {
        width: 1.35rem;
        height: 1.35rem;
        color: #fff !important;
        stroke: #fff !important;
        opacity: 1;
        stroke-width: 2.25;
    }
    .app-mobile-menu:hover {
        border: none;
        color: #fff;
        background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 42%, #4338ca 100%);
        box-shadow:
            0 14px 32px rgba(15, 23, 42, 0.32),
            0 8px 20px rgba(91, 33, 182, 0.5),
            0 3px 8px rgba(91, 33, 182, 0.32);
    }
    body.app-sidebar-mobile-open .app-mobile-menu {
        visibility: hidden;
        pointer-events: none;
    }
    :root {
        --app-mobile-menu-offset: 3.65rem;
    }
}

@media (min-width: 1024px) {
    .app-sidebar__collapse {
        display: inline-flex;
    }
    /* Desktop: classic head (company) + footer account; hide mobile avatar sheet */
    .app-sidebar__head--mobile {
        display: none !important;
    }
    .app-sidebar__head--desktop {
        display: flex !important;
    }
    .app-sidebar__footer--desktop {
        display: block !important;
    }
    .app-sidebar__account-overlay {
        display: none !important;
    }
    /* Desktop: compact nav + floating FX rail (not the mobile list FX row) */
    .app-sidebar__link--fx-nav {
        display: none !important;
    }
    .app-sidebar__fx-rail--desktop-only {
        display: block;
    }
    .app-sidebar__link {
        gap: 0.6rem;
        padding: 0.58rem 0.85rem;
        min-height: 0;
        font-size: 0.84rem;
    }
    .app-sidebar__link .nav-icon {
        width: 1.05rem;
        height: 1.05rem;
    }
    .app-sidebar__group-toggle {
        padding: 0.45rem 0.85rem 0.2rem;
    }
}

/* Entries import page — handoff hero (not an alert banner) */
.entries-import-handoff {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) + 4px);
    border: 1px solid #c7d2fe;
    background:
        radial-gradient(ellipse 120% 80% at 0% 0%, rgba(99, 102, 241, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 90% 70% at 100% 100%, rgba(245, 158, 11, 0.12) 0%, transparent 50%),
        linear-gradient(155deg, #f8faff 0%, #f5f3ff 42%, #fffbeb 100%);
    box-shadow: var(--shadow-md);
}
[data-theme="dark"] .entries-import-handoff {
    border-color: #4338ca;
    background:
        radial-gradient(ellipse 120% 80% at 0% 0%, rgba(99, 102, 241, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 90% 70% at 100% 100%, rgba(245, 158, 11, 0.14) 0%, transparent 50%),
        linear-gradient(155deg, #1e1b4b 0%, #1a2332 48%, #292524 100%);
}
.entries-import-handoff__glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(42px);
    opacity: 0.55;
}
.entries-import-handoff__glow--left {
    top: -2.5rem;
    left: -1.5rem;
    width: 9rem;
    height: 9rem;
    background: #818cf8;
}
.entries-import-handoff__glow--right {
    right: -1rem;
    bottom: -2rem;
    width: 8rem;
    height: 8rem;
    background: #fbbf24;
}
.entries-import-handoff__inner {
    position: relative;
    z-index: 1;
    padding: 1.35rem 1.4rem 1.2rem;
}
.entries-import-handoff__eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6366f1;
}
[data-theme="dark"] .entries-import-handoff__eyebrow {
    color: #a5b4fc;
}
.entries-import-handoff__title {
    margin: 0 0 0.45rem;
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #312e81;
}
[data-theme="dark"] .entries-import-handoff__title {
    color: #e0e7ff;
}
.entries-import-handoff__lead {
    margin: 0;
    max-width: 42rem;
    font-size: 0.86rem;
    line-height: 1.55;
    color: #4338ca;
}
[data-theme="dark"] .entries-import-handoff__lead {
    color: #c7d2fe;
}
.entries-import-handoff__pipeline {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 0.45rem 0.35rem;
    margin: 1.15rem 0 1rem;
    padding: 0.85rem 0.65rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.62);
    border: 1px dashed #c7d2fe;
}
[data-theme="dark"] .entries-import-handoff__pipeline {
    background: rgba(15, 23, 42, 0.35);
    border-color: #4f46e5;
}
.entries-import-handoff__step {
    flex: 1 1 7.5rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.65rem 0.45rem;
    text-align: center;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.entries-import-handoff__step:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.entries-import-handoff__step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.6rem;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.entries-import-handoff__step-icon .nav-icon {
    width: 1.05rem;
    height: 1.05rem;
    opacity: 1;
}
.entries-import-handoff__step-icon--entities {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    box-shadow: 0 6px 16px rgba(8, 145, 178, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.entries-import-handoff__step-icon--deals {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.entries-import-handoff__step-icon--entries {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.entries-import-handoff__step-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.entries-import-handoff__step-hint {
    margin: 0;
    font-size: 0.68rem;
    line-height: 1.4;
}
.entries-import-handoff__arrow {
    flex: 0 0 auto;
    align-self: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #a5b4fc;
    line-height: 1;
}
[data-theme="dark"] .entries-import-handoff__arrow {
    color: #6366f1;
}
.entries-import-handoff__finish {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}
.entries-import-handoff__timer {
    flex-shrink: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 3.6rem;
    padding: 0.45rem 0.65rem;
    border-radius: 0.75rem;
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.32);
    animation: entries-import-handoff-pulse 2.8s ease-in-out infinite;
}
@keyframes entries-import-handoff-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
.entries-import-handoff__timer-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}
.entries-import-handoff__timer-unit {
    margin-top: 0.1rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.88;
}
.entries-import-handoff__finish-copy {
    margin: 0;
    flex: 1 1 12rem;
    min-width: 0;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text);
}
@media (max-width: 640px) {
    .entries-import-handoff__inner {
        padding: 1.1rem 1rem;
    }
    .entries-import-handoff__arrow {
        display: none;
    }
    .entries-import-handoff__pipeline {
        flex-direction: column;
        align-items: stretch;
    }
    .entries-import-handoff__step {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 0.55rem;
    }
    .entries-import-handoff__step-icon {
        margin-top: 0.1rem;
    }
}
.entries-import-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 1rem;
    align-items: start;
}
.entries-import-layout__main {
    min-width: 0;
}
.entries-import-layout__guide {
    min-width: 0;
    position: sticky;
    top: 0.75rem;
}
.entries-import-downloads {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}
.entries-import-downloads__card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}
.entries-import-downloads__card .hint:last-of-type {
    flex: 1;
}
.entries-import-step-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}
.entries-import-step-title__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
}
.entries-import-step-title__badge--secondary {
    min-width: auto;
    padding: 0 0.55rem;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.24);
}
.entries-import-guide {
    padding: 0;
    overflow: hidden;
}
.entries-import-guide__hero {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.1rem 0.9rem;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #4338ca 100%);
    color: #fff;
}
.entries-import-guide__hero-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.entries-import-guide__hero-icon .nav-icon {
    width: 1.15rem;
    height: 1.15rem;
    color: #fff;
}
.entries-import-guide__title {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}
.entries-import-guide__lead {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
}
.entries-import-guide__callout {
    margin: 0.85rem 1rem 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 100%);
}
.entries-import-guide__callout-title {
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}
.entries-import-guide__callout-body {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--muted);
}
.entries-import-guide__tiles {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem 1rem 1rem;
}
.entries-import-guide__tile {
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.entries-import-guide__tile-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}
.entries-import-guide__tile-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #4f46e5;
    background: #eef2ff;
}
.entries-import-guide__tile-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}
.entries-import-guide__type-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.entries-import-guide__type-list li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.entries-import-guide__type-list .hint {
    margin: 0;
}
.entries-import-guide__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.entries-import-guide__pill--fx {
    color: #4338ca;
    background: #e0e7ff;
}
.entries-import-guide__pill--adj {
    color: #b45309;
    background: #fef3c7;
}
.entries-import-guide__pill--bank {
    color: #0f766e;
    background: #ccfbf1;
}
.entries-import-guide__bullets {
    margin: 0;
    padding: 0 0 0 1rem;
    line-height: 1.45;
}
.entries-import-guide__bullets li + li {
    margin-top: 0.25rem;
}
.entries-import-guide__section {
    padding: 0.85rem 1rem 0;
}
.entries-import-guide__section--foot {
    padding-bottom: 1rem;
}
.entries-import-guide__section-title {
    margin: 0 0 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #334155;
}
.entries-import-guide__section-lead {
    margin: 0 0 0.55rem;
    font-size: 0.74rem;
}
.entries-import-guide__type-list--detail li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}
.entries-import-guide__type-copy {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--muted);
}
.entries-import-guide__columns {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 28rem;
    overflow-y: auto;
    padding-right: 0.15rem;
}
.entries-import-guide__columns > div {
    display: grid;
    gap: 0.15rem;
}
.entries-import-guide__columns dt {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
}
.entries-import-guide__columns dt code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.7rem;
    color: #1e40af;
    background: #eff6ff;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}
.entries-import-guide__columns dd {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
}
.entries-import-guide__bullets.hint {
    margin-top: 0;
}
.entries-import-prereqs {
    list-style: none;
    margin: 0;
    padding: 0;
}
.entries-import-prereqs__item {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin-top: 0.3rem;
}
.entries-import-prereqs__item.hint {
    margin-top: 0.3rem;
}
.entries-import-prereqs__mark {
    flex-shrink: 0;
    width: 1rem;
    text-align: center;
    font-weight: 600;
}
.entries-import-prereqs__mark--ok {
    color: var(--success, #059669);
}
.entries-import-prereqs__mark--pending {
    color: var(--warning, #d97706);
}
.entries-import-file__label {
    margin: 0 0 0.35rem;
}
.entries-import-file__control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}
.entries-import-file__input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.entries-import-file__name {
    margin: 0;
    min-width: 0;
    word-break: break-all;
}
/* Entries import — preview hero panel */
.entries-import-preview-panel {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) + 6px);
    border: 2px solid #86efac;
    background:
        radial-gradient(ellipse 110% 70% at 0% 0%, rgba(16, 185, 129, 0.16) 0%, transparent 52%),
        radial-gradient(ellipse 90% 65% at 100% 100%, rgba(37, 99, 235, 0.12) 0%, transparent 48%),
        linear-gradient(155deg, #f0fdf4 0%, #ecfdf5 38%, #f8fafc 100%);
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.12),
        0 16px 40px rgba(5, 150, 105, 0.14),
        0 4px 14px rgba(15, 23, 42, 0.06);
    animation: entries-import-preview-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    scroll-margin-top: 1.25rem;
    outline: none;
}
.entries-import-preview-panel--error {
    border-color: #fca5a5;
    background:
        radial-gradient(ellipse 110% 70% at 0% 0%, rgba(239, 68, 68, 0.14) 0%, transparent 52%),
        radial-gradient(ellipse 90% 65% at 100% 100%, rgba(245, 158, 11, 0.1) 0%, transparent 48%),
        linear-gradient(155deg, #fef2f2 0%, #fff7ed 42%, #f8fafc 100%);
    box-shadow:
        0 0 0 1px rgba(239, 68, 68, 0.1),
        0 16px 40px rgba(220, 38, 38, 0.12),
        0 4px 14px rgba(15, 23, 42, 0.06);
}
@keyframes entries-import-preview-enter {
    from {
        opacity: 0;
        transform: translateY(0.65rem) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.entries-import-preview-panel__glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(48px);
    opacity: 0.5;
}
.entries-import-preview-panel__glow--left {
    top: -2rem;
    left: -1.25rem;
    width: 9rem;
    height: 9rem;
    background: #34d399;
}
.entries-import-preview-panel__glow--right {
    right: -1rem;
    bottom: -2rem;
    width: 8rem;
    height: 8rem;
    background: #60a5fa;
}
.entries-import-preview-panel--error .entries-import-preview-panel__glow--left {
    background: #f87171;
}
.entries-import-preview-panel--error .entries-import-preview-panel__glow--right {
    background: #fbbf24;
}
.entries-import-preview-panel__inner {
    position: relative;
    z-index: 1;
    padding: 1.45rem 1.5rem 1.35rem;
}
.entries-import-preview-panel__head {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1.15rem;
}
.entries-import-preview-panel__status-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    color: #047857;
    background: rgba(16, 185, 129, 0.16);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.22);
}
.entries-import-preview-panel__status-icon .btn__icon {
    width: 1.45rem;
    height: 1.45rem;
    stroke-width: 2.25;
}
.entries-import-preview-panel--error .entries-import-preview-panel__status-icon {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.14);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}
.entries-import-preview-panel__eyebrow {
    margin: 0 0 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #059669;
}
.entries-import-preview-panel--error .entries-import-preview-panel__eyebrow {
    color: #dc2626;
}
.entries-import-preview-panel__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #064e3b;
}
.entries-import-preview-panel--error .entries-import-preview-panel__title {
    color: #7f1d1d;
}
.entries-import-preview-panel__lead {
    margin: 0;
    max-width: 38rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #047857;
}
.entries-import-preview-panel--error .entries-import-preview-panel__lead {
    color: #b45309;
}
.entries-import-preview-panel__errors {
    padding: 0.95rem 1rem;
    border-radius: var(--radius);
    border: 1px solid #fecaca;
    background: rgba(254, 242, 242, 0.85);
}
.entries-import-preview-panel__errors-title {
    margin: 0 0 0.55rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #991b1b;
}
.entries-import-preview__stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 1rem;
}
@media (min-width: 1024px) {
    .entries-import-preview__stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
.entries-import-preview__stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.95rem 1rem;
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid rgba(16, 185, 129, 0.22);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.entries-import-preview__stat--accent {
    border-color: rgba(5, 150, 105, 0.45);
    background: linear-gradient(145deg, #ecfdf5 0%, #ffffff 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}
.entries-import-preview__stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #047857;
}
.entries-import-preview__stat-value {
    font-size: clamp(1.75rem, 3vw, 2.15rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: #064e3b;
}
.entries-import-preview__stat--accent .entries-import-preview__stat-value {
    color: #047857;
}
.entries-import-preview-panel__meta {
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius);
    border: 1px dashed rgba(16, 185, 129, 0.35);
    background: rgba(255, 255, 255, 0.55);
}
.entries-import-preview-panel__warnings {
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius);
    border: 1px solid #fde68a;
    background: rgba(255, 251, 235, 0.9);
}
.entries-import-preview-panel__warnings-title {
    margin: 0 0 0.45rem;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #92400e;
}
.entries-import-preview__commit {
    margin: 0;
    flex-shrink: 0;
}
.entries-import-preview-panel__cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid rgba(5, 150, 105, 0.28);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(236, 253, 245, 0.95) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.entries-import-preview-panel__cta-title {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #065f46;
}
.entries-import-preview-panel__cta-hint {
    margin: 0;
    max-width: 28rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #047857;
}
.entries-import-preview-panel__commit-btn {
    min-width: 11.5rem;
    padding: 0.65rem 1.35rem !important;
    font-size: 0.92rem !important;
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.28);
}
.entries-import-upload-card--done {
    opacity: 0.72;
    border-style: dashed;
}
.entries-import-step-title__badge--done {
    color: #fff;
    background: #10b981;
    border-color: #059669;
}
.entries-import-step-title__done-hint {
    display: block;
    width: 100%;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 500;
}
.entries-import-preview__line {
    margin: 0;
    line-height: 1.45;
}
.entries-import-preview__label {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #047857;
}
.entries-import-preview__value {
    display: block;
    font-size: 0.88rem;
    color: var(--text);
}
.entries-import-preview-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.entries-import-preview-list li {
    margin-top: 0.3rem;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text);
}
.entries-import-preview-panel__errors .entries-import-preview-list li {
    color: #7f1d1d;
}
.entries-import-preview-panel__warnings .entries-import-preview-list li {
    color: #92400e;
}
.entries-import-preview-list li:first-child {
    margin-top: 0;
}

.entries-import-progress {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.entries-import-progress[hidden] {
    display: none !important;
}

body.entries-import-progress-open {
    overflow: hidden;
}

.entries-import-progress__panel {
    width: min(28rem, 100%);
    padding: 1.35rem 1.4rem 1.25rem;
    border-radius: 0.85rem;
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.entries-import-progress__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.entries-import-progress__warning {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    border: 1px solid #fde68a;
    background: #fffbeb;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #92400e;
}

.entries-import-progress__warning--leave {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.entries-import-progress__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

.entries-import-progress__actions--error {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: stretch;
}

.entries-import-progress__actions--error .btn {
    flex: 1 1 auto;
    min-width: 8.5rem;
}

.entries-import-progress__panel.is-error .entries-import-progress__title {
    color: #991b1b;
}

.entries-import-progress__label {
    margin: 0 0 0.9rem;
    min-height: 1.35rem;
    font-size: 0.88rem;
    color: #475569;
}

.entries-import-progress__track-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.entries-import-progress__track {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    height: 0.55rem;
    border-radius: 999px;
    background: #e2e8f0;
}

.entries-import-progress__pct {
    flex: 0 0 auto;
    min-width: 2.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1e40af;
    text-align: right;
}

.entries-import-progress__bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #22d3ee);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
    transition: width 0.28s ease-out;
}

.entries-import-progress__steps {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.entries-import-progress__step {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.entries-import-progress__step::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: #cbd5e1;
    flex-shrink: 0;
}

.entries-import-progress__step.is-active {
    color: #1e40af;
    font-weight: 600;
}

.entries-import-progress__step.is-active::before {
    background: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.entries-import-progress__step.is-done {
    color: #047857;
}

.entries-import-progress__step.is-done::before {
    background: #10b981;
}

.entries-import-progress__errors {
    margin-top: 0.85rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.55rem;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.84rem;
}

.entries-import-progress__error-list {
    margin: 0;
    padding-left: 1.1rem;
}

@media (max-width: 960px) {
    .entries-import-layout {
        grid-template-columns: 1fr;
    }
    .entries-import-layout__guide {
        position: static;
        display: flex;
        flex-direction: column;
    }
    .entries-import-prereqs-card {
        order: 2;
    }
    .entries-import-limits-card {
        order: 1;
    }
    .entries-import-guide {
        order: 3;
    }
    .entries-import-downloads {
        grid-template-columns: 1fr;
    }
}




/* ---- Launchpad nav groups + user menu (feat/launchpad-nav-home) ---- */
.app-sidebar__nav-group {
    margin: 0.15rem 0 0.35rem;
}
.app-sidebar__group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.85rem 0.2rem;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    text-align: left;
}
.app-sidebar__group-toggle:hover {
    color: #94a3b8;
}
.app-sidebar__group-label--btn {
    margin: 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.app-sidebar__group-chevron {
    display: inline-flex;
    transition: transform 0.15s ease;
    opacity: 0.7;
}
.app-sidebar__group-chevron .nav-icon {
    width: 0.85rem;
    height: 0.85rem;
}
.app-sidebar__nav-group.is-open .app-sidebar__group-chevron {
    transform: rotate(90deg);
}
.app-sidebar__group-body {
    display: flex;
    flex-direction: column;
}
.app-sidebar__group-body[hidden] {
    display: none !important;
}
body.app-sidebar-collapsed .app-sidebar__group-toggle {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
body.app-sidebar-collapsed .app-sidebar__group-label--btn {
    display: none;
}

.app-user-menu {
    position: relative;
    width: 100%;
}
.app-user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.45rem 0.35rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.app-user-menu__trigger:hover {
    background: rgba(255, 255, 255, 0.06);
}
.app-user-menu__avatar,
.app-sidebar__user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.app-user-menu__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.app-user-menu__name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-user-menu__role {
    font-size: 0.68rem;
    color: #94a3b8;
}
.app-user-menu__chevron {
    opacity: 0.55;
    /* Default: point down (menu opens below) — account row is at top of sidebar */
    transform: rotate(90deg);
}
.app-user-menu__chevron .nav-icon {
    width: 0.85rem;
    height: 0.85rem;
}
.app-user-menu__panel {
    position: absolute;
    left: 0;
    right: 0;
    /* Open downward under avatar (top-of-nav layout) */
    top: calc(100% + 0.35rem);
    bottom: auto;
    z-index: 40;
    padding: 0.35rem;
    border-radius: 0.65rem;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
/* Expanded trigger: flip chevron up when open */
.app-user-menu__trigger[aria-expanded="true"] .app-user-menu__chevron {
    transform: rotate(-90deg);
}
.app-user-menu__panel[hidden] {
    display: none !important;
}
.app-user-menu__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}
.app-user-menu__item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}
.app-user-menu__item .nav-icon {
    width: 1rem;
    height: 1rem;
    opacity: 0.9;
}
.app-user-menu__item--danger {
    color: #fca5a5;
}
.app-user-menu__item--danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}
.app-user-menu__divider {
    height: 1px;
    margin: 0.3rem 0.4rem;
    background: rgba(148, 163, 184, 0.25);
}
.app-user-menu__logout-form {
    margin: 0;
}
.app-user-menu--topbar .app-user-menu__panel {
    left: auto;
    right: 0;
    bottom: auto;
    top: calc(100% + 0.35rem);
    min-width: 12rem;
    background: var(--surface, #fff);
    border-color: var(--border, #e5e7eb);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.app-user-menu--topbar .app-user-menu__name {
    color: var(--text, #1a1d23);
}
.app-user-menu--topbar .app-user-menu__role {
    color: var(--muted, #6b7280);
}
.app-user-menu--topbar .app-user-menu__item {
    color: var(--text, #1a1d23);
}
.app-user-menu--topbar .app-user-menu__item:hover {
    background: rgba(37, 99, 235, 0.08);
}
.app-user-menu--topbar .app-user-menu__avatar {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary, #2563eb);
}
.app-user-menu--topbar .app-user-menu__trigger:hover {
    background: rgba(15, 23, 42, 0.04);
}
body.app-sidebar-collapsed .app-user-menu__meta,
body.app-sidebar-collapsed .app-user-menu__chevron {
    display: none;
}
body.app-sidebar-collapsed .app-user-menu__trigger {
    justify-content: center;
}
