:root {
    --bg-color: #14161a;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --card-bg: #1c1e22;
    --card-border: rgba(255, 255, 255, 0.08);
    --accent: #3b82f6;
    /* Flat theme: no colored outer glow on accent elements. */
    --accent-glow: rgba(0, 0, 0, 0);
    --sidebar-w: 220px;
    --app-max: 1480px;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
    padding-bottom: 2.6rem;
}

/* Centered shell. Sidebar is fixed to this column's left edge, not the viewport. */
.app-container {
    max-width: var(--app-max);
    margin-inline: auto;
    padding: 1.25rem 2rem 1.5rem calc(var(--sidebar-w) + 1.5rem);
}

header {
    margin-bottom: 3rem;
    animation: slideDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
}

.app-container header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.header-alerts-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.header-alerts-row:not(:has(> :not([hidden]))) {
    display: none;
}

.header-alerts-row > [hidden] {
    display: none !important;
}

/* Sync Status Pill */
.sync-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    margin-left: 0.5rem;
    height: fit-content;
}

.sync-status i {
    color: var(--accent-color);
    font-size: 0.8rem;
}

.sync-status:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

/* System Ticker */
.system-ticker {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 32px;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-monarch-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
    flex-shrink: 1;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-monarch-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.monarch-fix-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#btn-monarch-fix {
    border-color: rgba(248, 113, 113, 0.55);
    color: #fecaca;
}

#btn-monarch-fix[aria-expanded="true"] {
    background: rgba(220, 38, 38, 0.18);
}

.monarch-fix-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 80;
    width: min(22rem, calc(100vw - 1.5rem));
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.monarch-fix-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.7rem;
}

.monarch-fix-tab {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.monarch-fix-tab:hover {
    color: var(--text-primary);
    background: rgba(51, 65, 85, 0.9);
}

.monarch-fix-tab.active {
    background: #dc2626;
    border-color: #ef4444;
    color: #fff;
}

.monarch-fix-step-panel {
    display: none;
}

.monarch-fix-step-panel.active {
    display: block;
}

.monarch-fix-step-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.monarch-fix-step-copy {
    margin: 0 0 0.7rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.monarch-fix-step-copy code,
.monarch-fix-step-copy kbd {
    font-size: 0.72rem;
}

.monarch-fix-step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.monarch-fix-step-status {
    margin-top: 0.55rem;
    font-size: 0.74rem;
    color: var(--text-secondary);
    min-height: 1em;
}

.monarch-fix-command-preview {
    margin: 0 0 0.7rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(2, 6, 23, 0.75);
    color: #cbd5e1;
    font-size: 0.68rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 8.5rem;
    overflow: auto;
}

.header-ext-links {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 0.65rem;
    flex-shrink: 0;
}

.header-ext-link {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.header-ext-link:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.header-ext-link img {
    width: 28px;
    height: 28px;
    display: block;
    border-radius: 7px;
}

.system-ticker.is-syncing {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.system-ticker.is-checking {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.system-ticker.is-success {
    border-color: var(--success);
}

.ticker-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.system-ticker.is-syncing .ticker-dot {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    animation: pulseSync 1.5s infinite;
}

.system-ticker.is-checking .ticker-dot {
    background: var(--text-secondary);
    animation: pulseSync 2s infinite;
    opacity: 0.5;
}

.system-ticker.is-success .ticker-dot {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

@keyframes pulseSync {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

#ticker-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.btn-multi-line {
    line-height: 1.2 !important;
}

.card-header-center {
    justify-content: center !important;
    gap: 1rem !important;
}

.card-header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.card-header-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-input-pill {
    max-width: 250px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    transition: border-color 0.2s;
}

.search-input-pill:focus {
    border-color: var(--accent);
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.22),
        0 0 14px rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.06);
}

/* Active-filter indicator: when a text input has a value (filter is doing
   something), keep a subtle glow so you can see at a glance which boxes are
   actively narrowing results. Selects below get the same treatment via
   :not(.is-placeholder). */
input.search-input-pill:not(:placeholder-shown):not(:focus),
textarea.search-input-pill:not(:placeholder-shown):not(:focus) {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.22),
        0 0 8px rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.04);
}

/* Selects can't use :placeholder-shown — toggle .is-placeholder via JS
   (see _wireSearchInputPillFilterIndicators) so the same glow applies when
   a non-default option is selected. */
select.search-input-pill:not(.is-placeholder):not(:focus) {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.22),
        0 0 8px rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.04);
}

.search-input-pill option {
    color: #0f172a;
    background: #ffffff;
}
/* Override for monarch dropdowns to ensure dark text on light background */
#monarch-tx-account-filter option,
#monarch-tx-category-filter option {
    color: #0f172a !important;
    background: #ffffff !important;
}

.tax-year-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.tax-year-control span {
    text-transform: uppercase;
}

.tax-year-select {
    width: 96px;
    max-width: 96px;
}

.tax-year-card {
    position: relative;
}

.tax-page-toolbar {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Inside the Taxes tab, the per-sub-tab toolbar must flow inline so it
   doesn't escape the sub-tab and collide with the shared year picker that
   lives in the submenu bar. The absolute layout above is preserved for
   #tax-review-tab, which was designed around it. */
#taxes-tab .tax-page-toolbar {
    position: static;
    top: auto;
    right: auto;
}

.tax-year-card .card-header-right {
    padding-right: 460px;
}

.tax-folder-control {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.tax-folder-control > span {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.tax-folder-link {
    max-width: none;
    min-width: 0;
    width: auto;
    height: 2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.62);
    color: #bfdbfe;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0 10px 0 5px;
    text-align: left;
}

.tax-folder-link:hover {
    border-color: rgba(96, 165, 250, 0.44);
    color: #dbeafe;
    text-decoration: underline;
}

.tax-folder-edit {
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 800;
}

.tax-folder-edit:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.tax-page-search-wrapper {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr;
    align-items: center;
}

.tax-page-search {
    width: 260px;
    max-width: 260px;
}

.search-wrapper {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr;
    align-items: center;
}

.search-wrapper .search-input-pill,
.search-wrapper .header-search-input {
    padding-right: 32px;
    grid-column: 1;
    grid-row: 1;
}

.search-clear-btn {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.18);
    color: #f8fafc;
    line-height: 18px;
    font-size: 16px;
    cursor: pointer;
    z-index: 1;
    padding: 0;
    text-align: center;
}

.search-clear-btn:hover {
    background: rgba(239, 68, 68, 0.85);
}

/* Auto-show the X whenever the input inside the wrapper has a value. Avoids
   needing per-filter JS toggles. Works for any .search-input-pill that has a
   placeholder attribute (which all of ours do). */
.search-wrapper:has(.search-input-pill:not(:placeholder-shown)) .search-clear-btn,
.search-wrapper:has(.header-search-input:not(:placeholder-shown)) .search-clear-btn {
    display: block;
}

.status-pill.subscription {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.subscription-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    font-weight: 700;
    border: 1px solid rgba(168, 85, 247, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Header Jump to Date Container */
.header-jump-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 999px;
    margin-left: auto;
    margin-right: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.header-jump-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
    background: rgba(15, 23, 42, 0.6);
}

.jump-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jump-to-date-picker {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    padding: 2px;
}

/* Chrome/Safari specialized date picker icon styling */
.jump-to-date-picker::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.8);
    cursor: pointer;
}

.jump-to-date-picker::-webkit-calendar-picker-indicator:hover {
    filter: invert(1) brightness(1);
}

/* Jump Highlight Animation */
@keyframes jumpGlow {
    0% { background-color: rgba(59, 130, 246, 0.4); transform: scale(1.02); }
    100% { background-color: transparent; transform: scale(1); }
}

.jump-highlight {
    animation: jumpGlow 1.5s ease-out;
    border-color: var(--accent) !important;
    z-index: 1002;
    position: relative;
}


.btn-accent-small {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: opacity 0.2s;
}

.btn-accent-small:hover {
    opacity: 0.9;
}

.income-plan-body {
    padding-top: 0;
    padding-bottom: 0.85rem;
}

/* Tighter under Salary Info Grid title rule — no extra gap below header border */
.income-plan-grid-header {
    margin-bottom: 0 !important;
    padding-bottom: 0.55rem;
}

.income-plan-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem 0.75rem;
    margin-bottom: 0.35rem;
}

.income-plan-col-hider {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.38rem 0.55rem;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    font-size: 0.76rem;
}
.income-plan-col-hider-title {
    font-weight: 700;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 0 0 auto;
}
.income-plan-col-hider-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.55rem;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.income-plan-add-row {
    flex: 0 0 auto;
    align-self: center;
}
.income-plan-col-hide-label {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    cursor: pointer;
    color: var(--text-primary, #e5e7eb);
    user-select: none;
}
.income-plan-col-hide-label input {
    accent-color: #60a5fa;
    cursor: pointer;
}

.income-plan-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.income-plan-summary strong {
    color: var(--text-primary);
}

/* Tax prep reported income — horizontal strip above Hide columns */
.income-plan-reported-income {
    margin-bottom: 0.5rem;
    padding: 0.42rem 0.65rem;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.income-plan-tax-summary-lines {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.35rem;
    column-gap: 0.15rem;
}

.income-plan-reported-lead {
    margin-right: 0.15rem;
}

.income-plan-reported-lead strong {
    color: var(--text-primary);
    font-weight: 800;
}

.income-plan-reported-seg {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.08rem;
    white-space: nowrap;
}

.income-plan-reported-lbl {
    color: var(--text-secondary);
}

.income-plan-reported-sep {
    color: var(--text-secondary);
    opacity: 0.75;
}

.income-plan-reported-val {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.income-plan-reported-comma {
    color: var(--text-secondary);
    opacity: 0.55;
    user-select: none;
    margin: 0 0.02rem;
}

.income-plan-tax-summary-loading,
.income-plan-tax-summary-err {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.income-plan-tax-summary-err {
    color: #f59e0b;
}

/* Income page — section dividers + stronger section titles */
#income-tab .income-page-section-divider {
    position: relative;
    height: 14px;
    margin: 2.15rem 0 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#income-tab .income-page-section-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(148, 163, 184, 0.08) 12%,
        rgba(59, 130, 246, 0.42) 50%,
        rgba(148, 163, 184, 0.08) 88%,
        transparent 100%
    );
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.12);
}

#income-tab .income-page-section-divider::after {
    content: '';
    position: relative;
    z-index: 1;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(145deg, #93c5fd 0%, #3b82f6 55%, #1d4ed8 100%);
    box-shadow:
        0 0 0 3px rgba(13, 15, 26, 0.95),
        0 0 18px rgba(59, 130, 246, 0.55);
}

#income-tab > .card-header h2 {
    font-size: 1.34rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: #f8fafc;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

#income-tab > .card-header {
    border-bottom-color: rgba(148, 163, 184, 0.18);
}

.income-plan-monarch-header {
    margin-top: 0;
}

.income-plan-scroll {
    overflow: auto;
    max-height: 16rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgb(15, 23, 42);
    isolation: isolate;
}

.income-plan-table {
    width: max-content;
    min-width: 0;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.78rem;
    position: relative;
    z-index: 0;
}

/* One sticky layer for the whole header row; high z-index so tbody never paints over it */
.income-plan-table thead {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(15, 23, 42);
    transform: translateZ(0);
}

.income-plan-table tbody {
    position: relative;
    z-index: 0;
}

.income-plan-table th {
    position: relative;
    padding: 0.55rem 0.4rem;
    background: rgb(15, 23, 42);
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.68rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

/* Salary grid — column bands: CPU (purple), IOA (blue), WDWx (red), Jimmy detail (green), totals (black) */
.income-plan-table td.income-plan-cg-cpu {
    background-color: rgba(76, 29, 149, 0.14);
}
.income-plan-table td.income-plan-cg-ioa {
    background-color: rgba(30, 58, 138, 0.18);
}
.income-plan-table td.income-plan-cg-wdwx {
    background-color: rgba(91, 20, 20, 0.2);
}
.income-plan-table td.income-plan-cg-jimmy {
    background-color: rgba(6, 95, 70, 0.16);
}

.income-plan-table th.income-plan-cg-cpu {
    background: rgb(50, 18, 82);
}
.income-plan-table th.income-plan-cg-ioa {
    background: rgb(23, 37, 84);
}
.income-plan-table th.income-plan-cg-wdwx {
    background: rgb(58, 12, 12);
}
.income-plan-table th.income-plan-cg-jimmy {
    background: rgb(6, 78, 59);
}

.income-plan-table td.income-plan-cg-totals {
    background-color: rgb(10, 10, 12);
}
.income-plan-table th.income-plan-cg-totals {
    background: rgb(8, 8, 10);
}

/* Column group start: 10px gap left of line, 4px solid line, 10px gap before content (horizontal only; line runs full cell height) */
.income-plan-table th.income-plan-cg-beg,
.income-plan-table td.income-plan-cg-beg {
    box-shadow: none;
}
/* tbody td needs position:relative for ::before; th uses relative for same (header row stickiness is on thead) */
.income-plan-table td.income-plan-cg-beg {
    position: relative;
    padding: 0.26rem 0.26rem 0.26rem 24px;
}
.income-plan-table th.income-plan-cg-beg {
    padding: 0.55rem 0.4rem 0.55rem 24px;
}
.income-plan-table th.income-plan-cg-beg::before,
.income-plan-table td.income-plan-cg-beg::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 1px;
    pointer-events: none;
}
.income-plan-table th.income-plan-cg-cpu.income-plan-cg-beg::before,
.income-plan-table td.income-plan-cg-cpu.income-plan-cg-beg::before {
    background: rgba(167, 139, 250, 0.65);
}
.income-plan-table th.income-plan-cg-ioa.income-plan-cg-beg::before,
.income-plan-table td.income-plan-cg-ioa.income-plan-cg-beg::before {
    background: rgba(96, 165, 250, 0.75);
}
.income-plan-table th.income-plan-cg-wdwx.income-plan-cg-beg::before,
.income-plan-table td.income-plan-cg-wdwx.income-plan-cg-beg::before {
    background: rgba(248, 113, 113, 0.65);
}
.income-plan-table th.income-plan-cg-jimmy.income-plan-cg-beg::before,
.income-plan-table td.income-plan-cg-jimmy.income-plan-cg-beg::before {
    background: rgba(74, 222, 128, 0.65);
}
.income-plan-table th.income-plan-cg-totals.income-plan-cg-beg::before,
.income-plan-table td.income-plan-cg-totals.income-plan-cg-beg::before {
    background: rgba(148, 163, 184, 0.55);
}

/* Beg cells: previous group's tint left of divider up to the line; current group tint on the right */
.income-plan-table td.income-plan-cg-cpu.income-plan-cg-beg {
    background-color: transparent;
    background-image: linear-gradient(to right, rgb(15, 23, 42) 0, rgb(15, 23, 42) 14px, rgba(76, 29, 149, 0.14) 14px, rgba(76, 29, 149, 0.14) 100%);
}
.income-plan-table th.income-plan-cg-cpu.income-plan-cg-beg {
    background-color: rgb(50, 18, 82);
    background-image: linear-gradient(to right, rgb(15, 23, 42) 0, rgb(15, 23, 42) 14px, rgb(50, 18, 82) 14px, rgb(50, 18, 82) 100%);
}
.income-plan-table td.income-plan-cg-ioa.income-plan-cg-beg {
    background-color: transparent;
    background-image: linear-gradient(to right, rgba(76, 29, 149, 0.14) 0, rgba(76, 29, 149, 0.14) 14px, rgba(30, 58, 138, 0.18) 14px, rgba(30, 58, 138, 0.18) 100%);
}
.income-plan-table th.income-plan-cg-ioa.income-plan-cg-beg {
    background-color: rgb(23, 37, 84);
    background-image: linear-gradient(to right, rgb(50, 18, 82) 0, rgb(50, 18, 82) 14px, rgb(23, 37, 84) 14px, rgb(23, 37, 84) 100%);
}
.income-plan-table td.income-plan-cg-wdwx.income-plan-cg-beg {
    background-color: transparent;
    background-image: linear-gradient(to right, rgba(30, 58, 138, 0.18) 0, rgba(30, 58, 138, 0.18) 14px, rgba(91, 20, 20, 0.2) 14px, rgba(91, 20, 20, 0.2) 100%);
}
.income-plan-table th.income-plan-cg-wdwx.income-plan-cg-beg {
    background-color: rgb(58, 12, 12);
    background-image: linear-gradient(to right, rgb(23, 37, 84) 0, rgb(23, 37, 84) 14px, rgb(58, 12, 12) 14px, rgb(58, 12, 12) 100%);
}
.income-plan-table td.income-plan-cg-jimmy.income-plan-cg-beg {
    background-color: transparent;
    background-image: linear-gradient(to right, rgba(91, 20, 20, 0.2) 0, rgba(91, 20, 20, 0.2) 14px, rgba(6, 95, 70, 0.16) 14px, rgba(6, 95, 70, 0.16) 100%);
}
.income-plan-table th.income-plan-cg-jimmy.income-plan-cg-beg {
    background-color: rgb(6, 78, 59);
    background-image: linear-gradient(to right, rgb(58, 12, 12) 0, rgb(58, 12, 12) 14px, rgb(6, 78, 59) 14px, rgb(6, 78, 59) 100%);
}
.income-plan-table td.income-plan-cg-totals.income-plan-cg-beg {
    background-color: transparent;
    background-image: linear-gradient(to right, rgba(6, 95, 70, 0.16) 0, rgba(6, 95, 70, 0.16) 14px, rgb(10, 10, 12) 14px, rgb(10, 10, 12) 100%);
}
.income-plan-table th.income-plan-cg-totals.income-plan-cg-beg {
    background-color: rgb(8, 8, 10);
    background-image: linear-gradient(to right, rgb(6, 78, 59) 0, rgb(6, 78, 59) 14px, rgb(8, 8, 10) 14px, rgb(8, 8, 10) 100%);
}

.income-plan-table td.income-plan-cg-cpu.income-plan-empty-cell {
    background-color: rgba(76, 29, 149, 0.22);
}
.income-plan-table td.income-plan-cg-ioa.income-plan-empty-cell {
    background-color: rgba(30, 58, 138, 0.24);
}
.income-plan-table td.income-plan-cg-wdwx.income-plan-empty-cell {
    background-color: rgba(91, 20, 20, 0.26);
}
.income-plan-table td.income-plan-cg-jimmy.income-plan-empty-cell {
    background-color: rgba(6, 95, 70, 0.22);
}

.income-plan-table td.income-plan-cg-cpu.income-plan-cg-beg.income-plan-empty-cell {
    background-image: linear-gradient(to right, rgb(15, 23, 42) 0, rgb(15, 23, 42) 14px, rgba(76, 29, 149, 0.22) 14px, rgba(76, 29, 149, 0.22) 100%);
}
.income-plan-table td.income-plan-cg-ioa.income-plan-cg-beg.income-plan-empty-cell {
    background-image: linear-gradient(to right, rgba(76, 29, 149, 0.22) 0, rgba(76, 29, 149, 0.22) 14px, rgba(30, 58, 138, 0.24) 14px, rgba(30, 58, 138, 0.24) 100%);
}
.income-plan-table td.income-plan-cg-wdwx.income-plan-cg-beg.income-plan-empty-cell {
    background-image: linear-gradient(to right, rgba(30, 58, 138, 0.24) 0, rgba(30, 58, 138, 0.24) 14px, rgba(91, 20, 20, 0.26) 14px, rgba(91, 20, 20, 0.26) 100%);
}
.income-plan-table td.income-plan-cg-jimmy.income-plan-cg-beg.income-plan-empty-cell {
    background-image: linear-gradient(to right, rgba(91, 20, 20, 0.26) 0, rgba(91, 20, 20, 0.26) 14px, rgba(6, 95, 70, 0.22) 14px, rgba(6, 95, 70, 0.22) 100%);
}

.income-plan-table td {
    padding: 0.26rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.income-plan-empty-cell {
    background: rgba(15, 23, 42, 0.14);
}

.income-plan-table th:nth-child(1),
.income-plan-table td:nth-child(1) {
    text-align: center;
}

.income-plan-input {
    width: 100%;
    min-width: 0;
    height: 1.8rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.36);
    color: var(--text-primary);
    font: inherit;
    box-sizing: border-box;
}

.income-plan-input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.58);
    background: rgba(15, 23, 42, 0.78);
}

/* Keep body inputs below sticky thead stacking (focus layer can otherwise paint through) */
.income-plan-table tbody .income-plan-input {
    position: relative;
    z-index: 0;
}

.income-plan-input-centered {
    text-align: center;
}

/* IOA Year, WDWx Year, Jimmy Year: fixed width, centered */
.income-plan-td-year {
    text-align: center;
    vertical-align: middle;
}
.income-plan-input.income-plan-input-year {
    width: 45px;
    min-width: 45px;
    max-width: 45px;
    box-sizing: border-box;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    display: block;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

.income-plan-input[data-income-plan-field="cpuSalary"],
.income-plan-input[data-income-plan-field="ioaSalary"],
.income-plan-input[data-income-plan-field="wdwx"],
.income-plan-input[data-income-plan-field="jimmySsaAnnual"],
.income-plan-input[data-income-plan-field="jimmyPensionAnnual"] {
    width: 75px;
    min-width: 75px;
    max-width: 75px;
    box-sizing: border-box;
}

.income-plan-input[data-income-plan-field="cpuBonus"],
.income-plan-input[data-income-plan-field="ioaBonus"] {
    width: 65px;
    min-width: 65px;
    max-width: 65px;
    box-sizing: border-box;
}

.income-plan-input[data-income-plan-field="cpuHourly"] {
    width: 55px !important;
    min-width: 55px !important;
    max-width: 55px !important;
    box-sizing: border-box !important;
}

.income-plan-table td:has([data-income-plan-field="cpuBonus"]),
.income-plan-table td:has([data-income-plan-field="ioaBonus"]) {
    padding-left: 0.12rem;
    padding-right: 0.12rem;
    text-align: right;
    vertical-align: middle;
}

.income-plan-td-cpu-bonus {
    text-align: right;
    vertical-align: middle;
}
.income-plan-td-has-dtsi-hint {
    overflow: visible;
}
.income-plan-cpu-bonus-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}
.income-plan-dtsi-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.95);
    transform: translate(35%, -35%);
    pointer-events: none;
}

.income-plan-input-right {
    text-align: right;
}

.income-plan-input-readonly {
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.45);
    cursor: default;
}

.income-plan-input-readonly:focus {
    border-color: rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.45);
}

.income-plan-input-wide {
    min-width: 23rem;
}

.income-plan-delete {
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: 6px;
    background: rgba(248, 113, 113, 0.08);
    color: #fca5a5;
    cursor: pointer;
}

.btn-secondary-small {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-secondary-small:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--accent);
}

.btn-payment-schedule-link {
    background: rgba(20, 184, 166, 0.14);
    color: #99f6e4;
    border: 1px solid rgba(20, 184, 166, 0.58);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: all 0.2s;
}

.btn-payment-schedule-link:hover:not(:disabled) {
    background: rgba(20, 184, 166, 0.25);
    color: #ffffff;
    border-color: #2dd4bf;
}

.payment-schedule-icon-button {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}

.payment-schedule-icon-inline {
    width: 16px;
    height: 16px;
    display: inline-block;
    object-fit: contain;
    vertical-align: -3px;
    flex: 0 0 auto;
}

.btn-payment-schedule-link:disabled {
    background: rgba(148, 163, 184, 0.08);
    color: rgba(148, 163, 184, 0.65);
    border-color: rgba(148, 163, 184, 0.18);
    cursor: not-allowed;
    box-shadow: none;
}

.monarch-tx-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
}

.monarch-tx-action-img {
    width: 28px;
    height: 28px;
    vertical-align: middle;
}

#btn-monarch-refresh.refresh-available {
    background: #064e3b;
    color: #d1fae5;
    border-color: #10b981;
}

#btn-monarch-refresh.refresh-available:hover {
    background: #047857;
    color: #ffffff;
    border-color: #34d399;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.checkbox-input {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.settings-section {
    padding-top: 2rem;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.settings-card-max {
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

.btn-back-dashboard {
    width: auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group-flex {
    flex: 1;
}

.modal-wide {
    max-width: 800px !important;
}

.tiller-cleanup-modal {
    width: min(94vw, 1100px) !important;
    max-width: 1100px !important;
    max-height: 86vh;
}

.tiller-cleanup-modal .modal-subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.tiller-cleanup-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.tiller-cleanup-progress-wrap {
    flex: 1;
    min-width: 220px;
}

.tiller-cleanup-progress {
    display: none;
    height: 7px;
    margin-top: 0.42rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
}

.tiller-cleanup-progress.is-active {
    display: block;
}

.tiller-cleanup-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.24s ease;
}

.tiller-cleanup-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tiller-cleanup-account-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.tiller-cleanup-account-row label {
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#tiller-cleanup-account-select {
    min-width: min(420px, 100%);
}

.tiller-cleanup-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 58vh;
    overflow: auto;
    padding-right: 0.35rem;
}

.tiller-cleanup-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1.5fr) 160px minmax(190px, 0.65fr) 82px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.52);
}

.tiller-cleanup-raw {
    min-width: 0;
}

.tiller-cleanup-raw-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tiller-cleanup-raw-meta,
.tiller-cleanup-confidence {
    color: var(--text-secondary);
    font-size: 0.74rem;
    margin-top: 0.18rem;
}

.tiller-cleanup-arrow {
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.tiller-cleanup-merchant-input {
    width: 100%;
    min-width: 0;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 650;
    padding: 0.48rem 0.6rem;
}

.tiller-cleanup-merchant-input:focus {
    border-color: #60a5fa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.14);
}

.tiller-cleanup-count {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 700;
    text-align: right;
}

.tiller-cleanup-empty {
    color: var(--text-secondary);
    padding: 2rem;
    text-align: center;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.modal-footer-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.schedule-settings-modal {
    width: min(760px, calc(100vw - 32px));
    max-width: 760px !important;
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.schedule-settings-modal .lic-source-text {
    margin-bottom: 0.75rem;
}

.schedule-settings-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.schedule-settings-title img {
    width: 28px;
    height: 25px;
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
}

.schedule-settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
}

.schedule-settings-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

.schedule-settings-modal .modal-section {
    margin-bottom: 0;
    padding: 0.85rem;
}

.schedule-settings-modal .radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.6rem 0 0;
}

.schedule-settings-input {
    width: 100% !important;
    margin: 0.55rem 0 0 !important;
}

.schedule-settings-subfields {
    margin-top: 0.7rem;
}

.schedule-settings-inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.schedule-settings-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-settings-checkbox + .schedule-settings-checkbox {
    margin-top: 0.65rem;
}

.schedule-settings-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0.55rem 0 0;
    line-height: 1.4;
}

.schedule-settings-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0.9rem;
}

@media (max-width: 720px) {
    .schedule-settings-modal {
        max-width: 500px !important;
    }

    .schedule-settings-grid {
        grid-template-columns: 1fr;
    }
}

.btn-save-full {
    flex: 0 0 auto;
    min-width: 9rem;
    padding: 12px 18px;
    border: 1px solid rgba(134, 239, 172, 0.42);
    border-radius: 8px;
    background: linear-gradient(180deg, #22c55e, #15803d);
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 12px 24px rgba(21, 128, 61, 0.25);
}

.btn-save-full::before {
    content: "💾 ";
}

.btn-cancel-full {
    flex: 0 0 auto;
    min-width: 7.5rem;
    padding: 12px 18px;
    border: 1px solid rgba(252, 165, 165, 0.32);
    border-radius: 8px;
    background: linear-gradient(180deg, #ef4444, #991b1b);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(153, 27, 27, 0.24);
}

.btn-cancel-full::before {
    content: "❌ ";
}

.btn-save-inline {
    border: 1px solid rgba(134, 239, 172, 0.42) !important;
    background: linear-gradient(180deg, #22c55e, #15803d) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 10px 20px rgba(21, 128, 61, 0.22) !important;
}

.btn-save-inline::before {
    content: "💾 ";
}

.btn-delete-ghost {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-delete-ghost:hover {
    background: rgba(239, 68, 68, 0.2);
}

.account-danger-zone {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.account-danger-zone-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.account-danger-zone-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.account-danger-zone-header h4 {
    margin: 0 0 0.25rem 0;
    color: var(--danger);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.account-danger-zone-header p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.account-danger-zone-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.account-danger-zone-label strong {
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    margin: 0 2px;
}

.account-danger-zone-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.account-danger-zone-input {
    flex: 1;
    min-width: 220px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
}

.account-danger-zone-input:focus {
    outline: none;
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.account-danger-zone-button {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
}

.account-danger-zone-button:disabled {
    background: rgba(239, 68, 68, 0.25);
    color: rgba(255, 255, 255, 0.55);
    cursor: not-allowed;
}

.account-danger-zone-button:not(:disabled):hover {
    background: #dc2626;
}

.settings-section {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.settings-section-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.settings-section-actions {
    display: flex;
    gap: 0.5rem;
}

.settings-section-description {
    margin: 0 0 1rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-tab-customizer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.settings-tab-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 90px minmax(160px, 1.8fr) auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.55rem 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.85rem;
}

.settings-tab-row-header {
    grid-template-columns: minmax(140px, 1fr) 90px minmax(160px, 1.8fr) auto;
    background: transparent;
    border: none;
    padding: 0 0.75rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 700;
}

.settings-tab-row-default {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.settings-tab-row-default-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 1rem;
    line-height: 1;
}

.settings-tab-row-default-icon img {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.settings-tab-row input[type="text"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 6px 9px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

.settings-tab-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.settings-tab-row-emoji-input {
    text-align: center;
    font-size: 1rem !important;
    padding: 6px 4px !important;
}

.settings-tab-row-image-locked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 6px 4px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(255, 255, 255, 0.02);
    cursor: not-allowed;
    user-select: none;
}

.settings-tab-row-reset {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
}

.settings-tab-row-reset:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.settings-tab-row-reset:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.settings-tab-row-account-type,
.settings-tab-row-header.settings-tab-row-account-type {
    grid-template-columns: 28px minmax(140px, 1fr) 90px minmax(100px, 1fr) auto;
}

.settings-account-type-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    color: var(--text-secondary);
    cursor: grab;
    user-select: none;
    font-size: 0.75rem;
    letter-spacing: -0.08em;
}

.settings-account-type-row-drag-over {
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.settings-account-type-row.settings-account-type-row-dragging {
    opacity: 0.55;
}

@media (max-width: 720px) {
    .settings-tab-row, .settings-tab-row-header {
        grid-template-columns: 1fr 80px;
        grid-template-areas:
            "name name"
            "emoji title"
            "default reset";
    }
}

.history-list-scroll {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 1rem;
}

.flex-1 {
    flex: 1;
}

.align-center {
    align-items: center;
}

.margin-bottom-10 {
    margin-bottom: 1rem;
}

.margin-bottom-15 {
    margin-bottom: 1.5rem;
}

.checkbox-group-padding {
    padding: 2px 4px;
}

.sync-info-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.lic-source-text {
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #818cf8;
}

/* JS Dynamic Content Classes */
/* Virtual Scrolling */
#transactions-list {
    position: relative;
    min-height: 400px;
    scrollbar-gutter: stable;
}

.virtual-spacer {
    display: block;
    width: 100%;
    pointer-events: none;
    visibility: hidden;
}

.virtual-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform;
}

/* Virtual List Styles */
#transactions-list {
    position: relative;
    overflow-y: auto;
    max-height: 800px; /* Fixed height for virtualization viewport */
    scrollbar-gutter: stable;
}

.virtual-spacer {
    width: 100%;
    pointer-events: none;
    visibility: hidden;
}

.virtual-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.empty-state-text {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
    font-size: 0.9rem;
}

.error-text {
    color: var(--danger);
    font-weight: 600;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    color: var(--text-primary);
}

.list-table tr {
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.85rem;
}

.list-table th,
.list-table td {
    padding: 12px 8px;
}

.list-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

.badge-manual {
    display: block;
    font-size: 0.65rem;
    color: #f59e0b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-portal-link {
    font-size: 0.7rem;
    color: var(--accent);
    text-decoration: none;
}

.item-portal-link:hover {
    text-decoration: underline;
}

.item-icon-btn {
    margin-left: 6px;
    cursor: help;
}

.badge-success-small {
    margin-left: 8px;
    font-size: 0.65rem;
    background: var(--success);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.paid-strike {
    opacity: 0.6;
    text-decoration: line-through;
}

.manual-highlight {
    color: #f59e0b !important;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.list-item-column {
    padding: 0.8rem;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.item-row-between {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.item-notes-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 4px;
    width: 100%;
    font-style: italic;
}

.list-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0.5rem;
    border-top: 1px solid var(--card-border);
    margin-top: 1rem;
}

.legend-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.account-nickname-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    font-weight: 700;
    border: 1px solid rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Master Table Specialty Classes */
.scroll-container {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.master-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.master-table thead {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.master-table th {
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    background: #1e293b;
    border-bottom: 2px solid var(--accent);
}

.master-table td {
    padding: 10px 16px;
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: #1e293b;
}

.master-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

/* â”€â”€ Master Accounts Column Drag-to-Rearrange â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.master-th-draggable {
    cursor: grab;
    position: relative;
    padding-left: 18px !important;
}
.master-th-draggable::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 12px;
    opacity: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1.6px);
    background-size: 4px 4px;
    pointer-events: none;
    transition: opacity 0.15s;
}
.master-th-draggable:hover::before {
    opacity: 1;
}
.master-th-draggable:active {
    cursor: grabbing;
}
.master-th-dragging {
    opacity: 0.4;
}
.master-th-drag-over {
    border-left: 2px solid #6366f1 !important;
    box-shadow: inset 4px 0 8px rgba(99, 102, 241, 0.25);
}
/* â”€â”€ Save Columns Button â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.btn-save-columns {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.75rem !important;
    background: linear-gradient(180deg, #6366f1, #4f46e5) !important;
    border-color: rgba(165,180,252,0.3) !important;
    color: #fff !important;
    animation: save-columns-pulse 2s ease-in-out infinite;
}
@keyframes save-columns-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

.sticky-col-header {
    position: sticky;
    left: 0;
    z-index: 1001;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
}

.sticky-col-cell {
    position: sticky;
    left: 0;
    z-index: 20;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
}

.status-open {
    color: #34d399;
}

.status-paid {
    color: #fbbf24;
}

.status-closed {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.col-bank {
    font-weight: 700;
    color: var(--accent);
}

.col-account-name {
    font-weight: 600;
}

.monarch-bal-name-line {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.monarch-bal-quick-note-btn {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease;
}

.monarch-bal-row:hover .monarch-bal-quick-note-btn,
.monarch-bal-quick-note-btn:focus-visible {
    opacity: 0.9;
}

.monarch-bal-quick-note-btn.has-note {
    opacity: 1;
}

.monarch-bal-quick-note-btn:hover {
    background: rgba(148, 163, 184, 0.18);
}

.monarch-bal-quick-note-popover {
    position: absolute;
    z-index: 1200;
    width: min(320px, calc(100vw - 24px));
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: oklch(0.22 0.02 260);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.monarch-bal-quick-note-popover textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: oklch(0.18 0.02 260);
    color: oklch(0.92 0.01 90);
    padding: 0.5rem 0.6rem;
    font: inherit;
}

.monarch-bal-quick-note-popover-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
    align-items: center;
}

.monarch-bal-qn-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    box-sizing: border-box;
}

.monarch-bal-qn-btn[hidden] {
    display: none !important;
}

.monarch-bal-qn-btn--close {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: none;
}

.monarch-bal-qn-btn--close:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

.monarch-bal-qn-btn--cancel,
.monarch-bal-qn-btn--clear {
    border: 1px solid rgba(252, 165, 165, 0.32);
    background: linear-gradient(180deg, #ef4444, #991b1b);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(153, 27, 27, 0.22);
}

.monarch-bal-qn-btn--cancel:hover,
.monarch-bal-qn-btn--clear:hover {
    filter: brightness(1.08);
}

.monarch-bal-qn-btn--save {
    border: 1px solid rgba(134, 239, 172, 0.42);
    background: linear-gradient(180deg, #22c55e, #15803d);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(21, 128, 61, 0.22);
}

.monarch-bal-qn-btn--save:hover {
    filter: brightness(1.08);
}

.monarch-bal-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.monarch-card-brand-icon {
    width: 30px;
    height: 20px;
    display: block;
    object-fit: contain;
    border-radius: 3px;
}

.monarch-bank-logo {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
    border-radius: 7px;
    padding: 3px;
    box-sizing: border-box;
}

.monarch-bal-payment-schedule-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 2px;
    border: 0;
    outline: 0;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
}

.monarch-bal-payment-schedule-btn:hover {
    background: rgba(20, 184, 166, 0.16);
}

.monarch-bal-payment-schedule-btn img {
    width: 16px;
    height: 14px;
    display: block;
    object-fit: contain;
}

.monarch-bal-activity-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    outline: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: rgba(226, 232, 240, 0.55);
    transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.monarch-bal-activity-btn:hover,
.monarch-bal-activity-btn:focus-visible {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
}

.monarch-bal-activity-btn.is-disabled {
    opacity: 0.28;
    cursor: not-allowed;
    color: rgba(226, 232, 240, 0.4);
}

.monarch-bal-activity-btn.is-disabled:hover,
.monarch-bal-activity-btn.is-disabled:focus-visible {
    background: transparent;
    color: rgba(226, 232, 240, 0.4);
}

.monarch-bal-activity-btn svg {
    width: 15px;
    height: 15px;
    display: block;
}

.monarch-bal-apr {
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.master-account-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s;
    border-bottom: 1px dashed transparent;
}

.master-account-link:hover {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.col-balance {
    font-weight: 600;
    text-align: right;
}

.col-apr {
    color: var(--text-secondary);
    font-style: italic;
}

/* History & Overrides */
.history-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.history-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.linked-sheet-override {
    font-size: 0.8rem;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
    padding: 8px;
    border-radius: 6px;
    width: 100%;
    margin-top: 8px;
    border: 1px dashed rgba(99, 102, 241, 0.4);
    line-height: 1.4;
}

.linked-sheet-header {
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* License & Subscription Specifics */
.license-item-container {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.linked-sheet-panel {
    font-size: 0.8rem;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
    padding: 8px;
    border-radius: 6px;
    width: 100%;
    margin-top: 8px;
    border: 1px dashed rgba(99, 102, 241, 0.4);
    line-height: 1.4;
}

.linked-sheet-header {
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-timeline-trigger {
    display: flex;
    justify-content: space-between;
    width: 100%;
    border-top: 1px solid var(--card-border);
    padding-top: 8px;
    margin-top: 4px;
    align-items: center;
}

.history-link-text {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--accent);
}

.history-purchased-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

.history-match-rule {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.history-notes-panel {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(0, 0, 0, 0.1);
    padding: 6px;
    border-radius: 4px;
    width: 100%;
    margin-top: 4px;
}

.inline-loader-small {
    width: 12px;
    height: 12px;
    display: inline-block;
    border-width: 2px;
    margin-right: 6px;
}

.flex-gap-10 {
    display: flex;
    gap: 10px;
}

/* â”€â”€ Licenses table-style grid â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#licenses-tab {
    max-height: calc(100vh - 190px);
    overflow: hidden;
}
#licenses-tab.active {
    display: flex;
    flex-direction: column;
}
#licenses-tab .card-header {
    flex-shrink: 0;
}
#licenses-tab .secondary-tabs-nav {
    width: 100%;
    align-items: center;
}
#licenses-search-wrap {
    width: 500px;
    max-width: 500px;
    flex-shrink: 0;
}
#licenses-search-wrap .search-input-pill {
    width: 100%;
    max-width: none;
}
#subscriptions-header-actions .badge,
#subscriptions-header-actions .btn-accent-small,
#subscriptions-header-actions select {
    white-space: nowrap;
    flex-shrink: 0;
    width: auto;
    min-width: max-content;
}
#licenses-list {
    overflow: auto;
    min-height: 0;
    max-height: calc(100vh - 285px);
    padding-bottom: 0.75rem;
}
.lic-grid-header,
.lic-grid-row {
    display: grid;
    grid-template-columns: 34px minmax(140px, 2fr) 100px 90px 70px 60px;
    padding: 0.4rem 1rem;
    min-width: 0;
    gap: 0.5rem;
}
.lic-grid-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}
.lic-grid-header-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.lic-grid-header-sortable:hover {
    color: var(--accent, #818cf8);
}
.lic-grid-row {
    align-items: center;
    border-radius: 6px;
    padding: 0.4rem 1rem;
    transition: background 0.1s;
}
.lic-grid-row:hover {
    background: rgba(255,255,255,0.03);
}
.lic-grid-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lic-grid-select {
    display: flex;
    align-items: center;
    justify-content: center;
}
.lic-merge-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--accent);
}
.lic-grid-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.lic-grid-name .clickable-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.license-merge-modal {
    width: min(980px, calc(100vw - 32px));
    max-width: 980px !important;
    max-height: 88vh;
    overflow: auto;
}
.license-merge-subtitle {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin: -0.35rem 0 0.85rem;
}
.license-merge-compare-header,
.license-merge-field-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.55rem;
    align-items: stretch;
}
.license-merge-compare-header {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.25rem;
}
.license-merge-fields {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.license-merge-field-label {
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 800;
    align-self: center;
}
.license-merge-choice {
    min-height: 38px;
    text-align: left;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.license-merge-choice.selected {
    border-color: rgba(52, 211, 153, 0.7);
    background: rgba(16, 185, 129, 0.16);
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.2);
}
.license-merge-actions {
    margin-top: 1rem;
}
.lic-grid-edit-icon {
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s;
}
.lic-grid-row:hover .lic-grid-edit-icon {
    opacity: 0.6;
}
.lic-grid-edit-icon:hover {
    opacity: 1 !important;
    color: var(--accent, #818cf8);
}
.lic-grid-amount {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--expense);
    text-align: right;
}
.lic-grid-freq {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
}
.lic-grid-badges {
    text-align: center;
}
.badge-schedule-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0.12rem 0.45rem;
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #facc15;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    line-height: 1.15;
}
.badge-schedule-only:hover {
    background: rgba(245, 158, 11, 0.24);
    border-color: rgba(250, 204, 21, 0.5);
}
.lic-grid-actions {
    text-align: right;
}
.lic-grid-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.1s;
    opacity: 0;
}
.lic-grid-row:hover .lic-grid-actions button {
    opacity: 0.5;
}
.lic-grid-actions button:hover {
    opacity: 1 !important;
    color: #ef4444;
    background: rgba(239,68,68,0.1);
}

/* Expandable details row */
.lic-details-row {
    display: none;
    grid-column: 1 / -1;
    padding: 0.5rem 1rem 0.7rem;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.02);
    border-radius: 0 0 8px 8px;
    border-top: 1px solid var(--card-border);
    margin-top: -0.4rem;
}
.lic-grid-row.open + .lic-details-row {
    display: block;
}
.lic-grid-row.open {
    background: rgba(255,255,255,0.03);
    border-radius: 8px 8px 0 0;
}
.lic-details-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.lic-detail-row {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}
.lic-detail-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
}
.lic-detail-value {
    color: var(--text-primary);
}
.brand-logo {
    height: 56px;
    width: auto;
    max-width: min(280px, 42vw);
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header h1 span {
    font-weight: 300;
    color: var(--text-secondary);
}

/* Header Outlook / MS Graph status */
.header-outlook-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-outlook-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
}

.header-outlook-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.header-outlook-btn.status-ok .header-outlook-ring {
    border-color: #34d399;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
}

.header-outlook-btn.status-error .header-outlook-ring {
    border-color: #f87171;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
}

.header-outlook-btn.status-warning .header-outlook-ring {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.18);
}

.header-outlook-btn.status-pending .header-outlook-ring {
    border-color: rgba(148, 163, 184, 0.35);
    animation: monarchStatusHeartbeat 1.2s ease-in-out infinite;
}

@keyframes monarchStatusHeartbeat {
    0%, 100% { box-shadow: 0 0 0 0 rgba(148, 163, 184, 0); }
    50% { box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.22); }
}

.header-outlook-icon {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
    pointer-events: none;
}

.header-beeper-icon {
    border-radius: 6px;
}

.subscription-reminder-alerts,
.billing-missing-contact-alerts,
.billing-opp-fee-alerts,
.fi-cron-alerts,
.billing-overdue-alerts,
.billing-zelle-alerts,
.billing-pending-credit-alerts,
.monarch-tx-followup-alerts,
.est-tax-header-alert-wrap,
.monarch-mfa-alerts,
.monarch-api-watch-alerts,
.backup-status-alert-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: 100%;
    flex: 0 1 auto;
    margin-left: 0;
}

/* Design handoff alert chips: dark surface + left accent (not filled capsules) */
.subscription-reminder-alert,
.billing-missing-contact-alert,
.billing-opp-fee-alert,
.fi-cron-alert,
.billing-overdue-alert,
.billing-zelle-alert,
.billing-pending-credit-alert,
.monarch-tx-followup-alert,
.est-tax-header-alert,
.monarch-mfa-alert-link,
.monarch-api-watch-alert,
.backup-status-alert,
.header-alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    padding: 11px 16px;
    border-radius: 12px;
    background: oklch(0.20 0.02 260);
    border: 1px solid oklch(1 0 0 / 8%);
    border-left: 3px solid oklch(0.75 0.14 80);
    color: oklch(0.9 0.01 90);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    text-decoration: none;
    animation: none;
}

.subscription-reminder-alert:hover,
.billing-missing-contact-alert:hover,
.billing-opp-fee-alert:hover,
.fi-cron-alert:hover,
.billing-overdue-alert:hover,
.billing-zelle-alert:hover,
.billing-pending-credit-alert:hover,
.monarch-tx-followup-alert:hover,
.est-tax-header-alert:hover,
.monarch-mfa-alert-link:hover,
.monarch-api-watch-alert:hover,
.backup-status-alert:hover,
.header-alert-chip:hover {
    background: oklch(0.24 0.02 260);
}

.billing-missing-contact-alert,
.billing-zelle-alert,
.billing-pending-credit-alert,
.est-tax-header-alert:not(.est-tax-header-alert--overdue),
.monarch-api-watch-alert--available,
.header-alert-chip--info {
    border-left-color: oklch(0.68 0.13 250);
}

.fi-cron-alert,
.est-tax-header-alert--overdue,
.backup-status-alert--error,
.header-alert-chip--danger {
    border-left-color: oklch(0.62 0.19 25);
}

.subscription-reminder-alert,
.billing-opp-fee-alert,
.billing-overdue-alert,
.monarch-tx-followup-alert,
.monarch-mfa-alert-link,
.monarch-api-watch-alert--still-watching,
.backup-status-alert--stale,
#consulting-outstanding-alert .est-tax-header-alert,
#consulting-submit-hours-alert .est-tax-header-alert,
#consulting-unmatched-paychecks-alert .est-tax-header-alert,
.header-alert-chip--warning {
    border-left-color: oklch(0.75 0.14 80);
}

.header-alert-chip-icon {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    display: block;
}

.header-alert-chip-title,
.subscription-reminder-alert-text,
.billing-missing-contact-alert-text,
.fi-cron-alert-text,
.billing-overdue-alert-text,
.billing-zelle-alert-text,
.billing-pending-credit-alert-text,
.monarch-tx-followup-alert-text,
.est-tax-header-alert-text {
    color: oklch(0.9 0.01 90);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-alert-chip-detail {
    color: oklch(0.65 0.02 260);
    font-size: 13px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.est-tax-header-alert--overdue {
    background: oklch(0.20 0.02 260);
    color: oklch(0.9 0.01 90);
}

#consulting-outstanding-alert .est-tax-header-alert,
#consulting-submit-hours-alert .est-tax-header-alert,
#consulting-unmatched-paychecks-alert .est-tax-header-alert {
    background: oklch(0.20 0.02 260);
    color: oklch(0.9 0.01 90);
}

.monarch-tx-followup-section {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(245, 158, 11, 0.24);
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.08);
}

.monarch-tx-followup-section.is-active {
    border-color: rgba(245, 158, 11, 0.62);
    background: rgba(245, 158, 11, 0.14);
}

.monarch-tx-followup-head,
.monarch-tx-followup-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.monarch-tx-followup-toggle {
    color: #fbbf24;
    font-size: 0.82rem;
    font-weight: 800;
}

.monarch-tx-followup-helper {
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.billing-invoice-client {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.billing-fi-credit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 0;
    border-radius: 4px;
}

.billing-fi-credit-icon img {
    display: block;
    width: 16px;
    height: 16px;
}

.billing-fi-credit-icon:hover,
.billing-fi-credit-icon.is-open {
    filter: brightness(1.2);
}

.billing-fi-credit-icon.is-open {
    outline: 1px solid rgba(74, 222, 128, 0.7);
}

.billing-pending-credits {
    margin-bottom: 1rem;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.28), rgba(15, 23, 42, 0.45));
}

.billing-pending-credits__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.billing-pending-credits__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #e2e8f0;
}

.billing-pending-credits__hint {
    margin: 0.3rem 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.35;
}

.billing-pending-credits__list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.billing-pending-credits__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.55rem 0.85rem;
    align-items: center;
    padding: 0.55rem 0.7rem;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.35);
}

.billing-pending-credits__meta {
    min-width: 0;
}

.billing-pending-credits__client {
    font-weight: 750;
    font-size: 0.88rem;
}

.billing-pending-credits__detail {
    margin-top: 0.15rem;
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.35;
}

.billing-pending-credits__amount {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    color: #93c5fd;
    white-space: nowrap;
}

.billing-pending-credits__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
    grid-column: 1 / -1;
}

.billing-pending-credits__notice-history {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.15rem;
}

.billing-pending-credits__notice-history .billing-pending-credits__detail {
    margin-top: 0;
}

.billing-pending-credits__btn {
    min-height: 32px;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.billing-pending-credits__btn--primary {
    border-color: rgba(134, 239, 172, 0.35);
    background: linear-gradient(180deg, #22c55e, #15803d);
    color: #fff;
}

.billing-pending-credits__btn--info {
    border-color: rgba(147, 197, 253, 0.4);
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    color: #fff;
}

.billing-pending-credits__btn--danger {
    border-color: rgba(252, 165, 165, 0.35);
    background: linear-gradient(180deg, #ef4444, #991b1b);
    color: #fff;
}

.billing-pending-credits__btn:hover {
    filter: brightness(1.08);
}

.billing-pending-credits__row--warn {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(120, 53, 15, 0.18);
}

.billing-pending-credits__badge-warn {
    margin-left: 0.4rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.45);
    color: #fde68a;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.billing-pending-credits__badge-id {
    margin-left: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
}

.billing-pending-credits__empty {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.subscription-reminder-alert button {
    border: 1px solid rgba(31, 41, 55, 0.22);
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.12);
    color: #1f2937;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 0.1rem 0.38rem;
}

@keyframes reminderHeartbeat {
    0%, 44%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 24px rgba(250, 204, 21, 0.28);
    }
    12% {
        transform: scale(1.035);
        box-shadow: 0 12px 30px rgba(250, 204, 21, 0.48);
    }
    22% {
        transform: scale(0.992);
    }
    32% {
        transform: scale(1.025);
    }
}

@keyframes reminderRowHeartbeat {
    0%, 44%, 100% {
        box-shadow: 0 8px 18px rgba(250, 204, 21, 0.24);
        filter: brightness(1);
    }
    12% {
        box-shadow: 0 10px 24px rgba(250, 204, 21, 0.42);
        filter: brightness(1.06);
    }
    22% {
        filter: brightness(0.99);
    }
    32% {
        box-shadow: 0 9px 22px rgba(250, 204, 21, 0.34);
        filter: brightness(1.03);
    }
}

.header-monarch-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: #fff7ed;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
}

/* Settings Gear */
.settings-gear {
    position: relative;
    top: auto;
    right: auto;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.settings-gear svg {
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}

.settings-gear:hover {
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.settings-gear:hover svg {
    transform: rotate(90deg);
}

/* Dashboard Layout - Tabbed */
.dashboard {
    display: block;
    max-width: 100%;
    margin: 0 auto;
}

/* Tabs Navigation */
/* Left sidebar, aligned to the centered shell rather than the screen edge. */
.tabs-nav {
    position: fixed;
    top: 0;
    left: max(0px, calc((100% - var(--app-max)) / 2));
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0.9rem 0.65rem 3rem;
    background: var(--card-bg);
    border-right: 1px solid var(--card-border);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.15rem 0.35rem 0.65rem 0.35rem;
}

.sidebar-logo-lockup {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-logo-full {
    display: block;
    height: 40px;
    width: auto;
    max-width: 100%;
}

.sidebar-logo-mark {
    display: none;
    width: 36px;
    height: auto;
}

.sidebar-collapse-btn {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.nav-section-label {
    padding: 0.9rem 0.6rem 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.7);
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

.tabs-nav .tab-btn {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
    padding: 0.42rem 0.6rem;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    border-radius: 8px;
    color: var(--text-secondary);
    box-shadow: none;
    transform: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tabs-nav .tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: none;
}

.tabs-nav .tab-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: none;
}

.tabs-nav .tab-icon {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 1.15rem;
}

.tabs-nav .tab-icon img {
    width: 22px !important;
    height: 22px !important;
    display: block;
    object-fit: contain;
}

.tabs-nav .tab-label {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed sidebar: icons only; label remains the button tooltip. */
body.sidebar-collapsed {
    --sidebar-w: 64px;
}

body.sidebar-collapsed .tabs-nav .tab-label {
    display: none;
}

body.sidebar-collapsed .sidebar-logo-full {
    display: none;
}

body.sidebar-collapsed .sidebar-logo-mark {
    display: block;
}

body.sidebar-collapsed .sidebar-brand {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.1rem 0 0.5rem;
}

body.sidebar-collapsed .sidebar-logo-lockup {
    flex: 0 0 auto;
}

body.sidebar-collapsed .tabs-nav .tab-btn {
    justify-content: center;
    padding-inline: 0;
}

body.sidebar-collapsed .nav-section-label {
    height: 1px;
    margin: 0.5rem 0.4rem;
    padding: 0;
    font-size: 0;
    background: var(--card-border);
}

/* Balances Two-Column Layout */
.balances-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 650px) {
    .balances-container {
        grid-template-columns: 1fr;
    }
}

.balances-column h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Consulting Manager Table */
.manager-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.manager-table th {
    text-align: left;
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--card-border);
}

.manager-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    vertical-align: middle;
}

.manager-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

#consulting-manager-tab {
    height: calc(100vh - 250px);
    display: none;
    flex-direction: column;
}

#consulting-manager-tab.active {
    display: flex;
}

#consulting-manager-tab .card-body {
    flex: 1;
    overflow-y: auto;
    padding-top: 0;
}

#consulting-manager-tab .table-container {
    margin-top: 0;
}


.tab-btn {
    flex: 1;
    padding: 0.45rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 50px;
}

/* Tab icon â€” emoji with badge dot positioned top-right */
.tab-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    padding: 4px;
}

.image-tab-icon img,
.wdwx-tab-icon img {
    width: 26px;
    height: 26px;
    display: block;
    object-fit: contain;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.wdwx-shell {
    display: none;
}

.wdwx-shell.active {
    display: block;
}

.wdwx-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}


.wdwx-subpage-nav {
    display: flex;
    gap: 0.5rem;
    
    padding: 0.4rem;
    width: fit-content;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.wdwx-subpage-btn {
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wdwx-subpage-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.wdwx-subpage-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.wdwx-subpage {
    display: none;
}

.wdwx-subpage.active {
    display: block;
    animation: fadeInContent 0.4s ease-out;
}

.payments-subpage-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.payments-subpage-btn {
    border: 1px solid rgba(99, 102, 241, 0.22);
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.payments-subpage-btn:hover {
    background: rgba(99, 102, 241, 0.16);
    color: var(--text-primary);
}

.payments-subpage-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.payments-subpage {
    display: none;
}

.payments-subpage.active {
    display: block;
    animation: fadeInContent 0.35s ease-out;
}

.cashflow-chart-shell {
    position: relative;
    width: 100%;
    min-height: 460px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.10), transparent 34%),
        rgba(15, 23, 42, 0.42);
    padding: 1rem;
    box-sizing: border-box;
}

.cashflow-chart-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
}

.cashflow-chart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.cashflow-range-control {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
}

.cashflow-range-control input {
    width: 5.25rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font-weight: 800;
}

.cashflow-range-control input[type="date"] {
    width: 8.75rem;
}

.cashflow-range-control select {
    min-width: 15rem;
    max-width: 24rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font-weight: 800;
}

.cashflow-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.cashflow-legend-dot,
.cashflow-legend-bar {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.cashflow-legend-bar {
    border-radius: 3px;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}

.cashflow-legend-net {
    width: 0.9rem;
    height: 0.2rem;
    border-radius: 999px;
    background: #facc15;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
}

.cashflow-legend-posted {
    width: 0.9rem;
    height: 0.2rem;
    border-radius: 999px;
    background: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
}

.cashflow-chart-svg {
    width: 100%;
    height: 420px;
    display: block;
}

/* Secondary (Sub) Tabs */
.secondary-tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    padding: 0.4rem;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    width: fit-content;
}

#tax-review-tab .secondary-tabs-nav {
    margin: 0.1rem 0 0.65rem 0;
}

#taxes-tab .secondary-tabs-nav {
    width: 100%;
    align-items: center;
}

.taxes-folder-control {
    margin-left: 0.45rem;
}

#taxes-tab .taxes-folder-control .tax-folder-link {
    max-width: calc(100vw - 48rem);
}

.taxes-master-year {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding-right: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.taxes-master-year > span {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.85;
}

.taxes-master-year select.search-input-pill {
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
}

.sub-tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sub-tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.sub-tab-btn span {
    margin-left: 4px;
    font-weight: 700;
    color: inherit;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
    animation: fadeInContent 0.4s ease-out;
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    display: none; /* Hidden until activated */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
}

.tab-btn.active .tab-progress-bar {
    background: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Tab Content Switching */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

/* Investments tab */
#investments-tab .investments-header {
    align-items: flex-start;
}

#investments-tab .investments-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.investment-summary-band {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background:
        linear-gradient(135deg, rgba(59, 130, 246, 0.12), transparent 38%),
        rgba(15, 23, 42, 0.5);
}

.investment-summary-band h3 {
    margin: 0.2rem 0 0;
    font-size: 1rem;
    font-weight: 750;
}

.investment-summary-band p {
    margin: 0;
    max-width: 40rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.4;
}

.investment-eyebrow {
    color: #93c5fd;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.investment-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.investment-card {
    position: relative;
    min-height: 13.25rem;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.52)),
        rgba(2, 6, 23, 0.34);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.investment-edit-btn {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 1.55rem;
    height: 1.55rem;
    border: 1px solid rgba(147, 197, 253, 0.28);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    cursor: pointer;
    font-weight: 800;
}

.investment-edit-btn:hover {
    background: rgba(59, 130, 246, 0.22);
    color: #fff;
}

.investment-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-right: 2.1rem;
}

.investment-icon {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(59, 130, 246, 0.16);
    font-size: 1.2rem;
}

.investment-type {
    max-width: 15rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-align: right;
    text-transform: uppercase;
}

.investment-card h3 {
    margin: 0.9rem 0 0.45rem;
    font-size: 1.05rem;
}

.investment-card p {
    min-height: 4rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.42;
}

.investment-balance {
    margin-top: 0.85rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.1);
}

.investment-balance span,
.investment-detail-list span {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.investment-balance strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.28rem;
}

.investment-detail-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.investment-detail-list div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.investment-detail-list strong {
    text-align: right;
    font-size: 0.82rem;
}

.investment-monarch-feed {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding: 0.75rem 0.8rem;
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.12), transparent 45%),
        rgba(2, 6, 23, 0.28);
}

.investment-monarch-muted {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.investment-monarch-head,
.investment-monarch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.investment-monarch-head span {
    color: #fbbf24;
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.investment-monarch-head strong {
    color: #fde68a;
    font-size: 1rem;
}

.investment-monarch-row {
    padding-top: 0.45rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.investment-monarch-section-title {
    padding-top: 0.45rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    color: #93c5fd;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.investment-monarch-section-title + .investment-monarch-row {
    border-top: 0;
    padding-top: 0.15rem;
}

.investment-monarch-row div {
    min-width: 0;
}

.investment-monarch-row strong,
.investment-monarch-row em,
.investment-monarch-row span {
    display: block;
}

.investment-monarch-row strong {
    font-size: 0.82rem;
}

.investment-monarch-row em {
    margin-top: 0.15rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 700;
}

.investment-monarch-row span {
    margin-top: 0.15rem;
    color: var(--text-secondary);
    font-size: 0.73rem;
}

.investment-monarch-row b {
    white-space: nowrap;
    color: #fde68a;
}

.investment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.investment-meta span {
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.investment-meta strong {
    text-align: right;
}

.investment-meta a {
    color: #93c5fd;
    font-weight: 750;
    text-align: right;
    text-decoration: none;
}

.investment-meta a:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

.investment-editor {
    max-width: 680px;
}

.investment-editor-body {
    display: grid;
    gap: 0.8rem;
}

.investment-editor-body label {
    display: grid;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.investment-editor-body input,
.investment-editor-body textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font: inherit;
    padding: 0.55rem 0.65rem;
    text-transform: none;
    letter-spacing: 0;
}

.investment-editor-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 1050px) {
    .investment-grid {
        grid-template-columns: 1fr;
    }

    .investment-summary-band {
        flex-direction: column;
    }
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: none;
    animation: fadeIn 1s ease-out;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Lists */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.8rem;
    transition: background 0.2s ease;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.item-left {
    display: flex;
    flex-direction: column;
}

.item-title {
    font-weight: 600;
    font-size: 1rem;
}

.item-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.item-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.expense {
    color: var(--danger);
}

.item-date {
    font-size: 0.85rem;
    color: #fbbf24;
    /* Warning yellow for upcoming */
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1.5rem;
    width: 100%;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
    margin: 2rem auto;
}

#billing-send-busy {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.72);
}

.billing-send-busy-inner {
    text-align: center;
}

#billing-send-busy .loader {
    margin: 0 auto 0.75rem;
}

.billing-send-busy-text {
    color: var(--text-secondary, #cbd5e1);
    font-size: 0.95rem;
    font-weight: 600;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 1rem;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-bottom: 0.5rem;
}

.calendar-day {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    min-height: 80px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
}

.day-number {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.calendar-day.today .day-number {
    color: var(--accent);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.cal-event {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    cursor: default;
}

.cal-event.expense {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.cal-event.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#btn-edit-loan-account,
.loan-master-account-btn {
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

.btn-icon:hover {
    background: var(--accent);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.3s ease-out forwards;
}

@keyframes modalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.8rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--danger);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 76px;
    line-height: 1.4;
}

.form-group textarea::placeholder,
.form-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

/* Master Account Manager Styles */
#master-accounts-tab {
    max-width: 100%;
    margin: 0 auto;
    height: calc(100vh - 250px);
    display: none;
    /* Controlled by JS tab switching */
    flex-direction: column;
    --master-select-col-width: 42px;
}

#master-accounts-tab.active {
    display: flex;
}

#master-accounts-tab .card-body {
    flex: 1;
    overflow: hidden;
    /* Prevent body overflow, inner div will scroll */
    padding: 0 !important;
    /* Remove padding for the table area to maximize space */
    border-radius: 0 0 20px 20px;
}

#master-accounts-list {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#master-accounts-list .master-duplicate-filters {
    flex-shrink: 0;
}

#master-accounts-list .master-duplicate-banner {
    flex-shrink: 0;
}

#master-accounts-tab #master-accounts-scroll {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    width: 100%;
}

#master-accounts-tab .master-table.master-table-resizable {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.master-table {
    width: 100%;
    border-collapse: collapse;
}

#master-accounts-tab .master-table th.master-col-select,
#master-accounts-tab .master-table td.master-col-select {
    position: sticky;
    left: 0;
    z-index: 103;
    box-sizing: border-box;
    width: var(--master-select-col-width);
    min-width: var(--master-select-col-width);
    max-width: var(--master-select-col-width);
    padding: 8px 4px;
    text-align: center;
    background: #1e293b;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.25);
}

#master-accounts-tab .master-table td.master-col-select {
    z-index: 12;
}

#master-accounts-tab .master-table th.sticky-col-header,
#master-accounts-tab .master-table td.sticky-col-cell {
    position: sticky;
    left: var(--master-select-col-width);
    z-index: 102;
    background: #1e293b;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.25);
}

#master-accounts-tab .master-table td.sticky-col-cell {
    z-index: 11;
}

.master-table th.master-sort-header {
    position: relative;
    overflow: hidden;
}

.master-col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
}

.master-col-resize-handle::after {
    content: '';
    position: absolute;
    top: 18%;
    bottom: 18%;
    right: 3px;
    width: 2px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    transition: background 0.15s;
}

.master-col-resize-handle:hover::after,
.master-col-resize-handle.resizing::after {
    background: rgba(129, 140, 248, 0.85);
}

.master-row-select-checkbox,
.master-select-all-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.master-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.master-table th {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1e293b;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid var(--accent);
}

.master-table th.master-sort-header {
    cursor: pointer;
    user-select: none;
}

.master-table th.master-sort-header:hover {
    background: #27364d;
    color: #ffffff;
}

.master-sort-indicator {
    margin-left: 0.35rem;
    font-size: 0.62rem;
    color: #94a3b8;
    vertical-align: middle;
}

.master-account-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.master-duplicate-filters {
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px dashed rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
}

.master-duplicate-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.master-dup-filter {
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(15, 23, 42, 0.55);
    color: #fde68a;
    border-radius: 999px;
    padding: 0.32rem 0.75rem;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.master-dup-filter:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.16);
    border-color: rgba(251, 191, 36, 0.65);
}

.master-dup-filter.is-active {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(251, 191, 36, 0.85);
    color: #fff7d6;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.25);
}

.master-dup-filter.is-empty,
.master-dup-filter:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.master-dup-filter-clear {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.74rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.2rem 0.35rem;
}

.master-duplicate-filter-hint {
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.master-dupe-group-header td {
    padding: 0.45rem 0.65rem;
    background: rgba(251, 191, 36, 0.1);
    border-top: 1px solid rgba(251, 191, 36, 0.22);
    border-bottom: 1px solid rgba(251, 191, 36, 0.14);
}

.master-dupe-group-header-inner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.master-dupe-group-title {
    color: #fde68a;
    font-size: 0.78rem;
    font-weight: 700;
}

.master-dupe-group-count {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.master-dupe-group-select-btn {
    margin-left: auto;
    border: 1px solid rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.14);
    color: #c7d2fe;
    border-radius: 999px;
    padding: 0.22rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.master-dupe-group-select-btn:hover {
    background: rgba(99, 102, 241, 0.24);
}

#master-accounts-tab .master-table tr.master-row-dupe-visible td {
    background: rgba(251, 191, 36, 0.04);
}

.master-duplicate-banner {
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px dashed rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.master-column-chooser-modal {
    max-width: 420px;
    width: min(420px, calc(100vw - 32px));
}

.master-column-chooser-help {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.master-column-chooser-list {
    max-height: min(52vh, 420px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-right: 0.15rem;
}

.master-column-chooser-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    cursor: grab;
    user-select: none;
}

.master-column-chooser-row-hidden {
    opacity: 0.62;
}

.master-column-chooser-row-drag-over {
    border-color: rgba(20, 184, 166, 0.55);
    background: rgba(20, 184, 166, 0.12);
}

.master-column-chooser-row.master-column-chooser-dragging {
    opacity: 0.45;
}

.master-column-chooser-grip {
    color: #64748b;
    font-size: 0.72rem;
    letter-spacing: -0.08em;
    line-height: 1;
    flex-shrink: 0;
}

.master-column-chooser-check {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.master-column-chooser-label {
    flex: 1;
    min-width: 0;
    font-size: 0.86rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#master-column-chooser-list::-webkit-scrollbar {
    width: 8px;
}

#master-column-chooser-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.master-table td.col-account-name {
    cursor: pointer;
    transition: background 0.2s;
}

.master-table td.col-account-name:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    text-decoration: underline;
}

.master-link-status {
    margin-left: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
}

#master-accounts-tab .card-header {
    align-items: stretch;
}

#master-accounts-tab .card-header > .card-header-column {
    justify-content: space-between;
}

#master-accounts-tab .card-header-right {
    align-items: stretch;
    flex: 0 1 640px;
}

#master-accounts-tab .card-header-right .card-header-column {
    width: 100%;
    justify-content: space-between;
    align-items: flex-end;
}

#master-accounts-tab .master-search-wrapper {
    order: 1;
    position: relative;
    align-self: flex-end;
    width: 100%;
    max-width: 360px;
}

#master-accounts-tab .master-search-wrapper:has(.search-input-pill:not(:placeholder-shown)) .search-clear-btn {
    display: block;
}

#master-accounts-tab .checkbox-group-padding {
    order: 2;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 0.65rem 0.85rem;
    flex-wrap: wrap;
}

#master-accounts-tab .master-status-filters {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 1;
    gap: 0.65rem 0.85rem;
}

#master-accounts-tab .master-account-filters-row .checkbox-label {
    flex-shrink: 0;
    white-space: nowrap;
}

#master-accounts-tab .master-account-filters-row .checkbox-label span {
    white-space: nowrap;
}

#master-accounts-tab .master-type-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-right: auto;
    flex-shrink: 1;
    min-width: 0;
}

#master-accounts-tab .master-type-filter-select {
    min-width: 118px;
    max-width: 168px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.master-table tr.master-link-mode-row {
    cursor: pointer;
}

.master-table tr.master-link-mode-row:hover td {
    background: rgba(59, 130, 246, 0.12) !important;
}

.master-table tr.master-row-selected td {
    background: rgba(34, 197, 94, 0.16) !important;
    color: var(--text-primary);
}

.master-select-marker {
    display: inline-block;
    min-width: 48px;
    margin-right: 0.45rem;
    padding: 0.12rem 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
    vertical-align: middle;
}

.master-row-selected .master-select-marker {
    border-color: rgba(34, 197, 94, 0.65);
    color: #86efac;
}

.master-table td.col-source {
    width: 1%;
    max-width: none;
    min-width: 0;
    overflow: visible;
    white-space: nowrap;
}

.master-source-cell-content {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    vertical-align: middle;
    white-space: nowrap;
}

.master-source-label {
    display: inline-block;
    max-width: 135px;
    flex: 0 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.master-source-link {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 145px;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    color: #93c5fd;
    font: inherit;
    font-weight: 800;
    text-align: left;
    text-decoration: none;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
    cursor: pointer;
}

.master-source-link:hover {
    color: #bfdbfe;
    text-decoration: none;
}

.master-link-inline {
    margin-left: 0.45rem;
    vertical-align: middle;
}

.master-linked-pills {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex: 0 0 auto;
    margin-left: 0.1rem;
    min-width: 0;
    overflow: visible;
    vertical-align: middle;
}

.master-linked-pill {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    max-width: 130px;
    padding: 0.12rem 0.42rem;
    border: 1px solid rgba(147, 197, 253, 0.35);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.master-linked-pill:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(147, 197, 253, 0.65);
    color: #ffffff;
}

.master-source-icon-img {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}

.master-source-icon-emoji {
    display: block;
    font-size: 1rem;
    line-height: 1;
}

.loan-forecast-layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.loan-forecast-form,
.loan-forecast-results {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
    padding: 1rem;
}

.loan-forecast-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.loan-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.35rem;
}

.loan-field label {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.loan-field-label-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.loan-field-label-row .field-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 800;
    cursor: help;
    text-transform: none;
    font-style: normal;
    line-height: 1;
    flex-shrink: 0;
}

.loan-field-with-hint {
    gap: 0.2rem;
}

.loan-field-hint {
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.35;
    margin: -0.1rem 0 0.15rem;
    text-transform: none;
    letter-spacing: 0;
}

.loan-field input,
.loan-field textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    padding: 0.65rem 0.75rem;
}

.loan-field.loan-field-required input,
.loan-field.loan-field-required textarea {
    border-color: #eab308;
    box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.45);
}

.loan-field textarea {
    resize: vertical;
}

.loan-field-wide,
.loan-form-actions {
    grid-column: 1 / -1;
}

.loan-form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.loan-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.loan-summary-cards > div {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
}

.loan-summary-cards span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.loan-summary-cards strong {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.loan-summary-cards .loan-summary-warning {
    grid-column: 1 / -1;
    border-color: rgba(245, 158, 11, 0.45);
    color: #fbbf24;
}

.loan-amortization-table {
    max-height: 560px;
    overflow: auto;
}

.loan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.loan-table th,
.loan-table td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    padding: 0.55rem 0.65rem;
    text-align: right;
    white-space: nowrap;
}

.loan-table th:first-child,
.loan-table td:first-child,
.loan-table th:nth-child(2),
.loan-table td:nth-child(2) {
    text-align: left;
}

.loan-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgb(15, 23, 42);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

@media (max-width: 980px) {
    .loan-forecast-layout {
        grid-template-columns: 1fr;
    }

    .loan-summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.loan-recap-table-wrap {
    overflow: auto;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.35);
}

.loan-recap-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin: 0 0 0.75rem;
}

.loan-recap-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.loan-recap-filter input {
    accent-color: var(--accent);
}

.loan-recap-empty {
    margin: 0;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loan-recap-table {
    width: max-content;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.loan-recap-col-w-action {
    width: 2.25rem;
}

.loan-recap-col-w-name {
    width: min(22rem, 38vw);
}

.loan-recap-col-w-num {
    width: 7.25rem;
}

.loan-recap-col-w-num-sm {
    width: 5.5rem;
}

.loan-recap-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.45rem 0.55rem;
    background: rgb(15, 23, 42);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.64rem;
    line-height: 1.25;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    white-space: nowrap;
}

.loan-recap-table tbody td {
    padding: 0.48rem 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.loan-recap-col-action,
.loan-recap-th-action {
    text-align: center;
    width: 2.25rem;
}

.loan-recap-master-account-btn {
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    width: 1.6rem;
    height: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 7px;
    cursor: pointer;
    line-height: 1;
}

.loan-recap-master-account-btn:hover {
    background: rgba(250, 204, 21, 0.14);
}

.loan-recap-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.loan-recap-row:hover {
    background: rgba(99, 102, 241, 0.08);
}

.loan-recap-col-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loan-recap-col-balance,
.loan-recap-col-payments,
.loan-recap-col-years,
.loan-recap-col-interest {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.loan-recap-col-apr {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.loan-recap-col-interest {
    color: #fca5a5;
    font-weight: 600;
}

.loan-recap-th-name {
    text-align: left;
}

.loan-recap-th-sort {
    cursor: pointer;
    user-select: none;
}

.loan-recap-th-sort:hover {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.08);
}

.loan-recap-th-balance,
.loan-recap-th-apr,
.loan-recap-th-payments,
.loan-recap-th-years,
.loan-recap-th-interest {
    text-align: right;
}

.loan-recap-table tfoot td {
    padding: 0.55rem 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.92);
    vertical-align: middle;
}

.loan-recap-total-row .loan-recap-col-name {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.loan-recap-total-row .loan-recap-col-balance,
.loan-recap-total-row .loan-recap-col-interest {
    font-weight: 700;
    color: var(--text-primary);
}

.loan-recap-total-row .loan-recap-col-interest {
    color: #fca5a5;
}

.master-linked-pill.master-linked-pill-icon,
.master-source-link.master-source-link-icon {
    width: 28px;
    height: 24px;
    max-width: 28px;
    padding: 0.12rem 0.28rem;
    justify-content: center;
}

.master-table .btn-secondary-small.master-link-inline {
    padding: 0.18rem 0.45rem;
    font-size: 0.7rem;
    line-height: 1.1;
}

/* Modal Form Grid */
#account-details-modal .modal-content.modal-wide {
    width: min(1180px, calc(100vw - 32px)) !important;
    max-width: min(1180px, calc(100vw - 32px)) !important;
}

#account-edit-fields.modal-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-top: 0.35rem;
}

#account-details-modal .modal-content.modal-wide {
    max-height: calc(100vh - 72px);
    overflow: auto;
}

#account-details-modal .modal-footer-actions {
    margin-top: 0.9rem;
}

#account-details-modal #edit-account-submit-btn {
    display: none !important;
}

#account-details-modal #btn-save-account-layout {
    display: none;
}

#account-merge-modal .account-merge-modal {
    width: min(920px, calc(100vw - 32px)) !important;
    max-width: min(920px, calc(100vw - 32px)) !important;
}

#account-merge-modal .account-merge-body {
    max-height: min(62vh, 640px);
    overflow: auto;
    margin-top: 0.5rem;
}

#account-merge-modal .account-merge-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

#account-merge-modal .account-merge-table th,
#account-merge-modal .account-merge-table td {
    padding: 0.45rem 0.55rem;
    vertical-align: top;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

#account-merge-modal .account-merge-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0f172a;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
}

#account-merge-modal .account-merge-field-label {
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    width: 130px;
}

#account-merge-modal .account-merge-pick {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    min-height: 2rem;
    word-break: break-word;
}

#account-merge-modal .account-merge-pick:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.08);
}

#account-merge-modal .account-merge-pick.is-winner {
    border-color: rgba(99, 102, 241, 0.65);
    background: rgba(99, 102, 241, 0.18);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.25);
}

#account-merge-modal .account-merge-pick.is-empty {
    color: var(--text-secondary);
    font-style: italic;
}

#account-merge-modal .account-merge-footer {
    margin-top: 0.85rem;
}

#account-edit-fields .account-summary-shell {
    position: relative;
    margin-bottom: 0.75rem;
    overflow: visible;
}

#account-edit-fields .account-source-summary {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem 1.25rem;
    padding: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.45);
}

#account-edit-fields .account-summary-status-block {
    min-width: 0;
}

#account-edit-fields .account-summary-header-right {
    margin-left: auto;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-shrink: 0;
}

#account-edit-fields .account-summary-source-block {
    min-width: 0;
    align-self: flex-start;
}

#account-edit-fields .account-source-summary div {
    min-width: 0;
}

#account-edit-fields .account-source-summary span,
#account-edit-fields .account-edit-section h4 {
    display: block;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#account-edit-fields .account-source-summary strong,
#account-edit-fields .account-source-summary a {
    margin-top: 0.25rem;
    color: var(--text-primary);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#account-edit-fields .account-source-value {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

#account-edit-fields .account-source-value-compact {
    gap: 0.2rem;
}

#account-edit-fields .account-source-emoji-wrap {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

#account-edit-fields .account-source-emoji-wrap .master-source-icon-img {
    width: 18px;
    height: 18px;
}

#account-edit-fields .account-type-subscription-link {
    border: none;
    padding: 0;
    margin-top: 0;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

#account-edit-fields .account-type-subscription-link:hover {
    color: #93c5fd;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 0.15em;
}

#account-edit-fields .account-source-emoji-badge {
    font-size: 1.05rem;
    line-height: 1;
}

.master-source-empty {
    color: var(--text-secondary);
}

#account-edit-fields .account-source-summary a {
    color: #93c5fd;
}

#account-edit-fields .account-summary-close {
    position: absolute;
    top: -0.55rem;
    right: -0.55rem;
    z-index: 5;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#account-edit-fields .account-summary-dupe {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

#account-edit-fields .account-source-arrow {
    display: inline-flex;
    margin-top: 0;
    margin-left: 0;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(147, 197, 253, 0.34);
    border-radius: 5px;
    background: rgba(59, 130, 246, 0.1);
    font-size: 0.72rem;
    text-decoration: none;
    vertical-align: middle;
}

#account-edit-fields .account-source-summary-wide {
    grid-column: 1 / -1;
}

#account-edit-fields .account-edit-section {
    padding: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

#account-edit-fields .account-summary-name-block {
    min-width: 0;
}

#account-edit-fields .account-summary-name-display {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    min-width: 0;
}

#account-edit-fields .account-summary-name-display strong {
    margin-top: 0;
    font-size: 0.88rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#account-edit-fields .account-summary-name-pencil {
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 6px;
    color: #a5b4fc;
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    padding: 3px 7px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#account-edit-fields .account-summary-name-pencil:hover,
#account-edit-fields .account-summary-name-pencil.is-active {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.45);
    color: #e0e7ff;
}

#account-edit-fields .account-summary-local-edit {
    margin-top: 0.35rem;
}

#account-edit-fields .account-summary-local-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
}

#account-edit-fields .account-summary-local-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

#account-edit-fields #account-field-local-name-input {
    width: 400px !important;
    max-width: 100%;
}

#account-edit-fields .account-summary-local-select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.32);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
}

#account-edit-fields .account-summary-local-select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

#account-edit-fields .account-summary-type-edit-row {
    grid-template-columns: minmax(140px, 220px) 34px;
    gap: 0.35rem;
}

#account-edit-fields .account-summary-canonical-name {
    margin-top: 0.2rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#account-edit-fields .account-summary-canonical-name::before {
    content: 'Monarch: ';
    opacity: 0.75;
}

#account-edit-fields .account-summary-canonical-sub {
    margin-top: 0.2rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#account-edit-fields .account-summary-canonical-sub::before {
    content: attr(data-prefix);
    opacity: 0.75;
}

#account-edit-fields .account-summary-override-block {
    min-width: 0;
    align-self: flex-start;
}

#account-edit-fields .account-identity-schedule-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.account-payment-history-pills {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.1rem;
}

.account-payment-history-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.22rem;
}

.account-payment-history-controls label {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.account-payment-history-select {
    width: min(15rem, 100%);
    min-width: 0;
    height: 24px;
    padding: 0.08rem 0.36rem;
    border: 1px solid rgba(99, 102, 241, 0.32);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.2;
    outline: none;
}

.account-payment-history-select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.account-payment-history-rows {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.account-payment-history-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    box-sizing: border-box;
    min-height: 24px;
    padding: 0.18rem 0.42rem;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.28);
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    font-size: 0.74rem;
    line-height: 1.25;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, border-color 0.12s;
}

.account-payment-history-pill:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.45);
}

.account-payment-history-pill .aph-date {
    flex-shrink: 0;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.68rem;
    min-width: 4.5rem;
}

.account-payment-history-pill .aph-amount {
    flex-shrink: 0;
    font-weight: 700;
    min-width: 4.25rem;
    text-align: right;
}

.account-payment-history-pill .aph-amount.expense {
    color: #f87171;
}

.account-payment-history-pill .aph-amount.success {
    color: #34d399;
}

.account-payment-history-pill .aph-amount.upcoming {
    color: #fbbf24;
}

.account-payment-history-pill.upcoming {
    border-style: dashed;
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.08);
    cursor: default;
}

.account-payment-history-pill.upcoming:hover {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.55);
}

.account-payment-history-pill .aph-upcoming-tag {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fbbf24;
    margin-right: 0.35rem;
}

.account-payment-history-pill .aph-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #c7d2fe;
    font-size: 0.72rem;
}

.account-payment-history-empty {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

#account-edit-fields .account-identity-schedule-row .account-edit-section {
    min-width: 0;
}

#account-edit-fields .account-edit-section h4 {
    margin: 0 0 0.55rem;
}

#account-edit-fields .account-edit-section h4:empty {
    display: none;
}

#account-edit-fields .account-edit-section-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.75rem;
    align-items: end;
}

#account-edit-fields .account-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.75rem;
    width: 100%;
    align-items: end;
}

#account-edit-fields .account-info-card-row {
    column-gap: 0.75rem;
}

#account-edit-fields .account-info-row .account-field {
    min-width: 0;
}

#account-edit-fields .account-info-row .account-field label {
    white-space: nowrap;
    overflow: visible;
}

#account-edit-fields .account-info-row .account-field-wide {
    width: auto;
}

#account-edit-fields .account-info-row .account-field-card-number {
    width: 200px;
}

#account-edit-fields .account-info-row .account-field-card-number input {
    width: 200px;
}

#account-edit-fields .account-info-row .account-field-exp-date,
#account-edit-fields .account-info-row .account-field-ccv {
    width: 60px;
}

#account-edit-fields .account-info-row .account-field-exp-date input,
#account-edit-fields .account-info-row .account-field-ccv input {
    width: 60px;
}

#account-edit-fields .account-info-row .account-field-card-label,
#account-edit-fields .account-info-row .account-field-card-label input {
    width: 95px;
}

#account-edit-fields .account-info-top-row .account-type-field {
    width: 306px;
}

#account-edit-fields .account-info-top-row #account-field-limit-amount {
    margin-left: 38px;
    width: 140px !important;
}

#account-edit-fields .account-info-utility-row #account-field-balance-override {
    margin-left: 0;
}

#account-edit-fields .account-info-autopay-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    align-items: flex-end;
    margin-top: 0.35rem;
}
#account-edit-fields .account-field-checkbox {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 7rem;
}
#account-edit-fields .account-field-checkbox span {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
#account-edit-fields .account-field-checkbox input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
}
#account-edit-fields .account-info-meta-row #account-field-due-day,
#account-edit-fields .account-info-meta-row #account-field-apr {
    width: 90px;
}

#account-edit-fields .account-info-meta-row #account-field-due-day {
    width: 45px !important;
}

#account-edit-fields .account-info-meta-row #account-field-account {
    width: 200px;
}

#account-edit-fields .account-info-meta-row #account-field-account input {
    width: 200px;
}

#account-edit-fields .account-info-top-row #account-field-limit-amount input,
#account-edit-fields .account-info-meta-row #account-field-due-day input,
#account-edit-fields .account-info-meta-row #account-field-apr input {
    width: 90px;
}

#account-edit-fields .account-info-meta-row #account-field-due-day input {
    width: 45px !important;
    max-width: 45px !important;
}

#account-edit-fields .account-info-top-row #account-field-limit-amount input {
    width: 140px !important;
    max-width: 140px !important;
}

input#account-field-limit-amount-input {
    width: 140px !important;
}

#account-edit-fields .account-info-meta-row #account-field-apr {
    width: 67px !important;
}

#account-edit-fields .account-info-meta-row #account-field-apr input {
    width: 67px !important;
    max-width: 67px !important;
}

#account-edit-fields .account-info-top-row #account-field-status {
    width: 120px;
}

#account-edit-fields .account-info-top-row #account-field-status select {
    width: 120px;
}

#account-edit-fields .account-info-row .account-field-money-amount input {
    text-align: left;
}

#account-edit-fields .account-info-row .account-field-percent input {
    text-align: left;
}

#account-edit-fields #account-field-card-number-2 {
    margin-left: 105px;
}

#account-edit-fields #account-field-payment-email-sender,
#account-edit-fields #account-field-payment-address,
#account-edit-fields .account-info-email-row .account-field {
    flex: 1 1 calc(50% - 0.375rem);
    min-width: 0;
}

#account-edit-fields .account-info-email-row .account-field input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#account-edit-fields .account-info-email-row {
    flex-wrap: nowrap;
}

#account-edit-fields .account-contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.75rem;
    width: 100%;
    align-items: end;
}

#account-edit-fields .account-contact-row #account-field-phone {
    flex: 0 0 150px;
}

#account-edit-fields .account-contact-row #account-field-email,
#account-edit-fields .account-contact-row #account-field-website {
    flex: 1 1 0;
    min-width: 220px;
}

#account-edit-fields .account-contact-row #account-field-email input,
#account-edit-fields .account-contact-row #account-field-website input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Identity section: emoji narrow + local name fills rest + checkbox */
#account-edit-fields .account-edit-section:first-of-type .account-edit-section-grid {
    grid-template-columns: unset;
    align-items: end;
}

/* Account & Payment: 3 equal columns */
#account-edit-fields .account-edit-section:nth-of-type(2) .account-edit-section-grid {
    grid-template-columns: unset;
}

/* Explicit widths for specific fields */
#account-edit-fields .account-field-narrow input {
    width: 45px !important;
    text-align: center;
    font-size: 1.2rem;
    padding: 0.3rem 0.25rem;
}

#account-edit-fields .account-field-local-name input {
    width: 350px !important;
    max-width: 100%;
}

.monarch-tx-name-suggestions {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(99, 102, 241, 0.34);
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
    margin-top: -0.35rem;
    padding: 0.25rem;
    z-index: 3;
}

.monarch-tx-name-suggestions[hidden] {
    display: none;
}

.monarch-tx-name-suggestion {
    width: 100%;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    padding: 0.45rem 0.55rem;
    text-align: left;
}

.monarch-tx-name-suggestion:hover,
.monarch-tx-name-suggestion.is-active {
    background: rgba(99, 102, 241, 0.22);
    color: #e0e7ff;
}

.monarch-tx-name-suggestion-empty {
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 0.45rem 0.55rem;
}

.monarch-tx-linked-chip {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.monarch-tx-linked-chip > .btn-secondary-small {
    padding-right: 1rem;
}

.monarch-tx-unlink-btn {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(248, 113, 113, 0.72);
    border-radius: 999px;
    background: #7f1d1d;
    color: #fecaca;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    padding: 0;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.95);
}

.monarch-tx-unlink-btn:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(248, 113, 113, 0.6);
    color: #fff;
}

.monarch-unlink-choice {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    color: var(--text-secondary);
}

.monarch-unlink-choice p {
    margin: 0 0 0.2rem;
}

.monarch-unlink-choice label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(99, 102, 241, 0.24);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
}

.monarch-unlink-choice input {
    margin-top: 0.18rem;
    accent-color: #818cf8;
}

.monarch-unlink-choice strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.88rem;
}

.monarch-unlink-choice small {
    display: block;
    margin-top: 0.16rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.monarch-unlink-keywords {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.55rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(99, 102, 241, 0.34);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.84rem;
}

.monarch-unlink-keywords:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
    outline: none;
}

#account-edit-fields .account-field-date input {
    width: 80px !important;
}

#account-edit-fields .account-info-row .account-field-exp-date,
#account-edit-fields .account-info-row .account-field-ccv {
    flex: 0 0 60px;
    width: 60px !important;
}

#account-edit-fields .account-info-row .account-field-exp-date input,
#account-edit-fields .account-info-row .account-field-ccv input {
    width: 60px !important;
    max-width: 60px !important;
}

#account-edit-fields .account-info-row .account-field-card-label {
    flex: 0 0 95px;
    width: 95px !important;
}

#account-edit-fields .account-info-row .account-field-card-label input {
    width: 95px !important;
    max-width: 95px !important;
}

#account-edit-fields .account-field {
    min-width: 0;
    flex-shrink: 0;
}

#account-edit-fields .account-field-wide {
    grid-column: span 2;
}

#account-edit-fields .account-field-wide3 {
    grid-column: span 3;
}

#account-edit-fields .account-field-narrow {
    grid-column: span 1;
}

#account-edit-fields .account-field-narrow input {
    text-align: center;
    font-size: 1.2rem;
    padding: 0.3rem 0.25rem;
}

#account-edit-fields .account-field-card-icon {
    width: 132px;
}

#account-edit-fields .account-field-card-icon select {
    width: 132px;
    padding: 0.3rem 0.45rem;
}

#account-edit-fields .account-field label {
    margin-bottom: 0.22rem;
}

#account-edit-fields .account-field-visual-label::before {
    content: attr(data-caption);
}

#account-edit-fields .account-check-field {
    align-self: end;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-primary);
    font-size: 0.78rem;
}

#account-edit-fields .account-check-field span {
    min-width: 0;
}

#account-edit-fields .account-edit-column {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    min-height: 3.2rem;
    border-radius: 8px;
}

#account-edit-fields .account-edit-column.drag-over {
    position: relative;
}

#account-edit-fields .account-edit-column.drop-at-end::after {
    content: "";
    display: block;
    height: 3px;
    margin-top: 0.25rem;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

#account-edit-fields .form-group {
    position: relative;
    min-width: 0;
    margin-bottom: 0;
    padding: 0.45rem 0.55rem;
    display: grid;
    grid-template-columns: minmax(118px, 34%) minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    cursor: grab;
}

#account-edit-fields .form-group.dragging {
    opacity: 0.45;
}

#account-edit-fields .form-group.drop-before::before,
#account-edit-fields .form-group.drop-after::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    pointer-events: none;
}

#account-edit-fields .form-group.drop-before::before {
    top: -0.34rem;
}

#account-edit-fields .form-group.drop-after::after {
    bottom: -0.34rem;
}

#account-edit-fields .form-group:active {
    cursor: grabbing;
}

#account-edit-fields .account-field-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

#account-edit-fields .account-readonly-marker {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

#account-edit-fields label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0;
    letter-spacing: 0.5px;
    font-weight: 600;
    min-width: 0;
}

#account-edit-fields input:not([type="checkbox"]),
#account-edit-fields select,
#account-edit-fields textarea {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}

#account-edit-fields textarea {
    resize: vertical;
    min-height: 54px;
}

#account-edit-fields input:not([type="checkbox"]):focus,
#account-edit-fields select:focus,
#account-edit-fields textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

#account-edit-fields select option {
    background: #111827;
    color: white;
}

#account-edit-fields .account-type-inline-row {
    display: grid;
    grid-template-columns: minmax(170px, 260px) 34px;
    gap: 0.4rem;
    align-items: center;
}

#account-edit-fields .account-type-add-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
}

#account-edit-fields .account-type-add-btn:hover {
    background: rgba(59, 130, 246, 0.24);
    border-color: rgba(59, 130, 246, 0.7);
}

#account-edit-fields .account-login-inline-row {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    width: 100%;
}

#account-edit-fields .account-login-inline-row .account-field {
    min-width: 0;
}

#account-edit-fields .account-login-inline-row #account-field-login-username {
    width: 150px;
}

#account-edit-fields .account-login-inline-row #account-field-login-username input {
    width: 150px;
}

#account-edit-fields .account-login-inline-row #account-field-login-url {
    width: 82px;
}

#account-edit-fields .account-login-link-row {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 34px;
}

#account-edit-fields .account-login-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #93c5fd;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

#account-edit-fields .account-login-link.is-empty {
    color: var(--text-secondary);
}

#account-edit-fields .account-login-link.is-disabled {
    cursor: default;
    pointer-events: none;
    text-decoration: none;
}

#account-edit-fields .account-login-edit-btn {
    width: 24px;
    height: 24px;
    border: 1px solid rgba(147, 197, 253, 0.34);
    border-radius: 5px;
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
    cursor: pointer;
    line-height: 1;
}

#account-edit-fields .account-field-login-notes {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 780px;
}

#account-edit-fields .account-field-login-notes label {
    margin-bottom: 0.22rem;
}

#account-edit-fields .account-field-login-notes textarea {
    width: 780px;
    max-width: 780px;
    min-height: 34px;
    height: 34px;
    resize: none;
    overflow: hidden;
}

#account-edit-fields #account-field-notes-input {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    overflow: auto;
    field-sizing: fixed;
}

#account-edit-fields #account-field-phone,
#account-edit-fields #account-field-phone input {
    width: 150px;
}

#account-edit-fields .form-link-row {
    display: block;
    padding: 8px 10px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.08);
    color: #93c5fd;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    #account-edit-fields .account-source-summary {
        flex-direction: column;
        align-items: stretch;
    }

    #account-edit-fields .account-summary-header-right {
        margin-left: 0;
        justify-content: flex-end;
    }

    #account-edit-fields .account-edit-section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #account-edit-fields .account-identity-schedule-row {
        grid-template-columns: 1fr;
    }

    #account-edit-fields .account-field-wide {
        grid-column: 1 / -1;
    }

    #account-edit-fields .account-type-inline-row {
        grid-template-columns: 1fr;
    }

    #account-edit-fields .account-info-email-row {
        flex-wrap: wrap;
    }

    #account-edit-fields .account-info-email-row .account-field {
        flex: 1 1 100%;
    }
}

.master-table th:first-child {
    z-index: 1001;
    /* Above both row and column stickiness */
}

.master-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.02);
}

.master-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

/* â”€â”€ Master Accounts Column Drag-to-Rearrange â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.master-th-draggable {
    cursor: grab;
    position: relative;
    padding-left: 18px !important;
}
.master-th-draggable::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 12px;
    opacity: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1.6px);
    background-size: 4px 4px;
    pointer-events: none;
    transition: opacity 0.15s;
}
.master-th-draggable:hover::before {
    opacity: 1;
}
.master-th-draggable:active {
    cursor: grabbing;
}
.master-th-dragging {
    opacity: 0.4;
}
.master-th-drag-over {
    border-left: 2px solid #6366f1 !important;
    box-shadow: inset 4px 0 8px rgba(99, 102, 241, 0.25);
}
/* â”€â”€ Save Columns Button â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.btn-save-columns {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.75rem !important;
    background: linear-gradient(180deg, #6366f1, #4f46e5) !important;
    border-color: rgba(165,180,252,0.3) !important;
    color: #fff !important;
    animation: save-columns-pulse 2s ease-in-out infinite;
}
@keyframes save-columns-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

#master-accounts-tab #master-accounts-scroll::-webkit-scrollbar {
    height: 12px;
    width: 8px;
}

#master-accounts-tab #master-accounts-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

#master-accounts-tab #master-accounts-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Manual Account Management */
.manual-account-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.manual-account-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
}

.manual-acc-info {
    flex: 1;
}

.manual-acc-header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}


.manual-acc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.5rem;
}

.manual-acc-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.manual-acc-type {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    font-weight: 700;
    text-transform: uppercase;
}

.manual-acc-balance {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    margin: 0.25rem 0;
}

.manual-acc-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 500px;
}

.manual-acc-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

#manual-notes {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

#manual-notes:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Manual bill entry styles */
.btn-action-small {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
    transition: all 0.2s ease;
}

.btn-action-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* Tighten spacing in license details modal */
#license-details-modal .form-group {
    margin-bottom: 0.6rem;
}
#license-details-modal .form-group label {
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
}
#license-details-modal .field-label-with-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: fit-content;
}
#license-details-modal .field-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #bfdbfe;
    font-size: 0.62rem;
    line-height: 1;
    cursor: help;
    text-transform: none;
}
#license-details-modal .form-group input,
#license-details-modal .form-group select,
#license-details-modal .form-group textarea {
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
}
#license-details-modal .form-row {
    gap: 0.5rem;
}
#license-details-modal textarea {
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
}
#license-details-modal .modal-content {
    max-width: 1280px;
    width: min(1280px, calc(100vw - 32px));
}
#license-details-modal {
    z-index: 1010;
}

#monarch-tx-modal.modal-front {
    z-index: 1040;
}

#license-details-modal .margin-bottom-10 {
    margin-bottom: 0.4rem;
}
#license-details-modal .btn-save-full {
    padding: 0.5rem;
    font-size: 0.82rem;
}
#license-details-modal .modal-header {
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
}
#license-details-modal .modal-header h3 {
    font-size: 1rem;
}

#license-details-modal .license-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

#license-details-modal .license-details-column {
    min-width: 0;
}

#license-details-modal .license-lifetime-row {
    justify-content: flex-start;
    margin: 0.15rem 0 0.45rem;
}

#license-details-modal .license-lifetime-checkbox {
    align-items: center;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
}

#license-details-modal .license-linked-transactions-column {
    min-width: 320px;
}

#license-details-modal .license-member-profile-panel {
    padding: 0.55rem;
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-radius: 8px;
    background: rgba(30, 64, 175, 0.12);
}

#license-details-modal .license-member-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 0.5rem;
    margin-top: 0.35rem;
}

#license-details-modal .license-member-profile-grid .form-group {
    margin-bottom: 0;
}

#license-details-modal .license-periods-panel {
    padding: 0.55rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    background: rgba(49, 46, 129, 0.13);
}

#license-details-modal .license-periods-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.45rem;
}

#license-details-modal .license-periods-header > label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a5b4fc;
    margin: 0;
}

#license-details-modal .license-periods-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

#license-details-modal .license-periods-tabs-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(165, 180, 252, 0.15);
    padding-bottom: 8px;
    flex-wrap: wrap;
    align-items: center;
}

#license-details-modal .license-period-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(165, 180, 252, 0.2);
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#license-details-modal .license-period-tab:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
}

#license-details-modal .license-period-tab.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-color: #6366f1;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

#license-details-modal .license-period-tab-add {
    background: transparent;
    border: 1px dashed rgba(165, 180, 252, 0.4);
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 3px 9px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

#license-details-modal .license-period-tab-add:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #a5b4fc;
    color: #fff;
}


#license-details-modal .license-period-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(165, 180, 252, 0.2);
    border-radius: 7px;
    padding: 0.6rem 0.65rem 0.5rem;
    position: relative;
}

#license-details-modal .license-period-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

#license-details-modal .license-period-label-input {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(165, 180, 252, 0.3);
    color: #c7d2fe;
    padding: 0.15rem 0.2rem;
    min-width: 0;
}

#license-details-modal .license-period-label-input::placeholder {
    color: rgba(165, 180, 252, 0.45);
    font-weight: 400;
}

#license-details-modal .license-period-label-input:focus {
    outline: none;
    border-bottom-color: #818cf8;
}

#license-details-modal .license-period-delete-btn {
    background: none;
    border: none;
    color: rgba(248, 113, 113, 0.6);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    flex-shrink: 0;
}

#license-details-modal .license-period-delete-btn:hover {
    color: #f87171;
}

#license-details-modal .license-period-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.6rem;
}

#license-details-modal .license-period-fields .form-group {
    margin-bottom: 0;
}

#license-details-modal .license-period-fields label {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
    display: block;
}

#license-details-modal .license-period-fields input[type="date"],
#license-details-modal .license-period-fields input[type="text"],
#license-details-modal .license-period-fields input[type="email"] {
    font-size: 0.77rem;
    padding: 0.25rem 0.4rem;
    width: 100%;
    box-sizing: border-box;
}

#license-details-modal .license-period-notes {
    margin-top: 0.4rem;
}

#license-details-modal .license-period-notes label {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
    display: block;
}

#license-details-modal .license-period-notes textarea {
    font-size: 0.77rem;
    padding: 0.25rem 0.4rem;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 46px;
}

#license-details-modal .license-periods-empty {
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
    padding: 0.25rem 0;
}

#license-details-modal .license-reminder-panel {
    padding: 0.65rem;
    border: 1px solid rgba(251, 191, 36, 0.42);
    border-radius: 10px 18px 12px 10px;
    background: linear-gradient(160deg, rgba(254, 240, 138, 0.17), rgba(180, 83, 9, 0.12));
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.12);
}

#license-details-modal .license-reminder-panel > label {
    color: #fde68a;
}

#license-details-modal .license-reminder-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.35rem;
}

#license-details-modal #edit-lic-reminder-at {
    height: 24px;
    width: min(200px, 100%);
}

#license-details-modal #edit-lic-reminder-note {
    width: 100%;
    min-height: 58px;
    resize: vertical;
}

#license-details-modal .license-reminders-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.55rem;
    max-height: 170px;
    overflow: auto;
}

#license-details-modal .license-reminder-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: start;
    padding: 0.45rem 0.5rem;
    border: 1px solid rgba(251, 191, 36, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
    cursor: pointer;
}

#license-details-modal .license-reminder-row:hover {
    border-color: rgba(251, 191, 36, 0.38);
    background: rgba(15, 23, 42, 0.58);
}

#license-details-modal .license-reminder-row.is-due {
    border-color: rgba(251, 191, 36, 0.9);
    background: linear-gradient(160deg, #fef08a, #facc15);
    color: #1f2937;
    box-shadow: 0 8px 18px rgba(250, 204, 21, 0.24);
    animation: reminderRowHeartbeat 1.8s ease-in-out infinite;
}

#license-details-modal .license-reminder-row.is-due:hover {
    background: linear-gradient(160deg, #fef3c7, #fde047);
}

#license-details-modal .license-reminder-row.is-due .license-reminder-date,
#license-details-modal .license-reminder-row.is-due .license-reminder-note {
    color: #1f2937;
}

#license-details-modal .license-reminder-row.is-due .license-reminder-delete {
    color: #991b1b;
}

#license-details-modal .license-reminder-row.is-completed {
    opacity: 0.58;
}

#license-details-modal .license-reminder-row.is-completed .license-reminder-note {
    text-decoration: line-through;
}

#license-details-modal .license-reminder-check {
    margin-top: 0.2rem;
    accent-color: #fbbf24;
}

#license-details-modal .license-reminder-date {
    color: #fde68a;
    font-size: 0.7rem;
    font-weight: 800;
}

#license-details-modal .license-reminder-note {
    color: var(--text-primary);
    font-size: 0.8rem;
    line-height: 1.35;
    word-break: break-word;
}

#license-details-modal .license-reminder-delete {
    border: none;
    background: transparent;
    color: #fca5a5;
    cursor: pointer;
    font-weight: 900;
}

@media (max-width: 1180px) {
    #license-details-modal .license-reminder-form {
        align-items: stretch;
    }
}

#license-details-modal #edit-lic-notes {
    min-height: 76px;
    resize: vertical;
}

#license-details-modal .license-linked-transactions-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 360px;
    overflow: auto;
    padding: 0.25rem;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.35);
}

#license-details-modal .license-linked-transaction-row {
    display: grid;
    grid-template-columns: minmax(5.2rem, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    border: 0;
    padding: 0.32rem 0.45rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.035);
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    text-align: left;
}

#license-details-modal .license-linked-transaction-row:hover {
    background: rgba(59, 130, 246, 0.16);
}

#license-details-modal .license-linked-transaction-date {
    color: var(--text-secondary);
    white-space: nowrap;
}

#license-details-modal .license-linked-transaction-payment {
    color: #fecaca;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#license-details-modal .license-linked-transaction-amount {
    color: var(--text-primary);
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 1040px) {
    #license-details-modal .license-details-grid {
        grid-template-columns: 1fr;
    }

    #license-details-modal .modal-content {
        max-width: 520px;
    }
}

/* â”€â”€ Match Rules Pills & Popup â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#license-details-modal .match-rules-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

#license-details-modal .license-match-rules-panel {
    padding: 0.55rem;
    border: 1px solid rgba(132, 204, 22, 0.42);
    border-radius: 8px;
    background: rgba(63, 98, 18, 0.12);
}

#license-details-modal .license-match-rules-panel .match-rule-pill {
    max-width: 100%;
}

#license-details-modal .license-master-account-panel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.55rem;
    border: 1px solid rgba(248, 113, 113, 0.42);
    border-radius: 8px;
    background: rgba(127, 29, 29, 0.12);
}

#license-details-modal .license-linked-master-account-content {
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.35;
}

#license-details-modal .license-linked-master-account-content strong {
    color: var(--text-primary);
}

#license-details-modal .license-monarch-link-helper {
    padding: 0.65rem;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 10px;
    background: rgba(30, 64, 175, 0.14);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

#license-details-modal .license-monarch-link-helper strong {
    color: var(--text-primary);
}

#license-details-modal .license-monarch-link-helper-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.55rem;
    flex-wrap: wrap;
}

#license-details-modal .license-monarch-link-helper select {
    min-width: min(260px, 100%);
    flex: 1;
}

#license-details-modal .license-master-account-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(248, 113, 113, 0.18);
}

#license-details-modal .license-master-account-row-main {
    flex: 1;
    min-width: 0;
}

#license-details-modal .license-master-account-name {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(248, 113, 113, 0.35);
}

#license-details-modal .license-master-account-meta {
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: 0.15rem;
}

#license-details-modal .license-master-account-payment-name {
    color: #fecaca;
    font-size: 0.74rem;
    font-weight: 700;
    margin-top: 0.12rem;
}

#license-details-modal .license-master-account-linked {
    color: #34d399;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

#license-details-modal .license-master-account-select {
    width: 100%;
    margin-top: 0.45rem;
}

#license-details-modal .license-master-account-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

#license-details-modal .license-url-link-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 34px;
}

#license-details-modal .license-url-display-wrap {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

#license-details-modal .license-url-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    color: #93c5fd;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#license-details-modal .license-url-link.is-empty {
    color: var(--text-secondary);
    font-weight: 600;
}

#license-details-modal .license-url-link.is-disabled {
    cursor: default;
    pointer-events: none;
}

#license-details-modal .license-url-edit-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(147, 197, 253, 0.34);
    border-radius: 5px;
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
    cursor: pointer;
    line-height: 1;
}

.match-rules-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-height: 1.8rem;
}
.match-rule-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    white-space: nowrap;
}
.match-rule-pill .pill-remove {
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0.5;
    transition: opacity 0.1s;
    background: none;
    border: none;
    color: inherit;
    padding: 0;
    line-height: 1;
}
.match-rule-pill .pill-remove:hover {
    opacity: 1;
}
.match-rules-empty {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.5;
}
.match-rules-save-note {
    color: #a7f3d0;
    font-size: 0.72rem;
    line-height: 1.35;
    margin: 0;
}
.match-rules-save-note strong {
    color: #d1fae5;
}

/* Match Rules Popup */
#match-rules-popup {
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
}
#match-rules-popup.show {
    display: flex;
}
#match-rules-popup .modal-content {
    max-width: 860px;
    width: min(94vw, 860px);
    max-height: 88vh;
    overflow: auto;
    padding: 1.25rem;
}
#category-rules-popup {
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
}
#category-rules-popup.show {
    display: flex;
}
#category-rules-popup .modal-content {
    max-width: 480px;
    width: 92%;
    padding: 1.25rem;
}
.category-rule-entry {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.04);
}
.category-rule-entry .category-rule-row {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}
.category-rule-entry .category-rule-row label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    min-width: 4.5rem;
    flex-shrink: 0;
}
.category-rule-entry .category-rule-row input {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
    flex: 1;
    min-width: 0;
}
.category-rule-entry .category-rule-meta {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.72rem;
}
.category-rule-entry .category-rule-meta select,
.category-rule-entry .category-rule-meta input[type="number"] {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.3rem 0.4rem;
    font-size: 0.72rem;
}
.category-rule-entry .category-rule-meta input[type="number"] {
    width: 4.5rem;
}
.category-rule-entry .rule-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.3rem;
    opacity: 0.5;
}
.category-rule-entry .rule-remove:hover {
    opacity: 1;
    color: #ef4444;
}
.match-rule-entry {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
    padding: 0.55rem;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}
.match-rule-entry-fields {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}
.match-rule-entry select {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.35rem 0.4rem;
    font-size: 0.78rem;
    min-width: 110px;
}
.match-rule-entry .match-rule-account {
    min-width: 160px;
    max-width: 230px;
}
.match-rule-entry input {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
    flex: 1;
}
.match-rule-entry .match-rule-value {
    min-width: 160px;
}
.match-rule-entry .match-rule-amount-min,
.match-rule-entry .match-rule-amount-max {
    flex: 0 0 78px;
    min-width: 78px;
}
.match-rule-candidates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.35rem;
    max-height: 340px;
    overflow: auto;
    padding-top: 0.2rem;
}
.match-rule-mode {
    width: fit-content;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
}
.match-rule-mode.is-exact {
    color: #86efac;
    background: rgba(22, 163, 74, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.22);
}
.match-rule-mode.is-contains {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.22);
}
.match-rule-candidate {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-radius: 7px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: rgba(15, 23, 42, 0.58);
    color: var(--text-primary);
}
.match-rule-candidate.selected {
    border-color: rgba(96, 165, 250, 0.62);
    background: rgba(59, 130, 246, 0.16);
}
.match-rule-candidate-body {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}
.match-rule-candidate-label {
    color: #a5b4fc;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.match-rule-candidate-name {
    font-size: 0.78rem;
    font-weight: 800;
}
.match-rule-sample-account {
    color: #bfdbfe;
    font-size: 0.72rem;
    font-weight: 700;
}
.match-rule-candidate-meta,
.match-rule-candidates-empty {
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.match-rule-candidates-empty {
    padding: 0.3rem 0.1rem;
}
.match-rule-candidate-toolbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(52, 211, 153, 0.18);
    border-radius: 7px;
    background: rgba(6, 78, 59, 0.16);
}
.match-rule-candidate-toolbar div {
    display: flex;
    flex-direction: column;
    gap: 0.14rem;
    min-width: 0;
}
.match-rule-candidate-toolbar strong {
    color: #d1fae5;
    font-size: 0.78rem;
}
.match-rule-candidate-toolbar span {
    color: var(--text-secondary);
    font-size: 0.72rem;
}
.match-rule-set-criteria {
    flex-shrink: 0;
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.16);
    color: #a7f3d0;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.34rem 0.65rem;
}
.match-rule-set-criteria:hover {
    background: rgba(16, 185, 129, 0.26);
}
.match-rule-candidate-use {
    flex-shrink: 0;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.13);
    color: #bfdbfe;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.22rem 0.5rem;
}
.match-rule-candidate-use:hover {
    background: rgba(59, 130, 246, 0.24);
}
.match-rule-entry .rule-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.3rem;
    opacity: 0.5;
    transition: all 0.1s;
}
.match-rule-entry .rule-remove:hover {
    opacity: 1;
    color: #ef4444;
}
.match-rules-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.match-rules-actions .btn-sm {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: opacity 0.1s;
}
.match-rules-actions .btn-sm-add {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}
.match-rules-actions .btn-sm-add:hover {
    background: rgba(99, 102, 241, 0.3);
}
.match-rules-actions .btn-sm-save {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}
.match-rules-actions .btn-sm-save:hover {
    background: rgba(52, 211, 153, 0.3);
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-group input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}
/* Clickable Transaction Cards */
.clickable-card {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.clickable-card:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.edit-icon-hint {
    font-size: 0.8rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-left: 8px;
}

.clickable-card:hover .edit-icon-hint {
    opacity: 1;
}

/* Transaction Modal Refinements */
.modal-instruction {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: rgba(124, 58, 237, 0.1);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
}

/* Billing â€” overdue SMS draft modal (manual copy) */
#billing-note-modal .billing-note-modal,
#check-payment-modal .billing-note-modal {
    max-width: 520px;
}

#check-payment-batch-modal .billing-note-modal.check-payment-batch {
    width: min(980px, calc(100vw - 28px)) !important;
    max-width: min(980px, calc(100vw - 28px)) !important;
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 1.15rem 1.25rem 1.1rem;
}

#new-invoice-modal.modal {
    color-scheme: dark;
}

#new-invoice-modal .billing-note-modal.new-invoice-modal {
    width: min(680px, calc(100vw - 28px)) !important;
    max-width: min(680px, calc(100vw - 28px)) !important;
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 1.2rem 1.3rem 1.15rem;
    background:
        radial-gradient(ellipse 80% 50% at 10% 0%, rgba(59, 130, 246, 0.16), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(34, 197, 94, 0.08), transparent 50%),
        rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

#new-invoice-modal .new-invoice-modal__header {
    align-items: flex-start;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

#new-invoice-modal .new-invoice-modal__title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

#new-invoice-modal .new-invoice-modal__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.35), rgba(37, 99, 235, 0.18));
    border: 1px solid rgba(96, 165, 250, 0.35);
    color: #93c5fd;
    font-size: 1.05rem;
    flex: 0 0 auto;
}

#new-invoice-modal .new-invoice-modal__header h3 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

#new-invoice-modal .new-invoice-modal__header .billing-note-modal__sub {
    margin: 0.28rem 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

#new-invoice-modal .new-invoice-defaults {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

#new-invoice-modal .new-invoice-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.22);
}

#new-invoice-modal .new-invoice-chip:first-child {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(74, 222, 128, 0.28);
}

#new-invoice-modal .new-invoice-client-field {
    margin-bottom: 1rem;
}

#new-invoice-modal .new-invoice-section-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 0.45rem;
}

#new-invoice-modal .new-invoice-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0 0 0.55rem;
}

#new-invoice-modal .new-invoice-item {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    padding: 0.85rem 0.95rem 0.95rem;
    background: rgba(2, 6, 23, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#new-invoice-modal .new-invoice-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

#new-invoice-modal .new-invoice-item__badge {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
}

#new-invoice-modal .new-invoice-item-remove {
    border: none;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.15rem 0.25rem;
}

#new-invoice-modal .new-invoice-item-remove:hover {
    color: #fca5a5;
}

#new-invoice-modal .new-invoice-item .billing-note-field {
    margin-bottom: 0.7rem;
}

#new-invoice-modal .new-invoice-item .billing-note-field:last-child {
    margin-bottom: 0;
}

#new-invoice-modal .new-invoice-item__qty-price {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.65rem;
    margin-top: 0.15rem;
}

#new-invoice-modal .new-invoice-item__qty-price .billing-note-field {
    margin-bottom: 0;
}

#new-invoice-modal .new-invoice-desc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

#new-invoice-modal .new-invoice-desc-row label {
    margin: 0;
}

#new-invoice-modal .new-invoice-ai-notes {
    margin-top: 0.45rem;
}

#new-invoice-modal .new-invoice-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(129, 140, 248, 0.35);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.28), rgba(79, 70, 229, 0.16));
    color: #c7d2fe;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.28rem 0.7rem;
    cursor: pointer;
    flex: 0 0 auto;
}

#new-invoice-modal .new-invoice-ai-btn:hover:not(:disabled) {
    border-color: rgba(165, 180, 252, 0.55);
    color: #e0e7ff;
}

#new-invoice-modal .new-invoice-ai-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

#new-invoice-modal .new-invoice-line-total {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#new-invoice-modal .new-invoice-link-btn {
    border: none;
    background: transparent;
    color: #93c5fd;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-bottom: 0.35rem;
}

#new-invoice-modal .new-invoice-link-btn:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

#new-invoice-modal .new-invoice-result {
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

#new-invoice-modal .new-invoice-result__ok {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

#new-invoice-modal .new-invoice-result__ok a {
    color: #93c5fd;
    font-weight: 700;
}

/* Interview (step area above the line-item editor) */
#new-invoice-modal .new-invoice-interview {
    margin-bottom: 1rem;
}

#new-invoice-modal .new-invoice-log {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 0.6rem;
}

#new-invoice-modal .new-invoice-msg {
    max-width: 85%;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    font-size: 0.86rem;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#new-invoice-modal .new-invoice-msg--q {
    align-self: flex-start;
    color: #e2e8f0;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.22);
}

#new-invoice-modal .new-invoice-msg--a {
    align-self: flex-end;
    color: #f8fafc;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.24);
}

#new-invoice-modal .new-invoice-msg--ticket,
#new-invoice-modal .new-invoice-msg--ticket-bad,
#new-invoice-modal .new-invoice-msg--note {
    align-self: stretch;
    max-width: none;
    font-size: 0.8rem;
}

#new-invoice-modal .new-invoice-msg--ticket {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.22);
}

#new-invoice-modal .new-invoice-msg--ticket-bad {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.28);
}

#new-invoice-modal .new-invoice-msg--note {
    color: #fde68a;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.25);
}

#new-invoice-modal .new-invoice-step {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#new-invoice-modal .new-invoice-step__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

#new-invoice-modal .new-invoice-step__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

#new-invoice-modal .new-invoice-client-pick {
    min-height: 8rem;
}

#new-invoice-modal .new-invoice-hint {
    color: #94a3b8;
    font-size: 0.78rem;
    margin: 0;
}

#new-invoice-modal .new-invoice-rates {
    margin: 0.75rem 0 0.9rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

#new-invoice-modal .new-invoice-rates__bar {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
}

#new-invoice-modal .new-invoice-rates__bar .new-invoice-hint {
    flex: 1;
    line-height: 1.45;
}

#new-invoice-modal .new-invoice-rates-panel,
#new-invoice-modal #new-invoice-rates-panel {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.65rem;
}

#new-invoice-modal #new-invoice-rates-panel[hidden] {
    display: none;
}

#new-invoice-modal .new-invoice-rate-row {
    display: grid;
    grid-template-columns: 1fr 7rem auto;
    gap: 0.45rem;
    align-items: center;
}

#new-invoice-modal .new-invoice-rates__round {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    color: #e2e8f0;
    font-size: 0.84rem;
}

#new-invoice-modal .new-invoice-new-client .billing-note-field {
    margin-bottom: 0.6rem;
}

#new-invoice-modal .new-invoice-test-send {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin-top: 0.6rem;
    font-size: 0.84rem;
    color: #e2e8f0;
}

@media (max-width: 640px) {
    #new-invoice-modal .new-invoice-step__grid {
        grid-template-columns: 1fr;
    }
    #new-invoice-modal .new-invoice-msg {
        max-width: 100%;
    }
    #new-invoice-modal .new-invoice-rate-row {
        grid-template-columns: 1fr;
    }
}

#new-invoice-modal .new-invoice-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

#new-invoice-modal .new-invoice-total {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

#new-invoice-modal .new-invoice-total__label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

#new-invoice-modal .new-invoice-total strong {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

#new-invoice-modal .new-invoice-modal__actions {
    margin-top: 0 !important;
    width: auto !important;
}

#new-invoice-modal .new-invoice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.55rem 1.15rem;
    border-radius: 9px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 750;
    cursor: pointer;
    border: 1px solid transparent;
}

#new-invoice-modal .new-invoice-btn--quiet {
    min-width: 6.5rem;
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    box-shadow: none !important;
}

#new-invoice-modal .new-invoice-btn--quiet:hover {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(30, 41, 59, 0.75);
}

#new-invoice-modal .new-invoice-btn--primary {
    min-width: 9rem;
    border-color: rgba(96, 165, 250, 0.45);
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

#new-invoice-modal .new-invoice-btn--primary:hover:not(:disabled) {
    filter: brightness(1.06);
}

#new-invoice-modal .new-invoice-btn--primary:disabled {
    opacity: 0.55;
    cursor: wait;
    filter: none;
}

/* Kill global save/cancel emoji + red/green button takeover inside this modal */
#new-invoice-modal .billing-note-btn--primary::before,
#new-invoice-modal .billing-note-btn--ghost::before,
#new-invoice-modal .new-invoice-btn::before {
    content: none !important;
}

@media (max-width: 640px) {
    #new-invoice-modal .new-invoice-item__qty-price {
        grid-template-columns: 1fr 1fr;
    }

    #new-invoice-modal .new-invoice-item__line-total {
        grid-column: 1 / -1;
    }

    #new-invoice-modal .new-invoice-footer {
        flex-direction: column;
        align-items: stretch;
    }

    #new-invoice-modal .new-invoice-modal__actions {
        width: 100% !important;
    }

    #new-invoice-modal .new-invoice-btn {
        flex: 1;
    }
}

#check-payment-batch-modal .billing-note-modal__header {
    margin-bottom: 0.7rem;
    padding-bottom: 0.55rem;
}

#check-payment-batch-modal .billing-note-modal__header h3 {
    font-size: 1.05rem;
}

#check-payment-batch-modal .billing-note-modal__sub {
    margin-top: 0.2rem;
    font-size: 0.8rem;
}

#billing-note-modal .billing-note-modal__header,
#check-payment-modal .billing-note-modal__header,
#check-payment-batch-modal .billing-note-modal__header,
#credit-notice-modal .billing-note-modal__header,
#new-invoice-modal .billing-note-modal__header {
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#billing-note-modal .billing-note-modal__header h3,
#check-payment-modal .billing-note-modal__header h3,
#check-payment-batch-modal .billing-note-modal__header h3,
#credit-notice-modal .billing-note-modal__header h3,
#new-invoice-modal .billing-note-modal__header h3 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.25;
}

#billing-note-modal .billing-note-modal__sub,
#check-payment-modal .billing-note-modal__sub,
#check-payment-batch-modal .billing-note-modal__sub,
#credit-notice-modal .billing-note-modal__sub,
#new-invoice-modal .billing-note-modal__sub {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

#billing-note-modal .billing-note-modal__body,
#check-payment-modal .billing-note-modal__body,
#check-payment-batch-modal .billing-note-modal__body,
#credit-notice-modal .billing-note-modal__body,
#new-invoice-modal .billing-note-modal__body {
    padding-top: 0;
}

#billing-note-modal .billing-note-type-group {
    display: inline-flex;
    width: 100%;
    padding: 3px;
    margin-bottom: 1rem;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
}

#billing-note-modal .billing-note-type-group label {
    flex: 1;
    cursor: pointer;
}

#billing-note-modal .billing-note-type-group input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

#billing-note-modal .billing-note-type-group span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
}

#billing-note-modal .billing-note-type-group input:checked + span {
    background: rgba(59, 130, 246, 0.9);
    color: #fff;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.18);
}

#billing-note-modal .billing-note-field,
#check-payment-modal .billing-note-field,
#check-payment-batch-modal .billing-note-field {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    margin-bottom: 1rem;
}

#billing-note-modal .billing-note-field label,
#check-payment-modal .billing-note-field label,
#check-payment-batch-modal .billing-note-field label,
#credit-notice-modal .billing-note-field label,
#new-invoice-modal .billing-note-field label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#billing-note-modal .billing-note-input,
#check-payment-modal .billing-note-input,
#check-payment-batch-modal .billing-note-input,
#credit-notice-modal .billing-note-input,
#new-invoice-modal .billing-note-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    font: inherit;
    padding: 10px 12px;
    outline: none;
}

#billing-note-modal .billing-note-input:focus,
#check-payment-modal .billing-note-input:focus,
#check-payment-batch-modal .billing-note-input:focus,
#credit-notice-modal .billing-note-input:focus,
#new-invoice-modal .billing-note-input:focus {
    border-color: rgba(96, 165, 250, 0.7);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

#check-payment-modal.modal,
#check-payment-batch-modal.modal,
#credit-notice-modal.modal,
#new-invoice-modal.modal {
    color-scheme: dark;
}

#check-payment-modal .check-payment-grid,
#check-payment-batch-modal .check-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.9rem;
    row-gap: 0;
}

#check-payment-batch-modal .check-payment-batch__title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

#check-payment-batch-modal .check-payment-batch__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin-top: 1px;
    border-radius: 10px;
    background: linear-gradient(160deg, rgba(34, 197, 94, 0.22), rgba(21, 128, 61, 0.08));
    border: 1px solid rgba(74, 222, 128, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#check-payment-batch-modal .check-payment-batch__icon img {
    display: block;
    width: 20px;
    height: 20px;
    opacity: 0.95;
}

#check-payment-batch-modal .check-payment-batch__client-field {
    margin-bottom: 0.7rem;
}

#check-payment-batch-modal .check-payment-batch__client-field .billing-note-input {
    font-weight: 600;
    font-size: 0.92rem;
    padding: 9px 12px;
}

#check-payment-batch-modal .check-payment-batch__columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: start;
    margin-bottom: 0.55rem;
}

#check-payment-batch-modal .check-payment-batch__columns--split {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
    gap: 0.85rem;
}

#check-payment-batch-modal .check-payment-batch__col {
    min-width: 0;
}

#check-payment-batch-modal .check-payment-batch__col--right {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

#check-payment-batch-modal .check-payment-batch__check-panel {
    margin: 0;
    padding: 0.65rem 0.75rem 0.15rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.55), rgba(15, 23, 42, 0.35));
}

#check-payment-batch-modal .check-payment-batch__section-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#check-payment-batch-modal .check-payment-batch__section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

#check-payment-batch-modal .check-payment-batch__section-head .check-payment-batch__section-label {
    margin-bottom: 0;
}

#check-payment-batch-modal .check-payment-batch__select-links {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

#check-payment-batch-modal .check-payment-batch__select-links a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}

#check-payment-batch-modal .check-payment-batch__select-links a:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

#check-payment-batch-modal .check-payment-batch__invoice-list {
    max-height: min(320px, calc(100vh - 280px));
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.35);
}

#check-payment-batch-modal .check-payment-batch__invoice-row {
    display: grid;
    grid-template-columns: auto minmax(4.8rem, auto) minmax(5.2rem, auto) 1fr auto;
    align-items: center;
    gap: 0.35rem 0.55rem;
    padding: 0.42rem 0.6rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    transition: background 0.15s ease;
}

#check-payment-batch-modal .check-payment-batch__invoice-row:last-child {
    border-bottom: none;
}

#check-payment-batch-modal .check-payment-batch__invoice-row:hover {
    background: rgba(59, 130, 246, 0.08);
}

#check-payment-batch-modal .check-payment-batch__invoice-row:has(input:checked) {
    background: rgba(34, 197, 94, 0.08);
}

#check-payment-batch-modal .check-payment-batch__invoice-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #22c55e;
    cursor: pointer;
}

#check-payment-batch-modal .check-payment-batch__inv-num {
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

#check-payment-batch-modal .check-payment-batch__inv-due {
    color: var(--text-secondary);
    font-size: 0.7rem;
    white-space: nowrap;
}

#check-payment-batch-modal .check-payment-batch__inv-desc {
    color: var(--text-secondary);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

#check-payment-batch-modal .check-payment-batch__inv-amt {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    white-space: nowrap;
}

#check-payment-batch-modal .check-payment-batch__invoice-empty {
    padding: 0.7rem 0.8rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

#check-payment-batch-modal .check-payment-batch__sum-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    padding: 0.42rem 0.65rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.14);
    font-size: 0.82rem;
}

#check-payment-batch-modal .check-payment-batch__sum-bar span {
    color: var(--text-secondary);
    font-weight: 600;
}

#check-payment-batch-modal .check-payment-batch__sum-bar strong {
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    color: #e2e8f0;
}

#check-payment-batch-modal .check-payment-batch__amount-field .billing-note-input {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.98rem;
    letter-spacing: 0.01em;
}

#check-payment-batch-modal .check-payment-batch__check-panel .billing-note-field {
    margin-bottom: 0.55rem;
    gap: 0.28rem;
}

#check-payment-batch-modal .check-payment-batch__check-panel .billing-note-field label {
    font-size: 0.68rem;
}

#check-payment-batch-modal .check-payment-batch__check-panel .billing-note-input {
    padding: 8px 10px;
    font-size: 0.88rem;
}

#check-payment-batch-modal .check-payment-grid {
    column-gap: 0.65rem;
}

#check-payment-batch-modal .check-payment-batch__preview {
    margin: 0;
}

#check-payment-batch-modal .check-payment-batch__preview:not(:empty) {
    margin: 0;
    padding: 0.5rem 0.65rem;
    border-radius: 9px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.28);
    max-height: min(220px, calc(100vh - 360px));
    overflow-y: auto;
}

#check-payment-batch-modal .check-payment-batch__alloc-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.55rem;
    font-size: 0.78rem;
    padding: 0.16rem 0;
}

#check-payment-batch-modal .check-payment-batch__alloc-line + .check-payment-batch__alloc-line {
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

#check-payment-batch-modal .check-payment-batch__badge {
    font-weight: 700;
    font-size: 0.72rem;
    white-space: nowrap;
}

#check-payment-batch-modal .check-payment-batch__badge--paid {
    color: #4ade80;
}

#check-payment-batch-modal .check-payment-batch__badge--partial {
    color: #fbbf24;
}

#check-payment-batch-modal .check-payment-batch__badge--skip {
    color: var(--text-secondary);
}

#check-payment-batch-modal .check-payment-batch__callout {
    margin-top: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.3;
}

#check-payment-batch-modal .check-payment-batch__callout--over {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

#check-payment-batch-modal .check-payment-batch__callout--under {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fde68a;
}

#check-payment-batch-modal .check-payment-batch__callout label {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin-top: 0.35rem;
    cursor: pointer;
    font-weight: 400;
    color: var(--text-primary);
}

#check-payment-batch-modal .check-payment-batch__callout input[type="checkbox"] {
    margin-top: 0.12rem;
    accent-color: #60a5fa;
}

#check-payment-batch-modal .billing-note-status {
    min-height: 0;
    margin: 0;
}

#check-payment-batch-modal .billing-note-modal__actions {
    margin-top: 0.35rem;
}

@media (max-width: 860px) {
    #check-payment-batch-modal .check-payment-batch__columns--split {
        grid-template-columns: 1fr;
    }

    #check-payment-batch-modal .check-payment-batch__invoice-list {
        max-height: 200px;
    }

    #check-payment-batch-modal .check-payment-batch__preview:not(:empty) {
        max-height: none;
    }
}

@media (max-width: 640px) {
    #check-payment-batch-modal .check-payment-grid {
        grid-template-columns: 1fr;
    }

    #check-payment-batch-modal .check-payment-batch__invoice-row {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "check num amt"
            "check due due"
            "check desc desc";
    }

    #check-payment-batch-modal .check-payment-batch__invoice-row input {
        grid-area: check;
    }

    #check-payment-batch-modal .check-payment-batch__inv-num {
        grid-area: num;
    }

    #check-payment-batch-modal .check-payment-batch__inv-amt {
        grid-area: amt;
    }

    #check-payment-batch-modal .check-payment-batch__inv-due {
        grid-area: due;
    }

    #check-payment-batch-modal .check-payment-batch__inv-desc {
        grid-area: desc;
        white-space: normal;
    }
}

#billing-note-modal .billing-note-textarea,
#credit-notice-modal .billing-note-textarea {
    resize: vertical;
    min-height: 126px;
}

#billing-note-modal .billing-note-status,
#check-payment-modal .billing-note-status,
#check-payment-batch-modal .billing-note-status,
#credit-notice-modal .billing-note-status {
    min-height: 1.2rem;
    margin-top: -0.25rem;
    color: #f87171;
    font-size: 0.82rem;
}

#billing-note-modal .billing-note-modal__actions,
#check-payment-modal .billing-note-modal__actions,
#check-payment-batch-modal .billing-note-modal__actions,
#credit-notice-modal .billing-note-modal__actions,
#new-invoice-modal .billing-note-modal__actions {
    display: flex;
    gap: 10px;
    margin-top: 0.75rem;
}

#billing-note-modal .billing-note-btn,
#check-payment-modal .billing-note-btn,
#check-payment-batch-modal .billing-note-btn,
#credit-notice-modal .billing-note-btn {
    min-height: 40px;
    border: 1px solid var(--card-border);
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 9px 16px;
}

#billing-note-modal .billing-note-btn--primary,
#check-payment-modal .billing-note-btn--primary,
#check-payment-batch-modal .billing-note-btn--primary,
#credit-notice-modal .billing-note-btn--primary {
    flex: 1.35;
    background: var(--accent);
    border-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#billing-note-modal .billing-note-btn--ghost,
#check-payment-modal .billing-note-btn--ghost,
#check-payment-batch-modal .billing-note-btn--ghost,
#credit-notice-modal .billing-note-btn--ghost {
    flex: 0.75;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

#billing-note-modal .billing-note-btn:hover,
#check-payment-modal .billing-note-btn:hover,
#check-payment-batch-modal .billing-note-btn:hover,
#credit-notice-modal .billing-note-btn:hover {
    filter: brightness(1.08);
}

#check-payment-modal .billing-note-btn--primary:disabled,
#check-payment-batch-modal .billing-note-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

/* Compact overrides — keep batch modal scannable in one viewport */
#check-payment-batch-modal .billing-note-status {
    min-height: 0;
    margin-top: 0;
}

#check-payment-batch-modal .billing-note-modal__actions {
    margin-top: 0.4rem;
}

#billing-sms-draft-modal.modal {
    color-scheme: dark;
}

#billing-sms-draft-modal .billing-sms-modal {
    max-width: 520px;
}

#billing-sms-draft-modal .billing-sms-modal__header {
    align-items: flex-start;
    margin-bottom: 1.1rem;
}

#billing-sms-draft-modal .billing-sms-modal__header h3 {
    margin: 0;
    line-height: 1.25;
}

#billing-sms-draft-modal .billing-sms-modal__header .close-btn {
    flex-shrink: 0;
    margin-top: 2px;
    padding: 0 0 0 8px;
}

#billing-sms-draft-modal .billing-sms-modal__sub {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.35;
}

#billing-sms-draft-modal .billing-sms-modal__body {
    padding-top: 0;
}

#billing-sms-draft-modal .billing-sms-modal__hint {
    margin: 0 0 1.15rem;
    padding: 10px 12px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.92);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 10px;
    border-left-width: 4px;
    border-left-color: rgba(129, 140, 248, 0.85);
}

#billing-sms-draft-modal .billing-sms-field {
    margin-bottom: 1rem;
}

#billing-sms-draft-modal .billing-sms-field__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0.42rem;
}

#billing-sms-draft-modal .billing-sms-field__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

#billing-sms-draft-modal .billing-sms-copy-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

#billing-sms-draft-modal .billing-sms-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(129, 140, 248, 0.45);
}

#billing-sms-draft-modal .billing-sms-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#billing-sms-draft-modal .billing-sms-input:focus {
    border-color: rgba(129, 140, 248, 0.65);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

#billing-sms-draft-modal .billing-sms-textarea {
    resize: vertical;
    min-height: 132px;
}

#billing-sms-draft-modal .billing-sms-beeper-status {
    flex: 1 1 auto;
    min-width: 8rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

#billing-sms-draft-modal .billing-sms-beeper-status.is-ok {
    color: #34d399;
}

#billing-sms-draft-modal .billing-sms-beeper-status.is-error {
    color: #f87171;
}

#billing-sms-draft-modal .billing-sms-beeper-status.is-warning {
    color: #fbbf24;
}

#billing-sms-draft-modal .billing-sms-btn--primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

#billing-sms-draft-modal .billing-sms-modal__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 1.15rem;
}

#billing-sms-draft-modal .billing-sms-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

#billing-sms-draft-modal .billing-sms-btn--primary {
    flex: 1.4;
    background: var(--accent);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.25);
}

#billing-sms-draft-modal .billing-sms-btn--primary:hover {
    opacity: 0.95;
    box-shadow: 0 10px 26px rgba(99, 102, 241, 0.32);
}

#billing-sms-draft-modal .billing-sms-btn--ghost {
    flex: 0.75;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--card-border);
}

#billing-sms-draft-modal .billing-sms-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Billing dev info (mail_queue mirror) */
#billing-dev-info-modal .billing-dev-info-modal__box {
    max-width: 960px;
    width: calc(100vw - 2rem);
}

#billing-dev-info-modal .billing-dev-info-modal__header {
    align-items: flex-start;
    gap: 0.75rem;
}

#billing-dev-info-modal .billing-dev-info-modal__header h3 {
    margin: 0;
    font-size: 1.1rem;
}

#billing-dev-info-modal .billing-dev-info-modal__sub {
    margin: 0.35rem 0 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

#billing-dev-info-modal .billing-dev-info-modal__sub code {
    font-size: 0.78em;
}

#billing-dev-info-modal .billing-dev-info-modal__body {
    padding-top: 0.25rem;
    max-height: min(70vh, 560px);
    overflow: auto;
}

#billing-dev-info-modal .billing-dev-info-modal__footer {
    padding: 0.65rem 1.25rem 1rem;
    border-top: 1px solid var(--card-border);
}

#billing-dev-info-modal #billing-dev-info-body .manager-table td {
    vertical-align: top;
    word-break: break-word;
}

/* Billing invoices â€” dev cog uses inline SVG (Font Awesome not bundled) */
.billing-dev-toolbar-cog {
    width: 1.1rem;
    height: 1.1rem;
    display: block;
    flex-shrink: 0;
}

#billing-tab .secondary-tabs-nav {
    align-items: center;
    flex-wrap: wrap;
    row-gap: 0.5rem;
    max-width: 100%;
}

.billing-invoices-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 8px;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
}

.billing-invoices-toolbar button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.billing-invoices-toolbar .billing-invoices-search {
    width: 200px;
}

.billing-invoice-status-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.35);
}

.billing-invoice-status-tab {
    padding: 0.35rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.billing-invoice-status-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.billing-invoice-status-tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.billing-overdue-review-toggle[hidden] {
    display: none !important;
}

.billing-overdue-review-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 10px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.billing-overdue-review-toggle:has(input:checked) {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.12);
}

.billing-overdue-review-toggle input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: #f87171;
    cursor: pointer;
}

.billing-toolbar-icon-btn,
.billing-refresh-btn {
    min-height: 34px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.62);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.billing-toolbar-icon-btn {
    width: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.billing-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    color: #bfdbfe;
}

.billing-toolbar-icon-btn:hover,
.billing-refresh-btn:hover {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.38);
    transform: translateY(-1px);
}

.readonly-input {
    opacity: 0.7;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Payment Schedule Status Pills */
.status-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.status-pill.pif-balance {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.subscription {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-pill.variable {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.manual-debt {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.status-pill.fixed {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-pill.fixed-manual {
    background: rgba(255, 255, 255, 0.1);
    color: #ffd700;
    border: 1px solid #ffd70044;
}

/* Payment Schedule Extensions */
.clickable-name {
    cursor: pointer;
    color: var(--accent);
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.clickable-name:hover {
    color: #818cf8;
    text-decoration: underline;
}

.autopay-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    margin-left: 8px;
    vertical-align: middle;
}

.autopay-icon {
    font-size: 0.8rem;
    margin-right: 4px;
    opacity: 0.8;
}

.btn-accent-small {
    background: var(--accent);
    border: none;
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accent-small:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

.radio-group {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.radio-option input {
    cursor: pointer;
}

/* Subscription Clickable Titles */
.clickable-title {
    cursor: pointer;
    transition: color 0.15s ease;
    font-weight: 600;
}

.clickable-title:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* IOARE Consulting Hour Tracker Styles */
.consulting-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.consulting-submissions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.consulting-item {
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid #4b5563; /* Default gray for drafts */
    border-radius: 8px;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.consulting-item.submitted {
    border-left-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.consulting-item.paid {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
    opacity: 0.8;
}

.consulting-item .item-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.consulting-item .item-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.consulting-item .item-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.consulting-item .item-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.consulting-item .pending-text {
    color: #ffd700;
}

.consulting-item .paid-text {
    color: #10b981;
}

.status-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 800;
    display: inline-block;
    width: fit-content;
    align-self: flex-end;
}

.status-badge.accent { background: var(--accent); color: white; }
.status-badge.success { background: #10b981; color: white; }
.status-badge.gray { background: #4b5563; color: white; }

/* Match Suggestion */
.match-suggestion {
    grid-column: 1 / span 2;
    margin-top: 12px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #93c5fd;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1000;
}

.match-suggestion:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.match-details {
    font-weight: 600;
    color: #fff;
    margin: 2px 0;
}

.match-action {
    color: #10b981;
    font-weight: 800;
    text-decoration: underline;
    text-align: right;
    font-size: 0.75rem;
}

@keyframes pulse-border {
    0% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { border-color: #10b981; box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.animations-pulse {
    animation: pulse-border 3s infinite;
}

/* Reconciliation Section */
.reconciliation-container {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.reconciliation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.reconciliation-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: transform 0.2s, border-color 0.2s;
}

.reconciliation-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* --- Professional Confirmation Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content.glass-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    width: 100%;
}

.margin-bottom-24 {
    margin-bottom: 1.5rem;
}

/* Animations */
.animations-scale-up {
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rec-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
}

.rec-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rec-body {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.btn-primary-small {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.modal-primary-small:hover {
    background: #2563eb;
}

.accent-text {
    color: var(--accent);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10050;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 20px;
    min-width: 280px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    transform: translateX(120%);
    animation: toastSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
               toastFadeOut 0.5s ease 3.8s forwards;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
    background: rgba(127, 29, 29, 0.96);
    border-color: rgba(248, 113, 113, 0.65);
    box-shadow: 0 16px 34px rgba(127, 29, 29, 0.45);
    animation: toastSlideIn 0.25s ease forwards;
}

.toast.info {
    border-left: 4px solid var(--accent);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    flex: 1;
    white-space: pre-line;
}

@keyframes toastSlideIn {
    to { transform: translateX(0); }
}

@keyframes toastFadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* Consulting Tracker Scrolling & Layout */
.consulting-grid-container {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.consulting-grid-container::-webkit-scrollbar {
    width: 6px;
}

.consulting-grid-container::-webkit-scrollbar-track {
    background: transparent;
}

.consulting-grid-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.consulting-grid-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.consulting-submissions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 40px; /* Crucial: ensures bottom-most items aren't clipped by card corners */
}

.consulting-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.consulting-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

/* Unified Consulting Timeline */
.consulting-unified-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 50px;
    max-height: 750px;
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.consulting-unified-timeline::-webkit-scrollbar { width: 6px; }
.consulting-unified-timeline::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
.consulting-unified-timeline::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.item-icon-col {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    min-width: 60px;
}

.it-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.it-icon.sub { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }
.it-icon.dep { background: rgba(16, 185, 129, 0.1); color: #34d399; border-color: rgba(16, 185, 129, 0.2); }

.it-type-pill {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 800;
    margin-left: 10px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    vertical-align: middle;
    letter-spacing: 0.5px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.it-type-pill.dep {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.consulting-item {
    padding: 1.25rem 1.75rem !important;
    min-height: 100px;
    gap: 20px;
}

.item-title { font-size: 1.1rem; }
.item-subtitle { font-size: 0.9rem; margin-top: 4px; }

.submission-item { border-left: 5px solid var(--accent) !important; }
.deposit-item { border-left: 5px solid var(--success) !important; }
.deposit-item.unmatched { border-left-color: var(--danger) !important; }
.submission-item.paid { opacity: 0.7; }
.submission-item.draft { border-left-color: #64748b !important; opacity: 0.8; }

.untie-link {
    color: #f87171;
    font-size: 0.75rem;
    margin-left: 8px;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.untie-link:hover {
    opacity: 1;
    color: #ef4444;
}

/* Consulting Interactivity */
.consulting-item {
    cursor: grab;
    transition: transform 0.2s, background 0.2s, border 0.2s, box-shadow 0.2s !important;
}

.consulting-item:active {
    cursor: grabbing;
}

.consulting-item.selected {
    background: rgba(59, 130, 246, 0.12) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.2), inset 0 0 10px rgba(59, 130, 246, 0.1);
    transform: scale(1.01);
    z-index: 10;
}

/* Hub: selected weeks get a vivid green left bar (overrides submit-date group color) */
#hub-pending-list .hub-submission-row.selected {
    border-left-width: 5px !important;
    border-left-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.16) !important;
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.28), inset 0 0 8px rgba(16, 185, 129, 0.08);
}

.consulting-item.dragging {
    opacity: 0.2;
    transform: scale(0.98);
}

.consulting-item.reconcile-target {
    border-color: var(--success) !important;
    background: rgba(16, 185, 129, 0.15) !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3), inset 0 0 20px rgba(16, 185, 129, 0.1) !important;
    transform: scale(1.025) translateY(-2px);
    z-index: 100;
    animation: reconcilePulse 1.5s infinite;
}

@keyframes reconcilePulse {
    0% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 40px rgba(16, 185, 129, 0.4); }
    100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }
}

.consulting-summary-bar {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 100px;
    padding: 10px 24px;
    z-index: 9999;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.1);
    animation: summarySlideUp 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes summarySlideUp {
    from { transform: translate(-50%, 100px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.summary-content {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
}

.summary-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.15);
}

.summary-total {
    color: var(--success);
    font-weight: 700;
}

.hub-summary-match {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Dock under Active Payment — solid, not floating over the weeks list */
#hub-selection-summary-bar.hub-selection-summary-bar--docked {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin-top: 0.85rem;
    padding: 12px 16px;
    border-radius: 14px;
    background: #0f172a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: none;
    z-index: 1;
}

#hub-selection-summary-bar.hub-selection-summary-bar--docked .summary-content {
    flex-wrap: wrap;
    gap: 10px 14px;
    justify-content: flex-start;
}

#hub-selection-summary-bar.is-amount-match .hub-summary-match {
    color: #34d399;
}

#hub-selection-summary-bar.is-amount-match {
    border-color: rgba(52, 211, 153, 0.35);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 24px rgba(16, 185, 129, 0.2);
}

#hub-selection-summary-bar.hub-selection-summary-bar--docked.is-amount-match {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(16, 185, 129, 0.22);
}

#hub-selection-summary-bar.is-amount-mismatch .hub-summary-match {
    color: #fbbf24;
}

#hub-summary-action-btn:disabled,
#hub-summary-action-btn.is-disabled:not(.is-partial-risk) {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

#hub-summary-action-btn.is-partial-risk {
    opacity: 0.7;
    cursor: pointer;
    pointer-events: auto;
    background: #92400e;
    border-color: #b45309;
}

.active-payment-card.is-partial-payment {
    border-color: rgba(245, 158, 11, 0.55);
}

.payment-card-hint--warn {
    color: #fbbf24;
}

.summary-clear-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.summary-clear-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: scale(1.1);
}

/* Overrides for selection safety */
.consulting-item * {
    pointer-events: inherit;
}

.consulting-item button, 
.consulting-item a, 
.consulting-item .match-suggestion,
.consulting-item .untie-link {
    pointer-events: auto;
}

/* --- Nested Reconciliation UI --- */
.nested-submissions-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: -8px; /* Pull closer to parent paycheck */
    margin-bottom: 20px;
}

.nested-submission {
    margin-left: 32px;
    position: relative;
    border-top: none !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-left: 2px solid var(--accent-dim) !important;
    border-bottom-left-radius: 8px;
    transform: scale(0.97);
    transform-origin: left center;
}

.nested-submission .item-icon-col {
    padding-left: 12px;
}

.nested-submission .it-icon.sub {
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
}

.nested-submission .it-type-pill {
    font-size: 0.65rem;
    padding: 1px 4px;
}

/* --- Collapsible & Status UI --- */
.nested-submissions-group {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-height: 2000px; /* Large enough for many weeks */
    opacity: 1;
}

.nested-submissions-group.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.deposit-item {
    cursor: pointer;
}

.deposit-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.toggle-chevron {
    font-size: 0.8rem;
    margin-left: auto;
    opacity: 0.5;
    transition: transform 0.3s ease;
}

.deposit-item.expanded .toggle-chevron {
    transform: rotate(180deg);
}

.tied-checkbox {
    margin-left: 6px;
    font-size: 0.9em;
    filter: saturate(0.8);
    opacity: 0.9;
}

/* --- Card Stack Effect --- */
.card-stack-effect {
    position: relative;
    margin-bottom: 24px !important; /* Make room for the stack */
}

.card-stack-effect.expanded {
    margin-bottom: 8px !important;
}

.deposit-item.card-stack-effect:not(.expanded)::before,
.deposit-item.card-stack-effect:not(.expanded)::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: -1;
    left: 8px;
    right: 8px;
    bottom: -6px;
    height: 40px;
    transition: all 0.3s ease;
}

.deposit-item.card-stack-effect:not(.expanded)::after {
    left: 16px;
    right: 16px;
    bottom: -11px;
    height: 40px;
    background: rgba(255, 255, 255, 0.02);
    z-index: -2;
}

/* Hide stack when expanded */
.deposit-item.expanded::before,
.deposit-item.expanded::after {
    opacity: 0;
    transform: translateY(-10px);
}

/* Audit & Troubleshooting Table */
#troubleshooting-tab {
    height: calc(100vh - 250px);
    display: none;
    flex-direction: column;
}

#troubleshooting-tab.active {
    display: flex;
}

#troubleshooting-tab .card-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.audit-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.audit-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.audit-table th {
    text-align: left;
    padding: 12px 16px;
    background: #1e293b;
    border-bottom: 2px solid var(--accent);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.audit-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
/* Reconciliation Hub Drag-and-Drop */
.reconcile-workspace-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: flex-start;
}

.reconcile-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.reconcile-panel--submissions {
    flex: 1 1 280px;
    max-width: 450px;
}

.reconcile-panel--payment {
    flex: 0 1 auto;
    width: max-content;
    max-width: 100%;
    align-self: flex-start;
}

.reconcile-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    gap: 0.75rem;
}

.reconcile-panel .panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.reconcile-payment-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.reconcile-header-controls {
    width: max-content;
    max-width: 100%;
}

.reconcile-payment-select {
    width: max-content;
    min-width: 16rem;
    max-width: min(100vw - 3rem, 56rem);
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
    field-sizing: content;
}

.reconcile-scroll-window {
    flex: 0 1 auto;
    min-height: 0;
    max-height: min(70vh, 720px);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 0.4rem;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.reconcile-empty-hint {
    text-align: center;
    color: var(--text-secondary);
    padding: 1.25rem 0.75rem;
    margin: 0;
    font-size: 0.85rem;
}

#hub-active-payment-container {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

#hub-active-payment-container .active-payment-card,
#hub-active-payment-container .empty-state-card {
    flex: 0 0 auto;
    min-height: 0;
}

.hub-no-payments-card {
    max-width: 22rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.08);
}

.hub-no-payments-title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #6ee7b7;
}

.hub-no-payments-copy {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.reconcile-panel .panel-header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.reconcile-hide-zero-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

#hub-pending-list .consulting-item.hub-submission-row {
    padding: 0.28rem 0.55rem !important;
    min-height: 0 !important;
    border-radius: 7px;
    gap: 0.55rem !important;
    align-items: center;
    display: flex;
    justify-content: space-between;
}

#hub-pending-list .hub-row-main {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    min-width: 0;
    flex: 1;
    line-height: 1.2;
}

#hub-pending-list .hub-row-week {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

#hub-pending-list .hub-row-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

#hub-pending-list .hub-row-amount {
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.35rem;
}

#hub-pending-list .hub-row-submitted {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(148, 163, 184, 0.45);
    text-underline-offset: 2px;
    cursor: help;
}

#hub-pending-list .hub-row-submitted:hover {
    color: var(--text-primary);
    text-decoration-color: currentColor;
}

#hub-pending-list .hub-submission-row {
    border-left: 3px solid transparent;
}

#hub-pending-list .hub-submit-group-0 {
    border-left-color: #60a5fa;
    background: rgba(96, 165, 250, 0.08) !important;
}
#hub-pending-list .hub-submit-group-1 {
    border-left-color: #34d399;
    background: rgba(52, 211, 153, 0.08) !important;
}
#hub-pending-list .hub-submit-group-2 {
    border-left-color: #fbbf24;
    background: rgba(251, 191, 36, 0.09) !important;
}
#hub-pending-list .hub-submit-group-3 {
    border-left-color: #c084fc;
    background: rgba(192, 132, 252, 0.09) !important;
}
#hub-pending-list .hub-submit-group-4 {
    border-left-color: #fb7185;
    background: rgba(251, 113, 133, 0.09) !important;
}
#hub-pending-list .hub-submit-group-5 {
    border-left-color: #22d3ee;
    background: rgba(34, 211, 238, 0.08) !important;
}
#hub-pending-list .hub-submit-group-6 {
    border-left-color: #a3e635;
    background: rgba(163, 230, 53, 0.08) !important;
}
#hub-pending-list .hub-submit-group-7 {
    border-left-color: #f472b6;
    background: rgba(244, 114, 182, 0.09) !important;
}

#hub-pending-list .hub-submission-row.hub-submit-date-hover {
    filter: brightness(1.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

@media (max-width: 980px) {
    .reconcile-workspace-grid {
        flex-direction: column;
        min-height: 0;
    }

    .reconcile-panel--submissions,
    .reconcile-panel--payment {
        max-width: 100%;
        width: 100%;
        flex: 1 1 auto;
    }

    .reconcile-header-controls,
    .reconcile-payment-select {
        width: 100%;
        max-width: 100%;
    }

    .reconcile-scroll-window {
        max-height: 42vh;
    }
}

.draggable-submission {
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.draggable-submission:active {
    cursor: grabbing;
}

.draggable-submission.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    background: rgba(var(--accent-rgb), 0.05);
    border: 1px dashed var(--item-border-accent);
    z-index: 1000;
}

.active-payment-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.active-payment-card.drag-over {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.active-payment-card.drag-over::after {
    content: 'â†“ Drop to Match';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #10b981;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    pointer-events: none;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translate(-50%, -40%); }
    50% { transform: translate(-50%, -60%); }
}

.payment-card-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.payment-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
}

.payment-card-hint--inline {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.btn-hub-exclude {
    flex-shrink: 0;
    font-size: 0.72rem;
    line-height: 1.1;
    padding: 2px 8px;
    min-height: 0;
    height: auto;
    border-radius: 6px;
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.2);
    cursor: pointer;
}

.btn-hub-exclude:hover {
    background: rgba(255, 107, 107, 0.18);
    border-color: rgba(255, 107, 107, 0.35);
}

.pulse-icon {
    animation: pulse 2s infinite;
}

/* Prediction Ignore Rules UI */
.ignore-input-group {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
    align-items: center;
}

.ignore-input-group:focus-within {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 15px var(--accent-glow);
}

.ignore-input-group .form-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 8px 4px !important;
}

.ignore-input-group .form-input:focus {
    box-shadow: none !important;
}

.ignore-rule-item {
    transition: all 0.2s ease;
}

.ignore-rule-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(4px);
    border-color: var(--accent) !important;
}

.ignore-rule-item span {
    font-size: 0.95rem;
}

.delete-rule {
    transition: all 0.2s ease;
}

.delete-rule:hover {
    opacity: 1 !important;
    transform: scale(1.1);
    color: var(--danger);
}

.clickable-title { cursor: pointer; color: var(--accent); transition: all 0.2s ease; border-bottom: 1px dashed transparent; } .clickable-title:hover { color: var(--accent-hover); border-bottom: 1px dashed var(--accent); } .edit-pill { font-size: 0.65rem; font-weight: 800; padding: 2px 6px; background: var(--success); color: #000; border-radius: 4px; margin-left: 8px; vertical-align: middle; letter-spacing: 0.5px; box-shadow: 0 2px 4px rgba(0,0,0,0.2); } .list-item:hover .clickable-title { transform: translateX(2px); } .radio-group label { font-size: 0.9rem; color: var(--text-primary); display: flex; align-items: center; gap: 6px; cursor: pointer; } .radio-group input[type="radio"] { accent-color: var(--accent); }
/* --- TAX CENTER STYLES --- */
.tax-year-selector-container {
    margin-top: 8px;
}

.tax-status-banner {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
}

.status-badge-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.status-badge-container.extension .status-select {
    border-color: #f59e0b;
    color: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.status-badge-container.filed .status-select {
    border-color: var(--success);
    color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.status-badge-container.in-progress .status-select {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.tax-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.tax-column h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tax-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tax-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.tax-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tax-item.completed {
    opacity: 0.6;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.tax-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tax-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tax-item-desc {
    font-weight: 600;
    font-size: 0.95rem;
}

.tax-item.completed .tax-item-desc {
    text-decoration: line-through;
}

.tax-item-due {
    font-size: 0.75rem;
    color: var(--danger);
}

.tax-item-notes {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-style: italic;
}

.tax-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.tax-item:hover .tax-item-delete {
    opacity: 1;
}

.tax-item-delete:hover {
    color: var(--danger);
}

.empty-text {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

/* --- AMAZON 2025 TAB STYLES --- */
.row-highlight-accent {
    background: rgba(59, 130, 246, 0.1) !important;
    border-left: 3px solid var(--accent);
}

.switch-small {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch-small input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-small {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
}

.slider-small:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider-small {
  background-color: var(--accent);
}

input:focus + .slider-small {
  box-shadow: 0 0 1px var(--accent);
}

input:checked + .slider-small:before {
  transform: translateX(14px);
}

.slider-small.round {
  border-radius: 20px;
}

.slider-small.round:before {
  border-radius: 50%;
}

.summary-banner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.accent-border {
    border-color: var(--accent) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.success-border {
    border-color: var(--success) !important;
}

.margin-bottom-20 {
    margin-bottom: 2rem;
}

.accent-text {
    color: var(--accent);
}

/* Amazon Tab Enhancements */
#amazon-orders-list tr {
    height: 32px;
}

#amazon-orders-list td {
    vertical-align: middle;
    padding: 4px 12px;
}

#amazon-tab .item-title-compact {
    max-width: 500px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    display: block !important;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    cursor: pointer;
}

#amazon-tab td.item-title-compact {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    vertical-align: middle !important;
    cursor: default;
}

#amazon-tab .item-title-compact.expanded {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    word-break: break-word;
}

.status-pill-small {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill-small.success { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-pill-small.gray { background: rgba(148, 163, 184, 0.1); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.2); }
.status-pill-small.warning { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }

.tax-prep-overview {
    padding-top: 1.2rem;
}

/* Categorized Expenses row matches the Estimated Tax payment link treatment. */
#tax-prep-overview-tab .tax-prep-categorized-header {
    margin-bottom: 0.75rem;
}
#tax-prep-overview-tab .tax-prep-categorized-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
/* Beat Chrome a:-webkit-any-link (default blue + underline) inside overview card */
#tax-prep-overview-tab .tax-prep-categorized-heading a.est-tax-pay-link:-webkit-any-link {
    color: #93c5fd !important;
    text-decoration: none !important;
}
#tax-prep-overview-tab .tax-prep-categorized-heading a.est-tax-pay-link:hover:-webkit-any-link {
    color: #bfdbfe !important;
    text-decoration: underline !important;
}
.tax-prep-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.tax-prep-kpi {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.34);
    border-radius: 8px;
    padding: 14px 16px;
}

.tax-prep-kpi .kpi-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.tax-prep-kpi strong {
    color: var(--text-primary);
    font-size: 1.35rem;
}

.tax-prep-section {
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    padding-top: 18px;
    margin-top: 18px;
}

.tax-prep-section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    margin-bottom: 12px;
}

.tax-prep-section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.tax-prep-section-header span {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.tax-prep-subhead {
    margin: 14px 0 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.tax-prep-source-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.tax-prep-source {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.24);
    border-radius: 8px;
    padding: 14px 16px;
}

.tax-prep-source div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tax-prep-source strong {
    color: var(--text-primary);
}

.tax-prep-source span,
.tax-prep-source small {
    color: var(--text-secondary);
}

.tax-prep-source-message {
    line-height: 1.35;
}

.tax-prep-table .tax-prep-total-row {
    background: rgba(59, 130, 246, 0.08);
    font-weight: 800;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .tax-prep-kpis,
    .tax-prep-source-grid {
        grid-template-columns: 1fr;
    }

    .tax-prep-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.tax-review-summary {
    display: flex;
    align-items: baseline;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.tax-review-summary span {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.tax-action-btn {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    padding: 5px 9px;
    min-height: 28px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
    transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
    white-space: nowrap;
}

.tax-action-wdwx {
    background: linear-gradient(180deg, #b91c1c, #7f1d1d);
    border-color: rgba(252, 165, 165, 0.35);
    box-shadow: 0 8px 16px rgba(185, 28, 28, 0.22);
}

.tax-action-ignore {
    background: linear-gradient(180deg, #64748b, #334155);
    border-color: rgba(148, 163, 184, 0.46);
    box-shadow: 0 8px 16px rgba(100, 116, 139, 0.18);
}

.tax-action-dup {
    background: linear-gradient(180deg, #f59e0b, #b45309);
    border-color: rgba(251, 191, 36, 0.62);
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.2);
}

.tax-action-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24);
}

.tax-action-btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.filed-status-pill {
    display: inline-flex;
    min-width: 62px;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.filed-unknown {
    background: rgba(100, 116, 139, 0.9);
}

.filed-not-filed-yet {
    background: rgba(100, 116, 139, 0.9);
}

.filed-wdwx {
    background: rgba(59, 130, 246, 0.9);
}

.filed-ign {
    background: rgba(71, 85, 105, 0.95);
}

.filed-dup {
    background: rgba(245, 158, 11, 0.9);
}

#expense-finding-sub .manager-table tr[class*="dup-audit-group-"] td {
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

#expense-finding-sub .manager-table tr.dup-audit-group-0,
#expense-finding-sub .manager-table tr.dup-audit-group-0 td { background-color: rgba(250, 204, 21, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-1,
#expense-finding-sub .manager-table tr.dup-audit-group-1 td { background-color: rgba(56, 189, 248, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-2,
#expense-finding-sub .manager-table tr.dup-audit-group-2 td { background-color: rgba(52, 211, 153, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-3,
#expense-finding-sub .manager-table tr.dup-audit-group-3 td { background-color: rgba(244, 114, 182, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-4,
#expense-finding-sub .manager-table tr.dup-audit-group-4 td { background-color: rgba(167, 139, 250, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-5,
#expense-finding-sub .manager-table tr.dup-audit-group-5 td { background-color: rgba(251, 146, 60, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-6,
#expense-finding-sub .manager-table tr.dup-audit-group-6 td { background-color: rgba(45, 212, 191, 0.24) !important; }
#expense-finding-sub .manager-table tr.dup-audit-group-7,
#expense-finding-sub .manager-table tr.dup-audit-group-7 td { background-color: rgba(248, 113, 113, 0.24) !important; }

.manual-expense-form {
    display: grid;
    grid-template-columns: 80px 120px minmax(180px, 1fr) minmax(160px, 0.65fr) minmax(220px, 1fr) auto;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.manual-expense-form .search-input-pill {
    max-width: none;
    min-height: 32px;
    padding: 5px 10px;
    font-size: 0.84rem;
    border-radius: 6px;
}

.manual-expense-form .btn-pill {
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    white-space: nowrap;
}

#manual-expense-modal .manual-expense-modal-content {
    width: min(620px, calc(100vw - 32px)) !important;
    max-width: 620px !important;
    padding: 30px 32px 32px !important;
    border-radius: 18px !important;
    border: 1px solid rgba(34, 197, 94, 0.5) !important;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.23), transparent 34%),
        linear-gradient(180deg, rgba(7, 35, 22, 0.99), rgba(7, 19, 17, 0.99)) !important;
    box-shadow: 0 26px 72px rgba(0, 0, 0, 0.62), 0 0 36px rgba(22, 163, 74, 0.18) !important;
}

#manual-expense-modal .modal-header {
    margin: 0 0 22px !important;
    padding-bottom: 16px !important;
    border-bottom: 1px solid rgba(134, 239, 172, 0.2) !important;
}

#manual-expense-modal .modal-header h2 {
    margin: 0 !important;
    color: #f0fdf4 !important;
    font-size: 1.55rem !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
}

#manual-expense-modal .close-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 999px !important;
    color: #bbf7d0 !important;
    background: rgba(20, 83, 45, 0.52) !important;
    border: 1px solid rgba(134, 239, 172, 0.22) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#manual-expense-modal .modal-body {
    padding: 0 !important;
}

#manual-expense-modal .manual-expense-modal-form {
    display: grid !important;
    grid-template-columns: 150px 1fr !important;
    gap: 15px 16px !important;
    align-items: end !important;
    margin-bottom: 0 !important;
}

#manual-expense-modal .manual-expense-modal-form .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
    margin: 0 !important;
}

#manual-expense-modal .manual-expense-wide-row,
#manual-expense-modal .manual-expense-actions {
    grid-column: 1 / -1 !important;
}

#manual-expense-modal .manual-expense-modal-form label {
    color: #bbf7d0 !important;
    font-size: 0.74rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em !important;
    line-height: 1.1 !important;
    text-transform: uppercase !important;
}

#manual-expense-modal .manual-expense-modal-form .form-input {
    width: 100% !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    padding: 10px 12px !important;
    border-radius: 9px !important;
    border: 1px solid rgba(134, 239, 172, 0.28) !important;
    background: rgba(4, 20, 15, 0.72) !important;
    color: #f8fafc !important;
    font-family: inherit !important;
    font-size: 0.94rem !important;
    outline: none !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

#manual-expense-modal .manual-expense-modal-form .form-input:focus {
    border-color: rgba(34, 197, 94, 0.9) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

#manual-expense-modal .manual-expense-modal-form .form-input::placeholder {
    color: rgba(187, 247, 208, 0.62) !important;
}

#manual-expense-modal .manual-expense-modal-form select.form-input {
    color: #f8fafc !important;
}

#manual-expense-modal .manual-expense-modal-form select.form-input option {
    color: #052e16 !important;
    background: #dcfce7 !important;
}



#manual-expense-modal .manual-expense-actions {
    display: grid !important;
    grid-template-columns: 1fr 0.55fr !important;
    gap: 14px !important;
    margin-top: 12px !important;
}

#manual-expense-modal .manual-expense-actions .btn-save-full,
#manual-expense-modal .manual-expense-actions .btn-cancel-full {
    min-height: 44px !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    font-weight: 800 !important;
    font-size: 0.96rem !important;
}

#manual-expense-modal .manual-expense-actions .btn-save-full {
    border: 1px solid rgba(134, 239, 172, 0.42) !important;
    background: linear-gradient(180deg, #22c55e, #15803d) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 26px rgba(21, 128, 61, 0.34) !important;
}

#manual-expense-modal .manual-expense-actions .btn-cancel-full {
    border: 1px solid rgba(134, 239, 172, 0.22) !important;
    background: rgba(7, 35, 22, 0.58) !important;
    color: #dcfce7 !important;
}

.expense-ledger-summary {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.88rem;
}

.expenses-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.expenses-title-row h2 {
    margin: 0;
}

.expenses-title-row .expense-ledger-summary {
    margin: 0;
    color: var(--text-primary);
}

#tax-review-tab .card-header {
    align-items: flex-start;
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
}

#tax-review-tab .card-header-column {
    padding-top: 2px;
}

#tax-review-tab .card-header-right {
    align-self: flex-start;
    padding-top: 0;
}

#expense-finding-sub .card-header {
    width: 100%;
}

#expense-finding-sub .manager-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

#expense-finding-sub .table-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

#expense-finding-sub .manager-table th,
#expense-finding-sub .manager-table td {
    padding-left: 8px;
    padding-right: 8px;
}

#expense-finding-sub .tax-col-date {
    width: 64px;
}

#expense-finding-sub .tax-col-source {
    width: 36px;
    text-align: center;
}

#expense-finding-sub .tax-col-amount {
    width: 108px;
    padding-right: 22px;
}

#expense-finding-sub .tax-col-filed {
    width: 70px;
}

#expense-finding-sub .tax-col-actions {
    width: 172px;
}

#expense-finding-sub .tax-action-btn {
    padding: 3px 5px;
    font-size: 0.68rem;
    min-height: 24px;
}

#expense-finding-sub .tax-description-cell {
    overflow: hidden;
    max-width: none;
    width: auto;
    min-width: 0;
}

#expense-finding-sub .tax-description-cell .tax-desc-text,
#expense-finding-sub .tax-description-cell .tax-desc-text > div {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

#expense-finding-sub .tax-description-cell span {
    min-width: 0;
    max-width: 100%;
}

#expense-finding-sub .tax-description-cell div[style*="font-style:italic"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tax-audit-btn {
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid rgba(245, 158, 11, 0.55);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.92));
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.18);
}

.tax-audit-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.expense-add-btn {
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid rgba(34, 197, 94, 0.55);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(22, 101, 52, 0.96), rgba(20, 83, 45, 0.94));
    color: #ffffff;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(22, 101, 52, 0.22);
}

.expense-add-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.tax-source-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.95rem;
    cursor: help;
}

.tax-filter-left,
.tax-filter-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tax-filter-left {
    justify-content: flex-start;
    margin-right: auto;
}

.tax-filter-right {
    justify-content: flex-end;
    margin-left: auto;
}

#tax-review-tab .card-subtitle {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.expense-category-select {
    width: 100%;
    min-width: 195px !important;
    max-width: 195px;
    min-height: 34px;
    background: #0f241b !important;
    color: #f8fafc !important;
    border: 1px solid rgba(34, 197, 94, 0.45) !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 700;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.expense-category-select:focus {
    border-color: rgba(34, 197, 94, 0.85);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.expense-category-select option {
    color: #052e16;
    background: #dcfce7;
}

/* Expenses tab â€“ 6 cols: Date | Source | Description | Category | Amount | Actions */
#expenses-ledger-sub .manager-table,
#duplicate-expenses-sub .manager-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

#expenses-ledger-sub .table-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

#expenses-ledger-sub .manager-table th:nth-child(1),
#expenses-ledger-sub .manager-table td:nth-child(1),
#duplicate-expenses-sub .manager-table th:nth-child(1),
#duplicate-expenses-sub .manager-table td:nth-child(1) { width: 74px; }

#expenses-ledger-sub .manager-table th:nth-child(2),
#expenses-ledger-sub .manager-table td:nth-child(2),
#duplicate-expenses-sub .manager-table th:nth-child(2),
#duplicate-expenses-sub .manager-table td:nth-child(2) { width: 36px; }

#expenses-ledger-sub .manager-table th:nth-child(3),
#expenses-ledger-sub .manager-table td:nth-child(3),
#duplicate-expenses-sub .manager-table th:nth-child(3),
#duplicate-expenses-sub .manager-table td:nth-child(3) {
    width: auto;
}

#expenses-ledger-sub .manager-table th:nth-child(4),
#expenses-ledger-sub .manager-table td:nth-child(4),
#duplicate-expenses-sub .manager-table th:nth-child(4),
#duplicate-expenses-sub .manager-table td:nth-child(4) { width: 215px; }

#expenses-ledger-sub .manager-table th:nth-child(5),
#expenses-ledger-sub .manager-table td:nth-child(5),
#duplicate-expenses-sub .manager-table th:nth-child(5),
#duplicate-expenses-sub .manager-table td:nth-child(5) { width: 90px; }

#expenses-ledger-sub .manager-table th:nth-child(6),
#expenses-ledger-sub .manager-table td:nth-child(6) { width: 190px; }

#duplicate-expenses-sub .manager-table th:nth-child(6),
#duplicate-expenses-sub .manager-table td:nth-child(6) { width: 130px; }

#expenses-ledger-sub .expense-actions-cell {
    padding-left: 8px;
    padding-right: 8px;
}

/* Ignored tab â€“ 5 cols: Date | Source | Description | Amount | Actions */
#ignored-expenses-sub .manager-table { table-layout: fixed; }

#ignored-expenses-sub .manager-table th:nth-child(1),
#ignored-expenses-sub .manager-table td:nth-child(1) { width: 74px; }

#ignored-expenses-sub .manager-table th:nth-child(2),
#ignored-expenses-sub .manager-table td:nth-child(2) { width: 36px; }

#ignored-expenses-sub .manager-table th:nth-child(4),
#ignored-expenses-sub .manager-table td:nth-child(4) { width: 90px; }

#ignored-expenses-sub .manager-table th:nth-child(5),
#ignored-expenses-sub .manager-table td:nth-child(5) { width: 130px; }

#expenses-ledger-sub .expense-category-cell,
#ignored-expenses-sub .expense-category-cell,
#duplicate-expenses-sub .expense-category-cell {
    width: 195px;
    min-width: 195px;
    max-width: 195px;
}

#expenses-ledger-sub .expense-actions-row,
#ignored-expenses-sub .expense-actions-row,
#duplicate-expenses-sub .expense-actions-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    flex-wrap: nowrap;
}

#expenses-ledger-sub .expense-actions-row .tax-action-btn,
#ignored-expenses-sub .expense-actions-row .tax-action-btn,
#duplicate-expenses-sub .expense-actions-row .tax-action-btn {
    min-width: 48px;
    text-align: center;
}

.expense-category-filter {
    border-color: rgba(34, 197, 94, 0.28);
}

.expense-category-filter:focus {
    border-color: rgba(34, 197, 94, 0.85);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.expense-source-category {
    color: var(--text-secondary);
    font-size: 0.66rem;
    margin-top: 2px;
}

#expenses-ledger-sub .manager-table th,
#ignored-expenses-sub .manager-table th {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 0.76rem;
}

#expenses-ledger-sub .manager-table td,
#ignored-expenses-sub .manager-table td {
    padding-top: 6px;
    padding-bottom: 6px;
    line-height: 1.22;
    vertical-align: middle;
}

#expenses-ledger-sub .tax-description-cell,
#ignored-expenses-sub .tax-description-cell,
#duplicate-expenses-sub .tax-description-cell {
    max-width: none;
    overflow: hidden;
}

#expenses-ledger-sub .tax-desc-text,
#ignored-expenses-sub .tax-desc-text,
#duplicate-expenses-sub .tax-desc-text {
    white-space: normal;
}

@media (max-width: 1100px) {
    .manual-expense-form {
        grid-template-columns: 1fr 1fr;
    }
}

.tax-description-cell {
    max-width: 400px;
}

.tax-desc-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tax-desc-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tax-desc-text > span:first-child {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tax-desc-category {
    white-space: normal;
    font-style: italic;
    font-weight: 300;
    color: var(--text-secondary);
    font-size: 0.78em;
    margin-top: 2px;
}

.tax-note-icon {
    flex-shrink: 0;
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.22);
    position: relative;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.tax-note-icon:hover:not(.has-note) {
    background: rgba(148, 163, 184, 0.35);
    border-color: rgba(148, 163, 184, 0.45);
}

.tax-note-icon.has-note {
    background: #facc15;
    border-color: #fde047;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.25);
}

.tax-note-icon.has-note::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 5px;
    height: 5px;
    background: #ca8a04;
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.tax-note-description {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-height: 120px;
    overflow: auto;
}

#tax-note-text {
    min-height: 120px;
    resize: vertical;
}


/* Amazon Deletion Styles */
.delete-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.4;
    transition: all 0.2s ease;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
}

.delete-icon-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

.delete-icon-btn.active {
    opacity: 1;
}

.row-deleted-dim {
    opacity: 0.5;
    background: rgba(239, 68, 68, 0.05) !important;
}

.checkbox-container-small input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Clear Search Button Styles */
.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    z-index: 5;
}

.clear-search-btn:hover {
    opacity: 1;
    color: var(--accent);
}

/* Wider Amazon Search Box */
#amazon-search {
    max-width: 400px;
    width: 400px;
}

.search-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.search-wrapper .search-input-pill {
    display: block;
}

/* ── Estimated Tax sub-tab ──────────────────────────────────────────────
   Active UI goal: docs/design-reference/estimated-tax-ui-target.png
   (see docs/design-reference/ESTIMATED_TAX_UI_TARGET.md). Match until done.
   Layout: flexbox only here (no CSS Grid) — cards, table/summary split, payment rows.
   Cache bust: bump `index.html` `/static/index.css?v=` + `main.js?v=` +
   `#est-tax-ui-inline` data-est-tax-ui when changing these rules. */
#estimated-tax-tab > .card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#estimated-tax-tab > .card-header .btn-pill {
    padding: 0.38rem 0.85rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid rgba(15, 23, 42, 0.35);
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: background 0.15s, filter 0.15s;
}
#estimated-tax-tab > .card-header .btn-pill:hover {
    background: #fff;
    filter: brightness(1.02);
}
#estimated-tax-tab {
    color-scheme: dark;
}

#estimated-tax-tab .est-tax-playbook {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.5rem 0 0;
}
#estimated-tax-tab .est-tax-playbook-col {
    flex: 1 1 300px;
    min-width: 240px;
    background: rgba(13, 17, 23, 0.55);
    border: 1px solid rgba(92, 124, 250, 0.14);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    font-size: 0.8rem;
    line-height: 1.45;
}
#estimated-tax-tab .est-tax-playbook-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}
#estimated-tax-tab .est-tax-playbook-title a {
    color: #5c7cfa;
    text-decoration: none;
}
#estimated-tax-tab .est-tax-playbook-title a:hover { text-decoration: underline; }
#estimated-tax-tab .est-tax-playbook-note {
    color: var(--text-secondary, #94a3b8);
    margin-top: 0.2rem;
    word-break: break-word;
}
#estimated-tax-tab .est-tax-playbook-note a {
    color: #5c7cfa;
    text-decoration: none;
}
#estimated-tax-tab .est-tax-playbook-note a:hover { text-decoration: underline; }

#estimated-tax-tab .est-tax-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: stretch;
}
#estimated-tax-tab .est-tax-grid > .est-tax-card {
    flex: 1 1 400px;
    min-width: min(100%, 320px);
}
@media (max-width: 1100px) {
    #estimated-tax-tab .est-tax-grid > .est-tax-card {
        flex: 1 1 100%;
    }
    #estimated-tax-tab .est-tax-playbook-col {
        flex: 1 1 100%;
        min-width: 0;
    }
}

#estimated-tax-tab .est-tax-card {
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
#estimated-tax-tab .est-tax-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.65rem 1rem 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 1rem;
}
#estimated-tax-tab .est-tax-card-title-group {
    display: flex;
    flex-direction: column;
}
#estimated-tax-tab .est-tax-card-title-group h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}
#estimated-tax-tab .est-tax-pay-link {
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1;
    color: #93c5fd;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    opacity: 0.9;
}
#estimated-tax-tab .est-tax-pay-link:hover {
    color: #bfdbfe;
    text-decoration: underline;
    opacity: 1;
}
#tax-prep-overview-tab .est-tax-pay-link {
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1;
    color: #93c5fd;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    opacity: 0.9;
}
#tax-prep-overview-tab .est-tax-pay-link:hover {
    color: #bfdbfe;
    text-decoration: underline;
    opacity: 1;
}
#estimated-tax-tab .est-tax-info-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.15rem;
}
#estimated-tax-tab .est-tax-info-marker {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(147,197,253,0.45);
    background: rgba(59,130,246,0.12);
    color: #bfdbfe;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}
#estimated-tax-tab .est-tax-info-popover {
    position: absolute;
    left: 50%;
    top: calc(100% + 0.55rem);
    transform: translateX(-50%);
    width: min(31rem, 78vw);
    z-index: 30;
    display: none;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(147,197,253,0.28);
    border-radius: 10px;
    background: rgba(15,23,42,0.98);
    color: #e5e7eb;
    box-shadow: 0 18px 44px rgba(0,0,0,0.45);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
}
#estimated-tax-tab .est-tax-info-popover a {
    color: #93c5fd;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
    text-decoration: none;
    opacity: 0.95;
}
#estimated-tax-tab .est-tax-info-edit {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 7px;
    border: 1px solid rgba(147,197,253,0.25);
    background: rgba(59,130,246,0.12);
    color: #bfdbfe;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
#estimated-tax-tab .est-tax-info-edit:hover {
    background: rgba(59,130,246,0.22);
    color: #ffffff;
}
#estimated-tax-tab .est-tax-info-lines {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-right: 1.8rem;
}
#estimated-tax-tab .est-tax-info-wrap:hover .est-tax-info-popover,
#estimated-tax-tab .est-tax-info-wrap:focus-within .est-tax-info-popover {
    display: flex;
}
#estimated-tax-tab .est-tax-info-popover a:hover {
    text-decoration: underline;
}
#estimated-tax-tab .est-tax-card-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #94a3b8);
    margin-top: 0.2rem;
}

#estimated-tax-tab .est-tax-card-main {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 1.15rem 1.25rem;
    padding: 0.85rem 1.05rem 1.05rem;
}
#estimated-tax-tab .est-tax-card-col-table {
    flex: 1 1 0%;
    min-width: 0;
}
#estimated-tax-tab .est-tax-quarterly-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    margin-bottom: 0.55rem;
}
#estimated-tax-tab .est-tax-quarterly-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
    margin: 0;
}
#estimated-tax-tab .est-tax-add-row-btn,
#tax-guide-tab .est-tax-add-row-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.36rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.55);
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    transition: filter 0.15s, box-shadow 0.15s;
}
#estimated-tax-tab .est-tax-add-row-btn:hover,
#tax-guide-tab .est-tax-add-row-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.45);
}

#estimated-tax-tab .est-tax-card-col-summary {
    flex: 0 0 252px;
    flex-shrink: 0;
    width: 252px;
    max-width: 100%;
    min-width: 0;
}
@media (max-width: 560px) {
    #estimated-tax-tab .est-tax-card-main {
        flex-wrap: wrap;
    }
    #estimated-tax-tab .est-tax-card-col-table {
        flex: 1 1 100%;
        width: 100%;
    }
    #estimated-tax-tab .est-tax-card-col-summary {
        flex: 1 1 100%;
        width: 100%;
    }
}
#estimated-tax-tab .est-tax-card-totals {
    background: rgba(13, 17, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.75rem 0.85rem 0.9rem;
    font-size: 0.78rem;
}

#estimated-tax-tab .est-tax-summary-panel-title {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    color: #ffffff;
    line-height: 1.3;
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#estimated-tax-tab .est-tax-summary-columns {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.65rem 0.75rem;
    align-items: stretch;
}
#estimated-tax-tab .est-tax-summary-columns > .est-tax-summary-col {
    flex: 1 1 180px;
    min-width: 0;
}
@media (max-width: 400px) {
    #estimated-tax-tab .est-tax-summary-columns > .est-tax-summary-col {
        flex: 1 1 100%;
    }
}

#estimated-tax-tab .est-tax-summary-col-frame {
    background: rgba(10, 12, 18, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.5rem 0.55rem 0.6rem;
    height: 100%;
    box-sizing: border-box;
}

#estimated-tax-tab .est-tax-summary-col-hdr {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.4rem;
}

#estimated-tax-tab .est-tax-sum-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.22rem 0;
    font-variant-numeric: tabular-nums;
}
#estimated-tax-tab .est-tax-sum-lbl {
    color: #8b9cb8;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
#estimated-tax-tab .est-tax-sum-valbox {
    display: inline-block;
    min-width: 5.5rem;
    padding: 0.2rem 0.35rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    text-align: right;
    box-sizing: border-box;
}
#estimated-tax-tab .est-tax-sum-valbox-paid {
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.4);
}
#estimated-tax-tab .est-tax-sum-line-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}
#estimated-tax-tab .est-tax-sum-sub {
    opacity: 0.75;
    font-weight: 500;
    font-size: 0.62rem;
    color: #94a3b8;
    white-space: nowrap;
}
#estimated-tax-tab .est-tax-sum-line-balance.est-tax-bal-due .est-tax-sum-valbox {
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}
#estimated-tax-tab .est-tax-sum-line-balance.est-tax-bal-over .est-tax-sum-valbox {
    border-color: rgba(147, 197, 253, 0.45);
    color: #dbeafe;
}
#estimated-tax-tab .est-tax-sum-line-balance.est-tax-bal-zero .est-tax-sum-valbox {
    border-color: rgba(52, 211, 153, 0.35);
    color: #bbf7d0;
}
#estimated-tax-tab .est-tax-bal-zero  { color: #4caf7d; }
#estimated-tax-tab .est-tax-bal-due   { color: #f97171; font-weight: 600; }
#estimated-tax-tab .est-tax-bal-over  { color: #93c5fd; font-weight: 600; }

#estimated-tax-tab .est-tax-post-filing {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.45rem;
    margin-top: 0.1rem;
}
#estimated-tax-tab .est-tax-filing-kind {
    flex: 1 1 6.5rem;
    min-width: 0;
    box-sizing: border-box;
    background-color: #0d1117;
    border: 1px solid rgba(92, 124, 250, 0.28);
    border-radius: 8px;
    color: #e8ecf4 !important;
    -webkit-text-fill-color: #e8ecf4;
    font: inherit;
    font-size: 0.76rem;
    padding: 0.34rem 0.48rem;
    outline: none;
    cursor: pointer;
}
#estimated-tax-tab .est-tax-filing-kind:hover,
#estimated-tax-tab .est-tax-filing-kind:focus {
    border-color: rgba(99, 102, 241, 0.55);
    background-color: #111827;
}

#estimated-tax-tab .est-tax-filing-cell {
    flex: 1 1 4.5rem;
    min-width: 0;
    box-sizing: border-box;
    background-color: #0d1117;
    border: 1px solid rgba(92, 124, 250, 0.28);
    border-radius: 8px;
    color: #e8ecf4 !important;
    -webkit-text-fill-color: #e8ecf4;
    font: inherit;
    font-variant-numeric: tabular-nums;
    padding: 0.3rem 0.48rem;
    text-align: right;
    outline: none;
}
#estimated-tax-tab .est-tax-filing-cell:-webkit-autofill,
#estimated-tax-tab .est-tax-filing-cell:-webkit-autofill:hover,
#estimated-tax-tab .est-tax-filing-cell:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0d1117 inset !important;
    -webkit-text-fill-color: #e8ecf4 !important;
    caret-color: #e8ecf4 !important;
    border-color: rgba(92, 124, 250, 0.35) !important;
}
#estimated-tax-tab .est-tax-filing-cell:hover {
    background-color: #131922 !important;
    border-color: rgba(129, 161, 255, 0.35);
}
#estimated-tax-tab .est-tax-filing-cell:focus {
    background-color: #0d1117 !important;
    border-color: rgba(99, 102, 241, 0.65);
}
#estimated-tax-tab .est-tax-filing-cell::-webkit-outer-spin-button,
#estimated-tax-tab .est-tax-filing-cell::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#estimated-tax-tab .est-tax-filing-cell { -moz-appearance: textfield; }
#estimated-tax-tab .est-tax-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Table shell: column of header + body rows (flex, not grid). */
#estimated-tax-tab .est-tax-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}
#estimated-tax-tab .est-tax-grid-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

/* Flex row: Qtr | Due | Est $ | Paid date | Paid $ | Confirmation */
#estimated-tax-tab .est-tax-rows {
    font-size: 0.82rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head,
#estimated-tax-tab .est-tax-cols.est-tax-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.45rem;
    border-bottom: 1px solid rgba(92, 124, 250, 0.08);
    box-sizing: border-box;
    width: 100%;
    /* Keep one line per row; narrow viewports scroll inside .est-tax-table-wrap */
    min-width: 32rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div,
#estimated-tax-tab .est-tax-cols.est-tax-row > div {
    flex-shrink: 0;
    min-width: 0;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div:nth-child(1),
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(1) {
    flex: 0 0 2.65rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div:nth-child(2),
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(2) {
    flex: 0 0 7.85rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div:nth-child(3),
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(3) {
    flex: 0 0 4.1rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(3) input {
    text-align: right;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div:nth-child(4),
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(4) {
    flex: 0 0 7.85rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div:nth-child(5),
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(5) {
    flex: 0 0 4.1rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(5) input {
    text-align: right;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div:nth-child(6),
#estimated-tax-tab .est-tax-cols.est-tax-row > div:nth-child(6) {
    flex: 1 1 4rem;
    min-width: 3rem;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head {
    background: rgba(13, 17, 23, 0.5);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}
#estimated-tax-tab .est-tax-th {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(13, 17, 23, 0.4);
}
#estimated-tax-tab .est-tax-th-amt { text-align: right; }
#estimated-tax-tab .est-tax-c-amt  { text-align: right; }
#estimated-tax-tab .est-tax-row:hover { background: rgba(255,255,255,0.02); }
#estimated-tax-tab .est-tax-row[data-placeholder="1"] {
    background: rgba(255,255,255,0.012);
}
#estimated-tax-tab .est-tax-row[data-placeholder="1"] .est-tax-cell {
    opacity: 0.82;
}
#estimated-tax-tab .est-tax-row[data-placeholder="1"]:hover .est-tax-cell,
#estimated-tax-tab .est-tax-row[data-placeholder="1"] .est-tax-cell:focus {
    opacity: 1;
}

/* Inline cells — #0d1117 + indigo-tint border (matches reference “beautiful” spec). */
#estimated-tax-tab .est-tax-cell {
    background: #0d1117;
    border: 1px solid rgba(92, 124, 250, 0.22);
    color: var(--text-primary, #e5e7eb);
    font: inherit;
    padding: 0 0.45rem;
    border-radius: 8px;
    width: 100%;
    height: 1.85rem;
    line-height: 1.85rem;
    box-sizing: border-box;
    outline: none;
    transition: background 0.12s, border-color 0.12s;
}
#estimated-tax-tab .est-tax-cell:hover {
    background: #131922;
    border-color: rgba(129, 161, 255, 0.32);
}
#estimated-tax-tab .est-tax-cell:focus {
    background: #0d1117;
    border-color: rgba(99, 102, 241, 0.65);
}

/* Win Chrome/Edge: native date + text inputs ignore translucent backgrounds unless
   we pin an opaque background and (for dates) tint the webkit edit fields. */
#estimated-tax-tab input.est-tax-cell,
#estimated-tax-tab select.est-tax-cell {
    background-color: #0d1117 !important;
    color: #e8ecf4 !important;
    -webkit-text-fill-color: #e8ecf4;
}
#estimated-tax-tab input.est-tax-cell::placeholder {
    color: #64748b;
    -webkit-text-fill-color: #64748b;
    opacity: 1;
}
#estimated-tax-tab input.est-tax-cell:-webkit-autofill,
#estimated-tax-tab input.est-tax-cell:-webkit-autofill:hover,
#estimated-tax-tab input.est-tax-cell:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0d1117 inset !important;
    -webkit-text-fill-color: #e8ecf4 !important;
    caret-color: #e8ecf4 !important;
    border-color: rgba(92, 124, 250, 0.35) !important;
    transition: background-color 99999s ease-out;
}
#estimated-tax-tab input[type="date"].est-tax-cell {
    color-scheme: dark;
}
#estimated-tax-tab input[type="date"].est-tax-cell::-webkit-datetime-edit-text,
#estimated-tax-tab input[type="date"].est-tax-cell::-webkit-datetime-edit-month-field,
#estimated-tax-tab input[type="date"].est-tax-cell::-webkit-datetime-edit-day-field,
#estimated-tax-tab input[type="date"].est-tax-cell::-webkit-datetime-edit-year-field {
    color: #e8ecf4;
    -webkit-text-fill-color: #e8ecf4;
}
#estimated-tax-tab input[type="date"].est-tax-cell::-webkit-calendar-picker-indicator {
    opacity: 0.62;
    filter: brightness(0) invert(1) opacity(0.72);
}
#estimated-tax-tab select.est-tax-cell option {
    background: #0d1117;
    color: #e8ecf4;
}
#estimated-tax-tab input.est-tax-cell:hover,
#estimated-tax-tab select.est-tax-cell:hover {
    background-color: #131922 !important;
    border-color: rgba(129, 161, 255, 0.35);
}
#estimated-tax-tab input.est-tax-cell:focus,
#estimated-tax-tab select.est-tax-cell:focus {
    background-color: #0d1117 !important;
    border-color: rgba(99, 102, 241, 0.65);
}

#estimated-tax-tab .est-tax-cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
#estimated-tax-tab .est-tax-cell-num.success { color: #4caf7d; }
#estimated-tax-tab .est-tax-cell-conf {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: #cbd5e1;
}
#estimated-tax-tab .est-tax-cell-quarter {
    font-weight: 600;
    font-size: 0.78rem;
    padding-right: 0.6rem;
    width: 100% !important;
}
#estimated-tax-tab .est-tax-extra-label-cell {
    grid-column: span 3;
}
#estimated-tax-tab .est-tax-extra-spacer {
    display: block;
    min-height: 2rem;
}
/* Amount inputs are now type=text (with inputmode=numeric for mobile),
   so there are no native spinners to hide. */

#estimated-tax-tab .est-tax-num { text-align: right; font-variant-numeric: tabular-nums; }
#estimated-tax-tab .est-tax-dim { color: rgba(148,163,184,0.4); }
#estimated-tax-tab .est-tax-conf {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.74rem;
    color: #cbd5e1;
}
#estimated-tax-tab .est-tax-q-pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
}
#estimated-tax-tab .est-tax-q-pill.est-tax-q-extension,
#estimated-tax-tab .est-tax-q-pill.est-tax-q-final {
    background: rgba(251,191,36,0.15);
    color: #fbbf24;
}
#estimated-tax-tab .est-tax-q-pill.est-tax-q-other,
#estimated-tax-tab .est-tax-q-pill.est-tax-q-refund {
    background: rgba(148,163,184,0.15);
    color: #cbd5e1;
}
#estimated-tax-tab .est-tax-btn-edit,
#estimated-tax-tab .est-tax-btn-del {
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    border: 1px solid rgba(255,255,255,0.12);
    width: 1.6rem; height: 1.6rem;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 0.25rem;
    font-size: 0.85rem;
    line-height: 1;
}
#estimated-tax-tab .est-tax-btn-edit:hover { color: #a5b4fc; border-color: #6366f1; }
#estimated-tax-tab .est-tax-btn-del:hover  { color: #f87171; border-color: #f87171; }

/* Restore Estimated Tax target layout after reset-era rules. */
#estimated-tax-tab .est-tax-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 1.25rem !important;
    align-items: start !important;
}
#estimated-tax-tab .est-tax-grid > .est-tax-card {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
}
#estimated-tax-tab .est-tax-card {
    background:
        linear-gradient(135deg, rgba(59,130,246,0.08), transparent 30%),
        linear-gradient(180deg, rgba(15,23,42,0.90), rgba(15,23,42,0.66)) !important;
    border: 1px solid rgba(148,163,184,0.16) !important;
    border-radius: 12px !important;
}
#estimated-tax-tab .est-tax-card-header {
    padding: 1rem 1rem 0.95rem !important;
    border-bottom: 1px solid rgba(148,163,184,0.12) !important;
}
#estimated-tax-tab .est-tax-card-title-group h3 {
    font-size: 1.08rem !important;
    font-weight: 750 !important;
}
#estimated-tax-tab .est-tax-card-sub {
    display: none !important;
}
#estimated-tax-tab .est-tax-card-title-group h3 {
    align-items: center !important;
    gap: 1rem !important;
}
#estimated-tax-tab .est-tax-pay-link {
    display: inline-flex !important;
    align-items: center !important;
    color: #93c5fd !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    opacity: 0.9 !important;
    white-space: nowrap !important;
    margin-left: 6px !important;
}
#estimated-tax-tab .est-tax-pay-link:hover {
    color: #bfdbfe !important;
    text-decoration: underline !important;
    opacity: 1 !important;
}
#tax-prep-overview-tab .est-tax-pay-link {
    display: inline-flex !important;
    align-items: center !important;
    color: #93c5fd !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    opacity: 0.9 !important;
    white-space: nowrap !important;
    margin-left: 6px !important;
}
#tax-prep-overview-tab .est-tax-pay-link:hover {
    color: #bfdbfe !important;
    text-decoration: underline !important;
    opacity: 1 !important;
}
#tax-prep-overview-tab .est-tax-pay-link:visited {
    color: #93c5fd !important;
}
#estimated-tax-tab .est-tax-info-wrap {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    margin-left: 0.15rem !important;
}
#estimated-tax-tab .est-tax-info-marker {
    width: 1.1rem !important;
    height: 1.1rem !important;
    border-radius: 999px !important;
    border: 1px solid rgba(147,197,253,0.45) !important;
    background: rgba(59,130,246,0.12) !important;
    color: #bfdbfe !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: help !important;
}
#estimated-tax-tab .est-tax-info-popover {
    position: absolute !important;
    left: 50% !important;
    top: calc(100% + 0.55rem) !important;
    transform: translateX(-50%) !important;
    width: min(31rem, 78vw) !important;
    z-index: 30 !important;
    display: none !important;
    flex-direction: column !important;
    gap: 0.45rem !important;
    padding: 0.85rem 0.95rem !important;
    border: 1px solid rgba(147,197,253,0.28) !important;
    border-radius: 10px !important;
    background: rgba(15,23,42,0.98) !important;
    color: #e5e7eb !important;
    box-shadow: 0 18px 44px rgba(0,0,0,0.45) !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    white-space: normal !important;
}
#estimated-tax-tab .est-tax-info-popover a {
    color: #93c5fd !important;
}
#estimated-tax-tab .est-tax-info-edit {
    position: absolute !important;
    top: 0.45rem !important;
    right: 0.45rem !important;
    width: 1.45rem !important;
    height: 1.45rem !important;
    border-radius: 7px !important;
    border: 1px solid rgba(147,197,253,0.25) !important;
    background: rgba(59,130,246,0.12) !important;
    color: #bfdbfe !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}
#estimated-tax-tab .est-tax-info-edit:hover {
    background: rgba(59,130,246,0.22) !important;
    color: #ffffff !important;
}
#estimated-tax-tab .est-tax-info-lines {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.45rem !important;
    padding-right: 1.8rem !important;
}
#estimated-tax-tab .est-tax-info-wrap:hover .est-tax-info-popover,
#estimated-tax-tab .est-tax-info-wrap:focus-within .est-tax-info-popover {
    display: flex !important;
}
#estimated-tax-tab .est-tax-card-main {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    padding: 0.1rem 1rem 1rem !important;
}
#estimated-tax-tab .est-tax-card-col-table,
#estimated-tax-tab .est-tax-card-col-summary {
    flex: 0 0 auto !important;
    width: max-content !important;
    max-width: 100% !important;
}
#estimated-tax-tab .est-tax-card-col-table {
    width: 702px !important;
}
#estimated-tax-tab .est-tax-quarterly-toolbar,
#estimated-tax-tab .est-tax-summary-panel-title {
    height: 50px !important;
    margin: 0 !important;
    padding: 0.65rem 10px !important;
    background: rgba(2,6,23,0.16) !important;
    border-bottom: 1px solid rgba(148,163,184,0.10) !important;
    border-radius: 5px !important;
    box-sizing: border-box !important;
}
#estimated-tax-tab .est-tax-quarterly-toolbar {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: center !important;
    justify-content: stretch !important;
}
#estimated-tax-tab .est-tax-add-row-btn {
    justify-self: end !important;
    margin-left: 0 !important;
}
#estimated-tax-tab .est-tax-quarterly-toolbar button.est-tax-add-row-btn {
    justify-self: end !important;
    margin-left: 0 !important;
}
#estimated-tax-tab button.est-tax-add-row-btn {
    border: 1px solid rgba(59,130,246,0.45) !important;
    border-radius: 999px !important;
    background: rgba(59,130,246,0.16) !important;
    color: #bfdbfe !important;
    box-shadow: none !important;
    padding: 0.35rem 0.75rem !important;
}
#estimated-tax-tab .est-tax-summary-panel-title {
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}
#estimated-tax-tab .est-tax-card-totals {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
}
#estimated-tax-tab .est-tax-summary-columns {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: stretch !important;
    gap: 0 0.75rem !important;
}
#estimated-tax-tab .est-tax-summary-columns > .est-tax-summary-col {
    flex: 0 0 auto !important;
}
#estimated-tax-tab .est-tax-summary-col-frame {
    width: 176px !important;
    min-height: 10.1rem !important;
    padding: 0.72rem 0.75rem !important;
    background: rgba(10,12,18,0.55) !important;
    border: 1px solid rgba(148,163,184,0.16) !important;
    border-radius: 10px !important;
}
#estimated-tax-tab .est-tax-summary-post .est-tax-summary-col-frame {
    width: 232px !important;
}
#estimated-tax-tab .est-tax-summary-col-hdr {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    color: #94a3b8 !important;
    margin-bottom: 0.7rem !important;
}
#estimated-tax-tab .est-tax-sum-line {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.65rem !important;
    padding: 0.32rem 0 !important;
}
#estimated-tax-tab .est-tax-summary-est .est-tax-sum-line {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 80px !important;
    column-gap: 0.65rem !important;
    justify-content: stretch !important;
}
#estimated-tax-tab .est-tax-summary-est .est-tax-sum-lbl {
    min-width: 0 !important;
}
#estimated-tax-tab .est-tax-summary-est .est-tax-sum-line-right {
    grid-column: 2 !important;
    width: 80px !important;
    min-width: 80px !important;
    justify-self: end !important;
    display: flex !important;
    justify-content: flex-end !important;
}
#estimated-tax-tab .est-tax-summary-est .est-tax-sum-valbox {
    grid-column: 2 !important;
    justify-self: end !important;
    margin-left: 0 !important;
}
#estimated-tax-tab .est-tax-sum-lbl {
    color: #94a3b8 !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
}
#estimated-tax-tab .est-tax-sum-valbox,
#estimated-tax-tab .est-tax-filing-cell {
    width: 80px !important;
    min-width: 80px !important;
    height: 2.05rem !important;
}
#estimated-tax-tab .est-tax-sum-valbox {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums !important;
    padding: 0 0.45rem !important;
    background: rgba(15,23,42,0.72) !important;
    border: 1px solid rgba(148,163,184,0.16) !important;
    border-radius: 8px !important;
}
#estimated-tax-tab .est-tax-sum-line-right {
    flex: 0 0 80px !important;
    justify-content: flex-end !important;
}
#estimated-tax-tab .est-tax-filing-kind {
    width: 105px !important;
    flex: 0 0 105px !important;
    height: 2.05rem !important;
}
#estimated-tax-tab .est-tax-post-filing {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    margin: 0 !important;
}
#estimated-tax-tab .est-tax-sum-sub {
    display: none !important;
}
#estimated-tax-tab .est-tax-table,
#estimated-tax-tab .est-tax-rows {
    width: max-content !important;
    min-width: 0 !important;
}
#estimated-tax-tab .est-tax-rows {
    border: 1px solid rgba(148,163,184,0.10) !important;
    border-radius: 11px !important;
    overflow: hidden !important;
    background: rgba(2,6,23,0.18) !important;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head,
#estimated-tax-tab .est-tax-cols.est-tax-row {
    display: grid !important;
    grid-template-columns: 35px 130px 88px 130px 88px 160px !important;
    gap: 0 0.6rem !important;
    width: max-content !important;
    min-width: 0 !important;
    padding: 0.24rem 0.7rem !important;
    align-items: center !important;
    justify-content: start !important;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head {
    background: rgba(15,23,42,0.76) !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    color: #94a3b8 !important;
}
#estimated-tax-tab .est-tax-cols.est-tax-row > div,
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div {
    flex: none !important;
}
#estimated-tax-tab input.est-tax-cell[type="date"] {
    width: 130px !important;
}
#estimated-tax-tab input.est-tax-cell,
#estimated-tax-tab select.est-tax-cell,
#estimated-tax-tab .est-tax-filing-kind,
#estimated-tax-tab .est-tax-filing-cell {
    height: 2.05rem !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(148,163,184,0.16) !important;
    border-radius: 8px !important;
    background: rgba(15,23,42,0.72) !important;
    color: #e5e7eb !important;
    font: inherit !important;
    padding: 0 0.45rem !important;
}
#estimated-tax-tab .est-tax-cell-num {
    width: 88px !important;
    text-align: right !important;
}
#estimated-tax-tab .est-tax-cell-conf {
    width: 160px !important;
}
#estimated-tax-tab input.est-tax-cell[type="date"].est-tax-date-empty:not(:focus),
#estimated-tax-tab input.est-tax-cell[type="date"].est-tax-date-empty:not(:focus)::-webkit-datetime-edit {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
}
#estimated-tax-tab .est-tax-zero-value {
    color: #7c879a !important;
    -webkit-text-fill-color: #7c879a !important;
}
#estimated-tax-tab .est-tax-sum-valbox-paid {
    color: #ffffff !important;
    border-color: rgba(148,163,184,0.16) !important;
}
#estimated-tax-tab .est-tax-filing-cell {
    text-align: right !important;
}
#estimated-tax-tab input.est-tax-cell.est-tax-zero-value,
#estimated-tax-tab .est-tax-filing-cell.est-tax-zero-value {
    color: #7c879a !important;
    -webkit-text-fill-color: #7c879a !important;
}
#estimated-tax-tab input.est-tax-cell[type="date"].est-tax-date-empty:not(:focus)::-webkit-datetime-edit-text,
#estimated-tax-tab input.est-tax-cell[type="date"].est-tax-date-empty:not(:focus)::-webkit-datetime-edit-month-field,
#estimated-tax-tab input.est-tax-cell[type="date"].est-tax-date-empty:not(:focus)::-webkit-datetime-edit-day-field,
#estimated-tax-tab input.est-tax-cell[type="date"].est-tax-date-empty:not(:focus)::-webkit-datetime-edit-year-field {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
}
#estimated-tax-tab input[type="date"].est-tax-cell::-webkit-calendar-picker-indicator {
    opacity: 0.62 !important;
    filter: brightness(0) invert(1) opacity(0.72) !important;
}
#estimated-tax-tab .est-tax-cell-conf::placeholder {
    color: rgba(229,231,235,0.55) !important;
    -webkit-text-fill-color: rgba(229,231,235,0.55) !important;
}
#estimated-tax-tab .est-tax-cols.est-tax-row > div:first-child {
    text-align: center !important;
}
#estimated-tax-tab .est-tax-q-pill {
    display: inline-flex !important;
    justify-content: center !important;
    min-width: 2rem !important;
}
#estimated-tax-tab .est-tax-cols.est-tax-grid-head > div {
    text-align: center !important;
}
@media (max-width: 1100px) {
    #estimated-tax-tab .est-tax-card-main {
        flex-wrap: wrap !important;
    }
}
/* Modal — reuse the dark-theme look from the rest of the app */
.est-tax-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.est-tax-modal {
    background: var(--bg-secondary, #1a1f2e);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.est-tax-modal .modal-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: space-between;
}
.est-tax-modal .modal-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.est-tax-modal .modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
}
.est-tax-modal .modal-close:hover { color: #f87171; }
.est-tax-modal-body {
    padding: 1rem 1.1rem;
    overflow-y: auto;
    flex: 1;
}
.est-tax-modal .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.est-tax-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.78rem;
}
.est-tax-modal .form-group > span {
    color: var(--text-secondary, #94a3b8);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.est-tax-modal .form-group input,
.est-tax-modal .form-group select,
.est-tax-modal .form-group textarea {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    color: var(--text-primary, #e5e7eb);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}
.est-tax-modal .form-group input:focus,
.est-tax-modal .form-group select:focus,
.est-tax-modal .form-group textarea:focus {
    border-color: var(--accent, #6366f1);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.est-tax-modal .modal-footer {
    padding: 0.75rem 1.1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; justify-content: flex-end; gap: 0.5rem;
}
.est-tax-modal .btn-pill-primary {
    background: var(--accent, #6366f1);
    color: white;
    border-color: var(--accent, #6366f1);
}
.est-tax-modal .btn-pill-primary:hover { filter: brightness(1.1); }

/* ── Check register datasheet ─────────────────────────────────────────────── */
#checks-tab .checks-register-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
#checks-tab .checks-register-filter-label:hover {
    color: var(--text-primary);
}
#checks-tab .checks-register-filter-label .checkbox-input {
    margin: 0;
    cursor: pointer;
}
#checks-tab .checks-register-body {
    padding: 0 !important;
    overflow: auto;
    max-height: calc(100vh - 220px);
}
#checks-tab .check-register-table-wrap {
    width: 100%;
    min-width: 920px;
    overflow-x: auto;
}
#checks-tab .check-register-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 0;
}
#checks-tab .check-register-table .col-check-num { width: 88px; }
#checks-tab .check-register-table .col-check-date { width: 128px; }
#checks-tab .check-register-table .col-pay-to { width: auto; }
#checks-tab .check-register-table .col-amount { width: 108px; }
#checks-tab .check-register-table .col-notes { width: 20%; min-width: 130px; }
#checks-tab .check-register-table .col-void { width: 52px; }
#checks-tab .check-register-table .col-actions { width: 48px; }
#checks-tab .check-register-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(6px);
    padding: 0.5rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}
#checks-tab .check-register-th-sort {
    cursor: pointer;
    user-select: none;
}
#checks-tab .check-register-th-sort:hover {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.08);
}
#checks-tab .check-register-table tbody td.check-register-col {
    padding: 0.28rem 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
#checks-tab .check-register-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}
#checks-tab .check-register-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}
#checks-tab tr.check-register-row.void-check .check-register-input {
    text-decoration: line-through;
    text-decoration-color: rgba(148, 163, 184, 0.75);
    color: rgba(148, 163, 184, 0.52);
}
#checks-tab tr.check-register-row.void-check .check-register-input::placeholder {
    color: rgba(148, 163, 184, 0.32);
}
#checks-tab tr.check-register-row.void-check .check-register-void-badge {
    text-decoration: none;
}
#checks-tab .check-register-col-void,
#checks-tab .check-register-th-void {
    text-align: center;
}
#checks-tab .check-register-void-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #991b1b;
    background: rgba(254, 226, 226, 0.35);
    border: 1px solid rgba(153, 27, 27, 0.35);
    border-radius: 4px;
    padding: 0.12rem 0.35rem;
    line-height: 1.2;
}
#check-register-edit-modal .check-edit-void-label-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
#check-register-edit-modal .check-edit-void-label-disabled .check-field-void {
    cursor: not-allowed;
}
#checks-tab .check-register-col-actions {
    text-align: center;
}
/* Shared text/date control styling */
#checks-tab .check-register-input {
    display: block;
    width: 100%;
    min-height: 32px;
    box-sizing: border-box;
    margin: 0;
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(8, 15, 32, 0.72);
    color: var(--text-primary, #e2e8f0);
    font-size: 0.84rem;
    font-family: inherit;
    line-height: 1.25;
    color-scheme: dark;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
#checks-tab .check-register-input::placeholder {
    color: rgba(148, 163, 184, 0.45);
    font-style: italic;
}
#checks-tab .check-register-input:hover:not(:focus) {
    border-color: rgba(148, 163, 184, 0.38);
    background: rgba(10, 18, 38, 0.85);
}
#checks-tab .check-register-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.65);
    background: rgba(12, 20, 42, 0.95);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.22);
}
#checks-tab .check-register-input-check-number {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.02em;
    max-width: 5.5rem;
    margin-inline: auto;
}
#checks-tab .check-register-input-check-date {
    font-size: 0.8rem;
    padding-inline: 0.4rem;
}
#checks-tab input.check-register-input-check-date::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.35);
    cursor: pointer;
}
#checks-tab .check-register-input-pay-to {
    font-weight: 500;
}
#checks-tab .check-register-input-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-style: normal;
}
#checks-tab .check-register-input-amount::placeholder {
    font-style: normal;
}
#checks-tab .check-register-input-check-memo {
    font-size: 0.8rem;
    color: rgba(226, 232, 240, 0.92);
}
#checks-tab .check-register-col-check-number {
    text-align: center;
}
#checks-tab .check-register-check-num-wrap {
    position: relative;
}
#checks-tab .check-register-linked-dot {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
    pointer-events: auto;
    cursor: default;
    z-index: 1;
}
#checks-tab .check-register-suggest-link-btn {
    position: absolute;
    top: 3px;
    right: 4px;
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(239, 68, 68, 0.72);
    background: rgba(127, 29, 29, 0.35);
    color: #f87171;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#checks-tab .check-register-suggest-link-btn:hover {
    border-color: rgba(252, 165, 165, 0.9);
    color: #fecaca;
    background: rgba(239, 68, 68, 0.22);
}
#checks-tab tr.check-register-row.void-check .check-register-suggest-link-btn {
    text-decoration: none;
}
.monarch-link-picker-row-preferred {
    border-color: rgba(52, 211, 153, 0.55) !important;
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35);
}
#checks-tab .check-register-th-amount,
#checks-tab .check-register-col-amount {
    text-align: right;
}
#checks-tab .check-register-delete-btn {
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem;
    opacity: 0.45;
}
#checks-tab .check-register-delete-btn:hover {
    opacity: 1;
    color: #f87171;
}
#checks-tab tr.check-register-row.check-register-row-highlight {
    outline: 2px solid rgba(99, 102, 241, 0.55);
    outline-offset: -1px;
}
#checks-tab tr.check-register-row.check-register-row-highlight td {
    background: rgba(99, 102, 241, 0.22) !important;
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.55);
}

/* Monarch link picker — modal shell */
#monarch-tx-link-picker .monarch-tx-link-picker-content {
    max-width: 560px;
    width: min(560px, calc(100vw - 32px));
    position: relative;
}

#monarch-tx-link-picker .modal-content.is-assigning {
    pointer-events: none;
}

.monarch-tx-link-busy {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.84);
    backdrop-filter: blur(2px);
    border-radius: inherit;
}

.monarch-tx-link-busy-inner {
    text-align: center;
    padding: 1.25rem 1.5rem;
    max-width: 300px;
}

.monarch-tx-link-busy-text {
    margin-top: 0.65rem;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.monarch-link-picker-row-working {
    border-color: rgba(99, 102, 241, 0.65) !important;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

body.monarch-tx-assign-busy {
    cursor: wait;
}

#license-details-modal .license-monarch-link-busy {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.4;
}

#license-details-modal .license-monarch-link-helper.is-assigning {
    border-color: rgba(96, 165, 250, 0.5);
}
#monarch-tx-link-picker .monarch-tx-link-picker-content-check {
    max-width: 830px;
    width: min(960px, calc(100vw - 32px));
}
#monarch-tx-link-picker .monarch-tx-link-picker-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
#monarch-tx-link-picker .monarch-tx-link-picker-list {
    max-height: min(52vh, 420px);
    overflow: auto;
    padding-right: 0.25rem;
}
#monarch-tx-link-picker .monarch-tx-link-picker-help {
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 8px;
    background: rgba(30, 64, 175, 0.12);
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}
#monarch-tx-link-picker .monarch-tx-link-picker-help strong {
    color: var(--text-primary);
}
#monarch-tx-link-picker .monarch-link-picker-section-label {
    margin: 0.7rem 0 0.35rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
#monarch-tx-link-picker .monarch-link-picker-section-label:first-child {
    margin-top: 0;
}
#monarch-tx-link-picker .monarch-link-picker-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    align-items: center;
}
#monarch-tx-link-picker .monarch-link-picker-kind {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 0.3rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
#monarch-tx-link-picker .monarch-link-picker-kind-existing {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
    border: 1px solid rgba(134, 239, 172, 0.26);
}
#monarch-tx-link-picker .monarch-link-picker-kind-virtual {
    background: rgba(245, 158, 11, 0.16);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.28);
}
#monarch-tx-link-picker .monarch-link-picker-action {
    color: #93c5fd;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}
#monarch-tx-link-picker .monarch-tx-link-picker-content-check .monarch-tx-link-picker-list {
    max-height: min(62vh, 520px);
}

/* Monarch link picker — transaction summary (top) */
.monarch-tx-link-picker-summary {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    background: rgba(15, 23, 42, 0.55);
}
.monarch-tx-link-picker-top {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.monarch-tx-link-picker-top-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.monarch-tx-link-picker-title-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    font-size: 0.95rem;
    line-height: 1.2;
}
img.monarch-tx-link-picker-title-logo {
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}
.monarch-tx-link-picker-bank-name {
    font-weight: 700;
}
.monarch-tx-link-picker-data-rows {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    font-size: 0.84rem;
}
.monarch-tx-link-picker-data-row {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}
.monarch-tx-link-picker-data-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 4.2rem;
    flex-shrink: 0;
}
.monarch-tx-link-picker-status {
    font-size: 0.78rem;
    font-weight: 600;
}
.monarch-tx-link-picker-status-cleared {
    color: #34d399 !important;
}
.monarch-tx-link-picker-status-pending {
    color: #f59e0b;
}
.monarch-tx-link-picker-days-from-check {
    margin-left: 0.45rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(52, 211, 153, 0.82);
    white-space: nowrap;
}
.monarch-tx-link-picker-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.monarch-tx-link-picker-amount.expense {
    color: #f87171;
}
.monarch-tx-link-picker-amount.success {
    color: #34d399;
}
.monarch-tx-link-picker-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

/* Check register picker rows — paper check styling */
.monarch-link-picker-check-item {
    width: 100%;
    margin-bottom: 0.85rem;
}
.monarch-link-picker-check-item-preferred .check-face {
    box-shadow:
        0 0 0 2px rgba(52, 211, 153, 0.65),
        0 4px 14px rgba(0, 0, 0, 0.32),
        inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}
.check-register-link-btn {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 0.42rem 0.72rem;
    border: none;
    border-radius: 6px;
    background: linear-gradient(180deg, #34d399 0%, #059669 100%);
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    line-height: 1.2;
}
#monarch-tx-link-picker .check-register-link-btn {
    padding: 12px 1.25rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: normal;
    line-height: 1.25;
    min-height: 44px;
    box-sizing: border-box;
}
#monarch-tx-link-picker .check-top-center {
    align-items: center;
}
.check-register-link-btn:hover {
    background: linear-gradient(180deg, #4ade80 0%, #10b981 100%);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.45);
}
.check-register-link-btn:active {
    transform: translateY(1px);
}
.check-register-picker-check .check-face {
    position: relative;
    padding: 0.75rem 0.9rem 0.55rem;
    border-radius: 3px;
    border: 2px solid #1e4a7a;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 58%),
        linear-gradient(180deg, #e8f4fc 0%, #d4eaf8 52%, #e8f4fc 100%);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.75);
    color: #111827;
    font-family: Arial, Helvetica, sans-serif;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.check-register-picker-check .check-face::before {
    content: '';
    position: absolute;
    inset: 8% 12%;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        rgba(30, 74, 122, 0.04) 0 2px,
        transparent 2px 6px
    );
    pointer-events: none;
    z-index: 0;
}
.check-register-picker-check .check-top,
.check-register-picker-check .check-pay-row,
.check-register-picker-check .check-amount-words-line,
.check-register-picker-check .check-bottom,
.check-register-picker-check .check-micr-line {
    position: relative;
    z-index: 1;
}
.check-register-picker-check .check-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.check-register-picker-check .check-drawer-block {
    display: flex;
    align-items: flex-start;
    gap: 0;
    flex-shrink: 0;
}
.check-register-picker-check .check-madden-monogram {
    display: block;
    flex-shrink: 0;
    font-family: 'Pinyon Script', 'Great Vibes', 'Segoe Script', cursive;
    font-size: 2.85rem;
    font-weight: 400;
    line-height: 1;
    color: #1e4a7a;
    margin-right: 0.5rem;
    padding-top: 0.12rem;
    user-select: none;
}
.check-register-picker-check .check-drawer {
    font-size: 0.62rem;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #111827;
}
.check-register-picker-check .check-drawer-name {
    font-size: 0.68rem;
    margin-bottom: 0.08rem;
}
.check-register-picker-check .check-top-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 0.35rem;
}
.check-register-picker-check .check-top-right {
    text-align: right;
    flex-shrink: 0;
    min-width: 7.5rem;
}
.check-register-picker-check .check-top-right .check-amount-box {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin-top: 0.4rem;
    margin-left: auto;
}
.check-register-picker-check .check-number-top {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
    margin-bottom: 0.35rem;
}
.check-register-picker-check .check-date-row {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.45rem;
}
.check-register-picker-check .check-date-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4b5563;
    line-height: 1.2;
    padding-bottom: 0.22rem;
    flex-shrink: 0;
}
.check-register-picker-check .check-date-value {
    min-width: 5.5rem;
    border-bottom: 1px solid #111827;
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #111827;
    text-align: left;
    padding-bottom: 0.05rem;
    line-height: 1.25;
}
.check-register-picker-check .check-pay-row {
    margin-bottom: 0.45rem;
}
.check-register-picker-check .check-amount-words-line {
    margin-bottom: 0.65rem;
    padding-bottom: 0.18rem;
    border-bottom: 1px solid #111827;
    min-height: 1.45rem;
}
.check-register-picker-check .check-amount-words {
    display: block;
    font-family: 'Great Vibes', 'Segoe Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 1.35rem;
    font-weight: 400;
    color: #1e3a5f;
    line-height: 1.35;
    letter-spacing: 0.01em;
}
.check-register-picker-check .check-pay-line {
    width: 100%;
    min-width: 0;
}
.check-register-picker-check .check-pay-label {
    display: block;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin-bottom: 0.15rem;
}
.check-register-picker-check .check-pay-value {
    display: block;
    min-height: 1.15rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-bottom: 1px solid #111827;
    padding-bottom: 0.12rem;
    line-height: 1.25;
}
.check-register-picker-check .check-amount-box {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    border: 2px solid #111827;
    padding: 0.18rem 0.45rem;
    min-width: 5.5rem;
    background: rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
}
.check-register-picker-check .check-amount-symbol {
    font-size: 0.95rem;
    font-weight: 700;
}
.check-register-picker-check .check-amount-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}
.check-register-picker-check .check-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}
.check-register-picker-check .check-memo-line {
    flex: 1;
    min-width: 0;
    max-width: 55%;
}
.check-register-picker-check .check-memo-label {
    display: block;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin-bottom: 0.12rem;
}
.check-register-picker-check .check-memo-value {
    display: block;
    min-height: 1rem;
    font-size: 0.78rem;
    border-bottom: 1px solid #111827;
    padding-bottom: 0.1rem;
}
.check-register-picker-check .check-signature-block {
    flex-shrink: 0;
    width: 11.5rem;
    text-align: right;
    position: relative;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.check-register-picker-check .check-fake-signature {
    display: block;
    width: 100%;
    text-align: right;
    position: relative;
    top: 10px;
    left: -8px;
    font-family: 'Great Vibes', 'Segoe Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 1.55rem;
    font-weight: 400;
    color: #1e3a5f;
    line-height: 1;
    margin-bottom: 0.08rem;
    transform: rotate(-4deg);
    white-space: nowrap;
}
.check-register-picker-check .check-signature-rule {
    display: block;
    width: 100%;
    border-bottom: 1px solid #111827;
    margin-bottom: 0.12rem;
}
.check-register-picker-check .check-signature-caption {
    display: block;
    width: 100%;
    white-space: nowrap;
    text-align: right;
    font-size: 0.48rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4b5563;
}
.check-register-picker-check .check-top-right .check-status-stamp {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    border: 2px solid currentColor;
    transform: rotate(-7deg);
    line-height: 1.2;
}
.check-register-picker-check .check-status-stamp-suggested {
    color: #166534;
    background: rgba(220, 252, 231, 0.92);
}
.check-register-picker-check .check-void-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    align-items: center;
    justify-content: center;
}
.check-register-picker-check-void .check-void-overlay {
    display: flex;
}
.check-register-picker-check .check-void-overlay-stamp {
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(2rem, 8vw, 3.25rem);
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(153, 27, 27, 0.52);
    border: 0.2rem solid rgba(153, 27, 27, 0.58);
    padding: 0.2rem 1.35rem;
    border-radius: 0.2rem;
    transform: rotate(-28deg);
    box-shadow: 0 0 0 0.12rem rgba(153, 27, 27, 0.18);
    background: rgba(254, 226, 226, 0.28);
    line-height: 1.1;
    user-select: none;
}
.check-register-picker-check-void .check-face {
    opacity: 0.78;
}
.check-register-picker-check-void .check-pay-value,
.check-register-picker-check-void .check-amount-value,
.check-register-picker-check-void .check-amount-words,
.check-register-picker-check-void .check-memo-value,
.check-register-picker-check-void .check-fake-signature {
    text-decoration: line-through;
    text-decoration-color: rgba(17, 24, 39, 0.45);
}
.check-register-picker-check .check-micr-line {
    margin-top: 0.1rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(17, 24, 39, 0.2);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    color: rgba(17, 24, 39, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.check-register-picker-check .monarch-tx-link-picker-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}
.monarch-tx-link-picker-tag {
    font-size: 0.72rem;
    background: rgba(99, 102, 241, 0.18);
    color: #818cf8;
    border-radius: 999px;
    padding: 2px 8px;
}
.monarch-tx-link-picker-notes {
    margin-top: 0.55rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.35;
}

/* Check register — read-only cells open paper-check editor */
#checks-tab .check-register-open-cell {
    cursor: pointer;
}
#checks-tab .check-register-open-cell:hover {
    background: rgba(99, 102, 241, 0.1) !important;
}
#checks-tab .check-register-cell-value {
    display: block;
    width: 100%;
    min-height: 1.35rem;
    line-height: 1.35;
    color: var(--text-primary);
    font-size: 0.84rem;
}
#checks-tab .check-register-cell-empty {
    color: rgba(148, 163, 184, 0.45);
    font-style: italic;
}
#checks-tab .check-register-col-check-number .check-register-cell-value {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    padding-right: 1.1rem;
}
#checks-tab .check-register-cell-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
#checks-tab .check-register-cell-pay-to {
    font-weight: 500;
}
#checks-tab .check-register-cell-memo {
    font-size: 0.8rem;
    color: rgba(226, 232, 240, 0.88);
}
#checks-tab tr.check-register-row.void-check .check-register-cell-value {
    text-decoration: line-through;
    text-decoration-color: rgba(148, 163, 184, 0.75);
    color: rgba(148, 163, 184, 0.52);
}

/* Check register — paper check edit modal */
#check-register-edit-modal .check-register-edit-modal-content {
    max-width: 830px;
    width: min(960px, calc(100vw - 32px));
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
}
#check-register-edit-modal .check-register-edit-body {
    padding: 0;
}
#check-register-edit-modal .check-register-edit-flip-viewport {
    position: relative;
    perspective: 1800px;
    overflow: hidden;
}
#check-register-edit-modal .check-register-edit-flip-page {
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transition: transform 420ms cubic-bezier(0.45, 0.05, 0.2, 1), opacity 280ms ease;
    will-change: transform, opacity;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-active {
    pointer-events: none;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-active .check-register-edit-flip-page-in {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-forward .check-register-edit-flip-page-in {
    transform: rotateY(82deg) translateX(8%);
    opacity: 0;
    transform-origin: right center;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-forward.check-register-flip-run .check-register-edit-flip-page-out {
    transform: rotateY(-82deg) translateX(-8%);
    opacity: 0;
    transform-origin: left center;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-forward.check-register-flip-run .check-register-edit-flip-page-in {
    transform: rotateY(0deg);
    opacity: 1;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-back .check-register-edit-flip-page-in {
    transform: rotateY(-82deg) translateX(-8%);
    opacity: 0;
    transform-origin: left center;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-back.check-register-flip-run .check-register-edit-flip-page-out {
    transform: rotateY(82deg) translateX(8%);
    opacity: 0;
    transform-origin: right center;
}
#check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-back.check-register-flip-run .check-register-edit-flip-page-in {
    transform: rotateY(0deg);
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    #check-register-edit-modal .check-register-edit-flip-page {
        transition: opacity 180ms ease;
    }
    #check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-run .check-register-edit-flip-page-out {
        transform: none;
        opacity: 0;
    }
    #check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-forward .check-register-edit-flip-page-in,
    #check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-back .check-register-edit-flip-page-in {
        transform: none;
        opacity: 0;
    }
    #check-register-edit-modal .check-register-edit-flip-viewport.check-register-flip-run .check-register-edit-flip-page-in {
        transform: none;
        opacity: 1;
    }
}
#check-register-edit-modal .check-register-edit-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
    padding: 0 0.15rem;
}
#check-register-edit-modal .check-register-edit-nav {
    display: flex;
    gap: 0.5rem;
}
#check-register-edit-modal .check-register-edit-nav-btn {
    min-width: 6.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}
#check-register-edit-modal .check-register-edit-nav-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}
#check-register-edit-modal .check-register-edit-save-row {
    display: flex;
    gap: 0.65rem;
    margin-left: auto;
}
#check-register-edit-modal .check-register-edit-save-row .btn-cancel-full,
#check-register-edit-modal .check-register-edit-save-row .btn-save-full {
    flex: 0 0 auto;
    min-width: 6.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}
#check-register-edit-modal .check-register-edit-dirty-hint {
    flex: 1 1 100%;
    order: 3;
    margin: 0;
    font-size: 0.82rem;
    color: #fbbf24;
    text-align: center;
}
#check-register-edit-modal .check-register-picker-check .check-bottom {
    align-items: flex-start;
}
#check-register-edit-modal .check-register-picker-check .check-signature-block {
    align-self: flex-start;
}
#check-register-edit-modal .check-register-picker-check {
    width: 100%;
}
#check-register-edit-modal .check-register-picker-check-editable .check-field-input {
    box-sizing: border-box;
    border: 1px solid rgba(30, 74, 122, 0.38);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.62);
    color: #111827;
    padding: 0.32rem 0.5rem;
    margin: 0;
    width: 100%;
    min-width: 0;
    outline: none;
    box-shadow:
        inset 0 1px 2px rgba(30, 74, 122, 0.07),
        0 1px 0 rgba(255, 255, 255, 0.55);
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.25;
}
#check-register-edit-modal .check-field-input::placeholder {
    color: rgba(55, 65, 81, 0.45);
    font-style: italic;
}
#check-register-edit-modal .check-field-input:focus {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(30, 74, 122, 0.72);
    box-shadow:
        0 0 0 2px rgba(30, 74, 122, 0.16),
        inset 0 1px 2px rgba(30, 74, 122, 0.05);
}
#check-register-edit-modal .check-register-picker-check .check-pay-amount-row {
    display: flex;
    align-items: flex-end;
    gap: 0;
    width: 100%;
}
#check-register-edit-modal .check-pay-amount-row .check-amount-inline {
    margin-left: auto;
    float: right;
    flex-shrink: 0;
}
#check-register-edit-modal input.check-field-input.check-field-pay-to {
    width: 570px;
    flex-shrink: 0;
}
#check-register-edit-modal .check-pay-to-autocomplete-wrap {
    position: relative;
    flex-shrink: 0;
    width: 570px;
}
#check-register-edit-modal .check-pay-to-autocomplete-wrap .check-field-pay-to {
    width: 100%;
    display: block;
}
#check-register-edit-modal .check-pay-to-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 11rem;
    overflow-y: auto;
    border: 1px solid rgba(30, 74, 122, 0.42);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    padding: 0.28rem;
}
#check-register-edit-modal .check-pay-to-suggestion {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #111827;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    padding: 0.42rem 0.55rem;
    cursor: pointer;
}
#check-register-edit-modal .check-pay-to-suggestion:hover,
#check-register-edit-modal .check-pay-to-suggestion.is-active {
    background: rgba(30, 74, 122, 0.1);
}
#check-register-edit-modal .check-pay-to-suggestion-mark {
    background: rgba(251, 191, 36, 0.35);
    color: inherit;
    font-weight: 700;
    padding: 0;
}
#check-register-edit-modal .check-register-picker-check .check-pay-line {
    width: 100%;
}
#check-register-edit-modal .check-register-picker-check .check-memo-line {
    flex: 1;
    min-width: 0;
    max-width: 72%;
}
#check-register-edit-modal input.check-field-input.check-field-check-number {
    width: 100px;
    margin-bottom: 5px;
}
#check-register-edit-modal .check-field-check-number {
    display: block;
    text-align: right;
    padding: 0.28rem 0.4rem;
    margin-left: auto;
    letter-spacing: 0.02em;
}
#check-register-edit-modal .check-field-check-date {
    min-width: 5.5rem;
    width: auto;
    font-variant-numeric: tabular-nums;
    text-align: left;
    padding: 0.28rem 0.4rem;
}
#check-register-edit-modal .check-field-check-date::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
}
#check-register-edit-modal .check-field-pay-to {
    display: block;
    min-height: auto;
    padding: 0.28rem 0.4rem;
}
#check-register-edit-modal .check-register-picker-check .check-pay-row {
    margin-top: -15px;
}
#check-register-edit-modal .check-amount-inline {
    display: block;
    position: relative;
    margin-top: 0;
    width: 150px;
    flex-shrink: 0;
}
#check-register-edit-modal .check-void-overlay-stamp {
    font-size: 5rem;
}
#check-register-edit-modal .check-register-picker-check .check-amount-words {
    display: block;
    font-family: 'Great Vibes', 'Segoe Script', 'Brush Script MT', cursive;
    font-size: 1.35rem;
    color: #1e3a5f;
    line-height: 1.35;
    margin-left: 10px;
    margin-top: 12px;
}
#check-register-edit-modal .check-amount-inline .check-amount-symbol {
    position: absolute;
    left: 0.45rem;
    top: calc(50% + 6px);
    transform: translateY(-50%);
    font-size: 1.05rem;
    font-weight: 400;
    font-family: Arial, Helvetica, sans-serif;
    color: #111827;
    pointer-events: none;
    line-height: 1;
}
#check-register-edit-modal .check-amount-inline .check-field-amount {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.32rem 0.5rem 0.32rem 1.25rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
#check-register-edit-modal .check-field-check-memo {
    display: block;
    width: 100%;
    padding: 0.28rem 0.4rem;
}
#check-register-edit-modal .check-register-picker-check .check-madden-monogram {
    margin-right: 1rem;
}
#check-register-edit-modal .check-micr-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: 0.1rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(17, 24, 39, 0.2);
}
#check-register-edit-modal .check-micr-footer-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 100%;
    min-width: 0;
}
#check-register-edit-modal .check-micr-row .check-micr-line {
    flex: 0 1 auto;
    min-width: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
#check-register-edit-modal .check-micr-row .check-edit-void-label {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 0;
    margin-left: 0;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #991b1b;
    cursor: pointer;
    user-select: none;
}
#check-register-edit-modal .check-field-void {
    width: 14px;
    height: 14px;
    margin-right: 3px;
    accent-color: #991b1b;
    cursor: pointer;
}
#check-register-edit-modal .check-register-picker-check-void .check-field-input:not(.check-field-void),
#check-register-edit-modal .check-register-picker-check-void .check-amount-words {
    text-decoration: line-through;
    text-decoration-color: rgba(17, 24, 39, 0.45);
}

.assign-payment-modal-content {
    width: min(94vw, 520px);
}

.assign-payment-summary {
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    background: rgba(37, 99, 235, 0.08);
}

.assign-payment-summary-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.assign-payment-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.assign-payment-form .form-row {
    align-items: flex-start;
}

.assign-existing-panel {
    padding: 0.9rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.35);
}

.assign-existing-panel-title {
    color: var(--text-primary);
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
}

.assign-existing-panel-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.assign-existing-panel-copy {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.assign-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
}

.assign-checkbox-row input {
    accent-color: var(--accent);
}

.assign-payment-footer {
    margin-top: 0.5rem;
}

.monarch-tx-rename-all-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 9px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.monarch-tx-rename-all-wrap:hover {
    border-color: rgba(99, 102, 241, 0.32);
    background: rgba(15, 23, 42, 0.6);
}

.monarch-tx-rename-all-wrap input {
    margin-top: 0.2rem;
    accent-color: #818cf8;
    cursor: pointer;
    flex-shrink: 0;
}

.monarch-tx-rename-match-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding-top: 0.15rem;
}

.monarch-tx-rename-match-row {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.monarch-tx-rename-match-row label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Unified save/cancel actions across modal-style screens. */
.modal-actions,
.modal-footer-actions,
.schedule-settings-actions,
.billing-note-modal__actions,
.billing-sms-modal__actions,
.billing-dev-info-modal__footer,
.license-modal-actions,
.est-tax-modal .modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0.75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.btn-save-full,
.modal-actions #confirm-ok,
.modal-actions #confirm-save,
.schedule-settings-actions .btn-save-full,
.billing-note-btn--primary,
.billing-sms-btn--primary,
.est-tax-modal .modal-footer .btn-pill-primary {
    flex: 0 0 auto !important;
    min-width: 8.5rem !important;
    border: 1px solid rgba(134, 239, 172, 0.42) !important;
    background: linear-gradient(180deg, #22c55e, #15803d) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 12px 24px rgba(21, 128, 61, 0.25) !important;
}

.btn-cancel-full,
.modal-actions #confirm-cancel,
.schedule-settings-actions .btn-cancel-full,
.billing-note-btn--ghost,
.billing-sms-btn--ghost,
.est-tax-modal .modal-footer .btn-pill:not(.btn-pill-primary) {
    flex: 0 0 auto !important;
    min-width: 7.5rem !important;
    border: 1px solid rgba(252, 165, 165, 0.32) !important;
    background: linear-gradient(180deg, #ef4444, #991b1b) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 12px 24px rgba(153, 27, 27, 0.24) !important;
}

#confirm-modal.confirm-modal--centered #confirm-title {
    display: block;
    width: 100%;
    text-align: center;
}

#confirm-modal.confirm-modal--centered #confirm-message {
    text-align: center;
    margin-bottom: 1.5rem;
}

#confirm-modal.confirm-modal--centered .modal-actions {
    justify-content: center !important;
}

.modal-actions #confirm-ok,
.modal-actions #confirm-save,
.modal-actions #confirm-cancel {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    padding: 0.55rem 1.2rem !important;
    min-width: 7.5rem !important;
    min-height: 40px !important;
    height: 40px !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

.modal-actions #confirm-save::before,
.billing-note-btn--primary::before,
.est-tax-modal .modal-footer .btn-pill-primary::before {
    content: "💾 ";
}

.modal-actions #confirm-cancel::before,
.billing-note-btn--ghost::before,
.est-tax-modal .modal-footer .btn-pill:not(.btn-pill-primary)::before {
    content: "❌ ";
}

#edit-license-form {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    align-items: stretch !important;
}

#license-details-modal .license-modal-actions {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 10px !important;
    margin-top: 1.2rem !important;
    width: 100% !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
}

#license-details-modal .license-modal-actions .btn-save-full,
#license-details-modal .license-modal-actions .btn-cancel-full,
#license-details-modal .license-modal-actions .btn-close-dirty-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    padding: 0.55rem 1.2rem;
    min-width: 7.5rem;
    min-height: 40px;
    height: 40px;
    line-height: 1;
    box-sizing: border-box;
}

#account-details-modal .modal-footer-actions .btn-save-full,
#account-details-modal .modal-footer-actions .btn-cancel-full,
#account-details-modal .modal-footer-actions .btn-close-dirty-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    padding: 0.55rem 1.2rem !important;
    min-width: 7.5rem !important;
    min-height: 40px !important;
    height: 40px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
}

/* Base styles for the dynamic Close/Cancel button */
.btn-close-dirty-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    font-size: 0.94rem !important;
    font-weight: 800 !important;
    border-radius: 8px !important;
    padding: 12px 18px !important;
    flex: 0 0 auto !important;
    min-width: 7.5rem !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
}

/* Neutral/Clean Close style */
.btn-close-dirty-toggle.btn-close-style {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--card-border) !important;
    box-shadow: none !important;
}
.btn-close-dirty-toggle.btn-close-style:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Red/Dirty Cancel style */
.btn-close-dirty-toggle.btn-cancel-style {
    border: 1px solid rgba(252, 165, 165, 0.32) !important;
    background: linear-gradient(180deg, #ef4444, #991b1b) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 24px rgba(153, 27, 27, 0.24) !important;
}
.btn-close-dirty-toggle.btn-cancel-style:hover {
    filter: brightness(1.1) !important;
}

#manual-expense-modal .manual-expense-actions {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
}

/* ── PayPal Autopays ──────────────────────────────────────────────────────── */
.sub-tab-badge {
    display: inline-block;
    background: rgba(251, 191, 36, 0.8);
    color: #1e1b4b;
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.05rem 0.38rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.paypal-autopays-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.2rem 0.75rem;
    flex-wrap: wrap;
}

.paypal-autopays-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-bottom: 1rem;
}

.paypal-autopay-card {
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 9px;
    padding: 0.7rem 0.85rem 0.6rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem 0.75rem;
    transition: border-color 0.15s;
}

.paypal-autopay-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.paypal-autopay-card.is-dismissed {
    opacity: 0.48;
}

.paypal-autopay-card.is-linked,
.paypal-autopay-card.is-merged {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.04);
}

.paypal-autopay-main {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.paypal-autopay-merchant {
    font-size: 0.92rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paypal-autopay-billing-id {
    font-size: 0.68rem;
    color: #64748b;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paypal-autopay-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.7rem;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

.paypal-autopay-meta strong {
    color: #cbd5e1;
}

.paypal-autopay-description {
    font-size: 0.74rem;
    color: #64748b;
    margin-top: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paypal-autopay-past {
    margin-top: 0.28rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.55rem;
}

.paypal-autopay-past-item {
    font-size: 0.69rem;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    padding: 0.08rem 0.35rem;
}

.paypal-autopay-linked-badge {
    font-size: 0.69rem;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: 4px;
    padding: 0.08rem 0.4rem;
    margin-top: 0.25rem;
    display: inline-block;
    cursor: pointer;
}

.paypal-autopay-linked-badge:hover {
    background: rgba(52, 211, 153, 0.2);
}

.paypal-autopay-merged-badge {
    font-size: 0.69rem;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: 4px;
    padding: 0.08rem 0.4rem;
    margin-top: 0.25rem;
    display: inline-block;
    cursor: pointer;
}

.paypal-autopay-merged-badge:hover {
    background: rgba(52, 211, 153, 0.2);
}

.paypal-autopay-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.paypal-autopay-actions button {
    font-size: 0.7rem;
    padding: 0.22rem 0.55rem;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.055);
    color: #94a3b8;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.paypal-autopay-actions button:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    border-color: rgba(99, 102, 241, 0.35);
}

.paypal-autopay-actions button.btn-promote {
    background: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.35);
}

.paypal-autopay-actions button.btn-promote:hover {
    background: rgba(99, 102, 241, 0.32);
    color: #e0e7ff;
}

.paypal-autopay-actions button.btn-dismiss {
    color: #64748b;
}

.paypal-autopay-amount-chip {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f59e0b;
    padding: 0.1rem 0.45rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 5px;
    text-align: right;
    white-space: nowrap;
}

/* PayPal link modal list */
.paypal-link-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.paypal-link-item {
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    font-size: 0.8rem;
    color: #cbd5e1;
    transition: background 0.12s;
}

.paypal-link-item:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.paypal-link-item-sub {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 0.1rem;
}
/* ── End PayPal Autopays ──────────────────────────────────────────────────── */

.app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 2.1rem;
    padding: 0.3rem 1rem;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
    background: rgba(13, 15, 26, 0.94);
    border-top: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-footer.is-stale {
    color: #fbbf24;
}

.app-footer.is-missing {
    color: #f87171;
}

.app-footer .backup-footer-path {
    opacity: 0.92;
}

.app-footer .backup-footer-sep {
    opacity: 0.45;
    margin: 0 0.35rem;
}
