/* CardSwitch — Bill ledger module (帳單記帳) */
.ledger-bill-ledger-page .ledger-sort-pill.active {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.22);
}

.ledger-bill-ledger-page .ledger-sort-pill:hover:not(.active) {
    border-color: rgba(99, 102, 241, 0.35);
    color: #4f46e5;
}

body.dark-theme .ledger-bill-ledger-page .ledger-sort-pill.active {
    color: #fff;
}

/* 帳單記帳設定 */
.ledger-bill-settings-card {
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.07);
    padding: 16px;
    margin-bottom: 12px;
}

.ledger-bill-settings-card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.ledger-bill-settings-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.ledger-bill-settings-card-icon.is-gmail {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #4285f4;
    border: 1px solid rgba(66, 133, 244, 0.2);
}

.ledger-bill-settings-card-icon.is-pdf {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.ledger-bill-settings-card-icon.is-general {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.ledger-bill-settings-card-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
}

.ledger-bill-settings-card-desc {
    margin-top: 2px;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

.ledger-bill-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.ledger-bill-settings-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
}

.ledger-bill-settings-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
}

.ledger-bill-settings-value.is-on {
    color: #059669;
}

.ledger-bill-settings-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    margin-bottom: 10px;
}

.ledger-bill-settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.ledger-bill-settings-input {
    width: 100%;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.88rem;
    background: #fff;
    color: #1e293b;
}

.ledger-bill-settings-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ledger-bill-settings-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
    color: #4338ca;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: not-allowed;
    opacity: 0.72;
}

.ledger-bill-settings-action.is-gmail {
    border-color: rgba(66, 133, 244, 0.24);
    color: #1d4ed8;
    background: linear-gradient(180deg, #f8fbff, #eff6ff);
}

.ledger-bill-settings-action.is-pdf {
    border-color: rgba(239, 68, 68, 0.22);
    color: #dc2626;
    background: linear-gradient(180deg, #fffafa, #fef2f2);
}

.ledger-bill-settings-action.is-general {
    border-color: rgba(99, 102, 241, 0.22);
    color: #4338ca;
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
    cursor: pointer;
    opacity: 1;
}

.ledger-bill-settings-action.is-restore {
    border-color: rgba(245, 158, 11, 0.28);
    color: #b45309;
    background: linear-gradient(180deg, #fffbeb, #fef3c7);
    cursor: pointer;
    opacity: 1;
}

.ledger-bill-settings-note,
.ledger-bill-settings-placeholder {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.45;
}

body.dark-theme .ledger-bill-settings-card {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.24);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

body.dark-theme .ledger-bill-settings-card-title { color: #e2e8f0; }
body.dark-theme .ledger-bill-settings-card-desc,
body.dark-theme .ledger-bill-settings-label,
body.dark-theme .ledger-bill-settings-check { color: #cbd5e1; }
body.dark-theme .ledger-bill-settings-value { color: #94a3b8; }
body.dark-theme .ledger-bill-settings-value.is-on { color: #6ee7b7; }
body.dark-theme .ledger-bill-settings-input {
    background: rgba(35, 39, 62, 0.88);
    border-color: rgba(129, 140, 248, 0.24);
    color: #e2e8f0;
}
body.dark-theme .ledger-bill-settings-note,
body.dark-theme .ledger-bill-settings-placeholder { color: #94a3b8; }
/* =============================================
   帳單記帳 卡片內按鈕（同步Gmail／上傳PDF）
   ============================================= */
.ledger-bill-ledger-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.ledger-bill-ledger-card {
    padding-right: 15px;
}

.ledger-bill-ledger-arrow {
    position: absolute;
    right: 14px;
    top: 18px;
    transform: none;
    color: rgba(100, 116, 139, 0.62);
    font-size: 0.74rem;
    z-index: 2;
    pointer-events: none;
}

body.dark-theme .ledger-bill-ledger-arrow {
    color: rgba(199, 210, 254, 0.72);
}

.ledger-bill-ledger-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(147, 165, 220, 0.35);
    background: rgba(255, 255, 255, 0.75);
    color: #3d4558;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.ledger-bill-ledger-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.12);
}

.ledger-bill-ledger-btn:active {
    transform: scale(0.98);
}

.ledger-bill-ledger-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

body.dark-theme .ledger-bill-ledger-btn {
    background: rgba(58, 62, 84, 0.55);
    border: 1px solid rgba(129, 140, 248, 0.42);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-ledger-btn:hover {
    border-color: rgba(129, 140, 248, 0.6);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.ledger-bill-ledger-summary,
.ledger-bill-ledger-compare,
.ledger-bill-ledger-trend {
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(79, 70, 229, 0.08);
    padding: 16px 16px 15px;
    position: relative;
    overflow: hidden;
}

.ledger-bill-ledger-page {
    --bill-ledger-primary: #4f46e5;
    --bill-ledger-primary-soft: #eef2ff;
    --bill-ledger-accent: #d97706;
    --bill-ledger-surface: #ffffff;
    --bill-ledger-muted: #64748b;
    --bill-ledger-text: #1e293b;
}

.ledger-bill-ledger-page-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ledger-bill-ledger-page-header.is-actions-only {
    justify-content: flex-end;
}

.ledger-bill-ledger-page-header.is-actions-only .ledger-bill-ledger-header-actions {
    width: 100%;
    max-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ledger-bill-ledger-page-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.ledger-bill-ledger-header-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.ledger-bill-ledger-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.ledger-bill-ledger-header-btn i {
    font-size: 0.88rem;
}

.ledger-bill-ledger-header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.14);
}

.ledger-bill-ledger-header-btn:active {
    transform: translateY(0);
}

.ledger-bill-ledger-header-btn.is-gmail {
    border-color: rgba(66, 133, 244, 0.28);
    color: #1d4ed8;
    background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
}

.ledger-bill-ledger-header-btn.is-gmail i { color: #4285f4; }

.ledger-bill-ledger-header-btn.is-pdf {
    border-color: rgba(239, 68, 68, 0.24);
    color: #b91c1c;
    background: linear-gradient(180deg, #fffafa 0%, #fef2f2 100%);
}

.ledger-bill-ledger-header-btn.is-pdf i { color: #ef4444; }

.ledger-bill-ledger-header-btn.is-settings {
    border-color: rgba(99, 102, 241, 0.28);
    color: #4338ca;
    background: linear-gradient(180deg, #fbfaff 0%, #eef2ff 100%);
}

.ledger-bill-ledger-header-btn.is-settings i { color: #6366f1; }

.ledger-bill-ledger-header-btn.is-tier-locked {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.85);
    transform: none !important;
    box-shadow: none !important;
}

.ledger-bill-ledger-header-btn.is-tier-locked:hover,
.ledger-bill-ledger-header-btn.is-tier-locked:active {
    transform: none;
    box-shadow: none;
}

body.dark-theme .ledger-bill-ledger-header-btn {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.24);
    color: #e2e8f0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

body.dark-theme .ledger-bill-ledger-header-btn.is-gmail {
    border-color: rgba(96, 165, 250, 0.32);
    color: #bfdbfe;
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.35) 0%, rgba(43, 48, 76, 0.9) 100%);
}

body.dark-theme .ledger-bill-ledger-header-btn.is-gmail i { color: #93c5fd; }

body.dark-theme .ledger-bill-ledger-header-btn.is-pdf {
    border-color: rgba(248, 113, 113, 0.28);
    color: #fecaca;
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.32) 0%, rgba(43, 48, 76, 0.9) 100%);
}

body.dark-theme .ledger-bill-ledger-header-btn.is-pdf i { color: #fca5a5; }

body.dark-theme .ledger-bill-ledger-header-btn.is-settings {
    border-color: rgba(129, 140, 248, 0.32);
    color: #e0e7ff;
    background: linear-gradient(180deg, rgba(67, 56, 202, 0.28) 0%, rgba(43, 48, 76, 0.9) 100%);
}

body.dark-theme .ledger-bill-ledger-header-btn.is-settings i { color: #c7d2fe; }

.ledger-bill-ledger-page-title {
    color: var(--bill-ledger-text);
    letter-spacing: -0.02em;
}

.ledger-bill-ledger-page-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #4338ca;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(224, 231, 255, 0.9));
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.ledger-bill-ledger-back-btn {
    border-color: rgba(99, 102, 241, 0.18);
    color: #4f46e5;
    background: rgba(238, 242, 255, 0.75);
}

.ledger-bill-ledger-back-btn:hover {
    background: rgba(224, 231, 255, 0.95);
}

.ledger-bill-ledger-page .ledger-pill.active {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
}

.ledger-bill-ledger-page .ledger-pill:hover:not(.active) {
    border-color: rgba(99, 102, 241, 0.35);
    color: #4f46e5;
}

.ledger-bill-ledger-page .ledger-card-chip.active {
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.98), rgba(224, 231, 255, 0.92));
    border-color: rgba(99, 102, 241, 0.35);
    color: #4338ca;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.ledger-bill-ledger-summary {
    border: 1px solid rgba(99, 102, 241, 0.14);
    background: linear-gradient(165deg, #fbfcff 0%, #f5f7ff 48%, #eef2ff 100%);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.08);
    color: #1e293b;
    padding: 18px 18px 16px;
}

.ledger-bill-ledger-summary-glow {
    position: absolute;
    inset: auto -18% -45% auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(199, 210, 254, 0.28) 0%, transparent 68%);
    pointer-events: none;
}

.ledger-bill-ledger-summary::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -12%;
    width: 55%;
    height: 70%;
    background: radial-gradient(circle, rgba(224, 231, 255, 0.55) 0%, transparent 72%);
    pointer-events: none;
}

.ledger-bill-ledger-summary-head {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.ledger-bill-ledger-summary-icon,
.ledger-bill-ledger-compare-icon,
.ledger-bill-ledger-trend-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ledger-bill-ledger-summary-icon {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.ledger-bill-ledger-compare::before,
.ledger-bill-ledger-trend::before {
    display: none;
}

.ledger-bill-ledger-summary-label,
.ledger-bill-ledger-compare-label {
    font-size: 0.8rem;
    color: #5b6280;
    font-weight: 700;
}

.ledger-bill-ledger-summary-label {
    color: #64748b;
    margin: 0;
}

.ledger-bill-ledger-summary-amount {
    margin-top: 12px;
    font-size: 2rem;
    font-weight: 800;
    color: #312e81;
    line-height: 1.05;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 1;
}

.ledger-bill-ledger-summary-count {
    margin-top: 6px;
    font-size: 0.84rem;
    color: #64748b;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.ledger-bill-ledger-compare {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.ledger-bill-ledger-compare-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ledger-bill-ledger-compare-icon {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.ledger-bill-ledger-compare-main {
    margin-top: 2px;
    font-size: 1.28rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.ledger-bill-ledger-compare-sub {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
}

.ledger-bill-ledger-compare.is-up {
    border-color: rgba(244, 63, 94, 0.22);
    background: linear-gradient(180deg, #fff7f8 0%, #ffffff 100%);
}

.ledger-bill-ledger-compare.is-down {
    border-color: rgba(16, 185, 129, 0.22);
    background: linear-gradient(180deg, #f3fbf7 0%, #ffffff 100%);
}

.ledger-bill-ledger-compare.is-up .ledger-bill-ledger-compare-main { color: #e11d48; }
.ledger-bill-ledger-compare.is-down .ledger-bill-ledger-compare-main { color: #059669; }

.ledger-bill-ledger-trend-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ledger-bill-ledger-trend-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ledger-bill-ledger-trend-icon {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    color: #c2410c;
    border: 1px solid rgba(251, 146, 60, 0.18);
}

.ledger-bill-ledger-trend-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.ledger-bill-ledger-trend-chevron {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    color: #6366f1;
    background: rgba(238, 242, 255, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.14);
    flex-shrink: 0;
}

.ledger-bill-ledger-trend-entry {
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.ledger-bill-ledger-trend-entry::after {
    display: none;
}

.ledger-bill-ledger-trend-entry:hover {
    border-color: rgba(99, 102, 241, 0.28);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.14);
    transform: translateY(-1px);
}

.ledger-bill-ledger-trend-entry:hover .ledger-bill-ledger-trend-chevron {
    background: #6366f1;
    color: #fff;
    border-color: transparent;
}

.ledger-bill-ledger-trend-entry:active {
    transform: translateY(1px);
}

.ledger-bill-ledger-trend-entry:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.ledger-bill-ledger-trend-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ledger-bill-ledger-trend-row {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    align-items: center;
    gap: 10px;
}

.ledger-bill-ledger-trend-month {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 700;
}

.ledger-bill-ledger-trend-bar-wrap {
    height: 12px;
    background: rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    overflow: hidden;
}

.ledger-bill-ledger-trend-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 55%, #f59e0b 100%);
}

.ledger-bill-ledger-trend-amount {
    font-size: 0.8rem;
    color: #334155;
    font-weight: 700;
}

.ledger-bill-ledger-trend-empty {
    font-size: 0.84rem;
    color: #94a3b8;
    text-align: center;
    padding: 18px 12px 10px;
}

.ledger-bill-ledger-trend-empty-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 10px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #6366f1;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(224, 231, 255, 0.85));
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.ledger-bill-ledger-detail-btn {
    border: 1px solid rgba(99, 102, 241, 0.16);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 15px 16px;
    color: #1e293b;
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.08);
}

.ledger-bill-ledger-detail-btn:hover {
    border-color: rgba(99, 102, 241, 0.32);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.14);
    transform: translateY(-1px);
}

.ledger-bill-ledger-detail-btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: #4f46e5;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.ledger-bill-ledger-detail-count {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
}

.ledger-bill-ledger-chart-type {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ledger-bill-ledger-chart-card {
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 10px 28px rgba(79, 70, 229, 0.08);
    padding: 16px;
}

.ledger-bill-ledger-chart-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #334155;
    margin-bottom: 12px;
}

.ledger-bill-ledger-chart-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ledger-bill-ledger-chart-row {
    display: grid;
    grid-template-columns: 22px minmax(70px, 1fr) minmax(90px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.ledger-bill-ledger-chart-rank {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
}

.ledger-bill-ledger-chart-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledger-bill-ledger-chart-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.ledger-bill-ledger-chart-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 55%, #f59e0b 100%);
}

.ledger-bill-ledger-chart-val {
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

body.dark-theme .ledger-bill-ledger-summary,
body.dark-theme .ledger-bill-ledger-compare,
body.dark-theme .ledger-bill-ledger-trend {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.88) 0%, rgba(35, 39, 62, 0.82) 100%);
    border-color: rgba(129, 140, 248, 0.28);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

body.dark-theme .ledger-bill-ledger-summary {
    background: linear-gradient(165deg, rgba(49, 46, 129, 0.22) 0%, rgba(43, 48, 76, 0.9) 55%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.22);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

body.dark-theme .ledger-bill-ledger-page-title { color: #e2e8f0; }

body.dark-theme .ledger-bill-ledger-page-badge {
    color: #c7d2fe;
    background: rgba(67, 56, 202, 0.28);
    border-color: rgba(129, 140, 248, 0.28);
}

body.dark-theme .ledger-bill-ledger-back-btn {
    background: rgba(67, 56, 202, 0.24);
    border-color: rgba(129, 140, 248, 0.28);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-ledger-summary::before,
body.dark-theme .ledger-bill-ledger-compare::before,
body.dark-theme .ledger-bill-ledger-trend::before {
    display: none;
}

body.dark-theme .ledger-bill-ledger-summary-icon,
body.dark-theme .ledger-bill-ledger-compare-icon,
body.dark-theme .ledger-bill-ledger-trend-icon {
    background: rgba(67, 56, 202, 0.28);
    border-color: rgba(129, 140, 248, 0.24);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-ledger-summary-label,
body.dark-theme .ledger-bill-ledger-compare-label,
body.dark-theme .ledger-bill-ledger-summary-count,
body.dark-theme .ledger-bill-ledger-trend-month { color: #a5b4fc; }

body.dark-theme .ledger-bill-ledger-summary-label,
body.dark-theme .ledger-bill-ledger-summary-count { color: #94a3b8; }

body.dark-theme .ledger-bill-ledger-summary-amount { color: #e0e7ff; }

body.dark-theme .ledger-bill-ledger-compare-main,
body.dark-theme .ledger-bill-ledger-trend-title,
body.dark-theme .ledger-bill-ledger-trend-amount { color: #e2e8f0; }

body.dark-theme .ledger-bill-ledger-compare-sub { color: #cbd5e1; }

body.dark-theme .ledger-bill-ledger-compare.is-up {
    background: linear-gradient(180deg, rgba(76, 29, 46, 0.42) 0%, rgba(43, 48, 76, 0.88) 100%);
}

body.dark-theme .ledger-bill-ledger-compare.is-down {
    background: linear-gradient(180deg, rgba(20, 83, 58, 0.28) 0%, rgba(43, 48, 76, 0.88) 100%);
}

body.dark-theme .ledger-bill-ledger-trend-bar-wrap { background: rgba(148, 163, 184, 0.24); }
body.dark-theme .ledger-bill-ledger-trend-empty,
body.dark-theme .ledger-bill-ledger-detail-empty { color: #94a3b8; }

body.dark-theme .ledger-bill-ledger-trend-empty-icon,
body.dark-theme .ledger-bill-ledger-detail-empty-icon {
    background: rgba(67, 56, 202, 0.28);
    border-color: rgba(129, 140, 248, 0.24);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-ledger-trend-chevron {
    background: rgba(67, 56, 202, 0.32);
    border-color: rgba(129, 140, 248, 0.24);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-ledger-trend-entry:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }

body.dark-theme .ledger-bill-ledger-detail-btn {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.24);
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-ledger-detail-btn-icon {
    background: rgba(67, 56, 202, 0.32);
    border-color: rgba(129, 140, 248, 0.24);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-ledger-chart-card {
    background: linear-gradient(150deg, rgba(43, 48, 76, 0.8) 0%, rgba(35, 39, 62, 0.78) 100%);
    border-color: rgba(129, 140, 248, 0.38);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
}

body.dark-theme .ledger-bill-ledger-chart-title,
body.dark-theme .ledger-bill-ledger-chart-label,
body.dark-theme .ledger-bill-ledger-chart-val { color: #e2e8f0; }
body.dark-theme .ledger-bill-ledger-chart-rank { color: #a5b4fc; }
body.dark-theme .ledger-bill-ledger-chart-track { background: rgba(148, 163, 184, 0.24); }

.ledger-bill-ledger-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.06);
    padding: 13px 14px;
    margin-bottom: 10px;
}

.ledger-bill-ledger-detail-merchant {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.ledger-bill-ledger-detail-meta {
    margin-top: 3px;
    font-size: 0.78rem;
    color: #64748b;
}

.ledger-bill-ledger-detail-amount {
    font-size: 0.95rem;
    font-weight: 800;
    color: #4f46e5;
    white-space: nowrap;
}

.ledger-bill-ledger-detail-empty {
    text-align: center;
    color: #94a3b8;
    padding: 28px 12px 18px;
    font-size: 0.88rem;
}

.ledger-bill-ledger-detail-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #6366f1;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(224, 231, 255, 0.85));
    border: 1px solid rgba(99, 102, 241, 0.12);
}

body.dark-theme .ledger-bill-ledger-detail-row {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.24);
}

body.dark-theme .ledger-bill-ledger-detail-merchant,
body.dark-theme .ledger-bill-ledger-detail-amount { color: #e2e8f0; }

body.dark-theme .ledger-bill-ledger-detail-amount { color: #c7d2fe; }
body.dark-theme .ledger-bill-ledger-detail-meta { color: #cbd5e1; }
body.dark-theme .ledger-bill-ledger-detail-empty { color: #94a3b8; }

.ledger-privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: none;
}

.ledger-privacy-modal.is-open {
    display: block;
}

.ledger-privacy-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.ledger-privacy-modal__panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 460px);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 248, 255, 0.96) 100%);
    border: 1px solid rgba(129, 140, 248, 0.22);
    border-radius: 20px;
    box-shadow: 0 22px 54px rgba(30, 41, 59, 0.26);
    padding: 18px 18px 16px;
}

.ledger-privacy-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ledger-privacy-modal__title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 34px 8px 0;
}

.ledger-privacy-modal__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.12), rgba(129, 140, 248, 0.08));
    color: #4f46e5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.ledger-privacy-modal__title {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 800;
    color: #312e81;
}

.ledger-privacy-modal__content {
    color: #334155;
    font-size: 0.91rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    padding: 12px;
}

.ledger-privacy-modal__content p {
    margin-bottom: 10px;
}

.ledger-privacy-modal__check {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 0.88rem;
}

.ledger-privacy-modal__ack-btn {
    margin-top: 14px;
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    background: linear-gradient(145deg, #6366f1, #4f46e5);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25);
    cursor: pointer;
}

.ledger-privacy-modal__ack-btn:active {
    transform: translateY(1px);
}

body.ledger-privacy-modal-open {
    overflow: hidden;
}

body.dark-theme .ledger-privacy-modal__panel {
    background: linear-gradient(155deg, rgba(39, 44, 70, 0.96) 0%, rgba(31, 35, 58, 0.96) 100%);
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.46);
}

body.dark-theme .ledger-privacy-modal__close {
    background: rgba(129, 140, 248, 0.16);
    color: #c7d2fe;
}

body.dark-theme .ledger-privacy-modal__icon {
    background: linear-gradient(145deg, rgba(129, 140, 248, 0.22), rgba(99, 102, 241, 0.16));
    color: #c7d2fe;
}

body.dark-theme .ledger-privacy-modal__title {
    color: #c7d2fe;
}

body.dark-theme .ledger-privacy-modal__content {
    background: rgba(15, 23, 42, 0.38);
    border-color: rgba(148, 163, 184, 0.24);
    color: #e2e8f0;
}

body.dark-theme .ledger-privacy-modal__check {
    color: #cbd5e1;
}


/* 帳單記帳設定 — 選單列（複製 CardSwitch 設定頁風格） */
.ledger-bill-settings-menu-section {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.07);
    overflow: hidden;
}

.ledger-bill-settings-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 16px 18px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ledger-bill-settings-menu-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.ledger-bill-settings-menu-item:active {
    background: rgba(99, 102, 241, 0.08);
    transform: scale(0.995);
}

.ledger-bill-settings-menu-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.ledger-bill-settings-menu-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    background: transparent;
    border: 1.5px solid transparent;
}

.ledger-bill-settings-menu-icon.is-gmail {
    color: #4285f4;
    border-color: rgba(66, 133, 244, 0.42);
}

.ledger-bill-settings-menu-icon.is-connection {
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.42);
}

.ledger-bill-settings-menu-icon.is-pdf {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.42);
}

.ledger-bill-settings-menu-icon.is-general {
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.42);
}

.ledger-bill-settings-menu-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ledger-bill-settings-menu-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
}

.ledger-bill-settings-menu-desc {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

.ledger-bill-settings-menu-arrow {
    color: #94a3b8;
    font-size: 0.82rem;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.ledger-bill-settings-menu-item:hover .ledger-bill-settings-menu-arrow {
    color: #6366f1;
    transform: translateX(2px);
}

/* Gmail 同步內層 */
.ledger-bill-gmail-settings-panel {
    animation: ledger-bill-gmail-fade-in 0.22s ease;
}

@keyframes ledger-bill-gmail-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ledger-bill-gmail-accounts-wrap {
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.07);
    padding: 16px;
}

.ledger-bill-gmail-accounts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.ledger-bill-gmail-accounts-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: #1e293b;
}

.ledger-bill-gmail-accounts-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.ledger-bill-gmail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 22px 16px;
    margin-bottom: 12px;
    border: 1px dashed rgba(99, 102, 241, 0.22);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.45), rgba(248, 250, 252, 0.8));
}

.ledger-bill-gmail-empty.is-hidden {
    display: none;
}

.ledger-bill-gmail-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #4285f4;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.ledger-bill-gmail-empty-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #334155;
}

.ledger-bill-gmail-empty-desc {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.45;
    max-width: 280px;
}

.ledger-bill-gmail-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.ledger-bill-gmail-accounts-list.is-hidden {
    display: none;
}

.ledger-bill-gmail-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.12);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.05);
}

.ledger-bill-gmail-account-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.ledger-bill-gmail-account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #4285f4;
    flex-shrink: 0;
}

.ledger-bill-gmail-account-email {
    font-size: 0.86rem;
    font-weight: 700;
    color: #1e293b;
    word-break: break-all;
}

.ledger-bill-gmail-account-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ledger-bill-gmail-connected-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.18);
    white-space: nowrap;
}

.ledger-bill-gmail-connected-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.ledger-bill-gmail-account-remove {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.9);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ledger-bill-gmail-account-remove:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(254, 242, 242, 0.95);
}

.ledger-bill-gmail-add-btn {
    margin-top: 2px;
    cursor: pointer;
    opacity: 1;
}

/* PDF 解密內層 */
.ledger-bill-pdf-accounts-wrap {
    border: 1px solid rgba(239, 68, 68, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.06);
    padding: 16px;
}

.ledger-bill-pdf-accounts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.ledger-bill-pdf-accounts-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: #1e293b;
}

.ledger-bill-pdf-accounts-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.ledger-bill-pdf-accounts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 22px 16px;
    margin-bottom: 12px;
    border: 1px dashed rgba(239, 68, 68, 0.22);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.45), rgba(255, 250, 250, 0.85));
}

.ledger-bill-pdf-accounts-empty.is-hidden,
.ledger-bill-pdf-accounts-list.is-hidden {
    display: none;
}

.ledger-bill-pdf-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #ef4444;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.ledger-bill-pdf-empty-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
}

.ledger-bill-pdf-empty-desc {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
    max-width: 300px;
}

.ledger-bill-pdf-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.ledger-bill-pdf-account-card {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) minmax(56px, 0.75fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(239, 68, 68, 0.12);
    background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.04);
}

.ledger-bill-pdf-acc-name-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledger-bill-pdf-acc-bank-text {
    font-size: 0.84rem;
    color: #64748b;
}

.ledger-bill-pdf-acc-source-text {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    padding-top: 2px;
}

.ledger-bill-pdf-acc-source-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
}

.ledger-bill-pdf-acc-source-value {
    font-size: 0.82rem;
    font-weight: 500;
    color: #475569;
    word-break: break-all;
    line-height: 1.35;
}

.ledger-bill-pdf-acc-source-value.is-empty {
    color: #94a3b8;
    font-weight: 400;
}

.ledger-bill-pdf-acc-edit,
.ledger-bill-pdf-acc-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ledger-bill-pdf-acc-edit {
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
    color: #4338ca;
}

.ledger-bill-pdf-acc-edit:hover {
    border-color: rgba(99, 102, 241, 0.38);
    background: #eef2ff;
}

.ledger-bill-pdf-acc-del {
    border: 1px solid rgba(239, 68, 68, 0.18);
    background: rgba(254, 242, 242, 0.9);
    color: #dc2626;
}

.ledger-bill-pdf-acc-del:hover {
    background: #fee2e2;
    border-color: rgba(239, 68, 68, 0.35);
}

.ledger-bill-pdf-edit-card {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(239, 68, 68, 0.16);
    background: linear-gradient(180deg, rgba(255, 250, 250, 0.95), #ffffff);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.06);
}

.ledger-bill-pdf-edit-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 12px;
}

.ledger-bill-pdf-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.ledger-bill-pdf-edit-save-btn,
.ledger-bill-pdf-edit-cancel-btn {
    flex: 1;
    min-height: 38px;
    border-radius: 12px;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
}

.ledger-bill-pdf-edit-save-btn {
    border: 1px solid rgba(239, 68, 68, 0.22);
    background: linear-gradient(180deg, #fffafa, #fef2f2);
    color: #dc2626;
}

.ledger-bill-pdf-edit-cancel-btn {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #f8fafc;
    color: #64748b;
}

.ledger-bill-pdf-loading {
    padding: 24px 12px;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

.ledger-bill-pdf-add-btn.is-hidden {
    display: none;
}

@media (max-width: 560px) {
    .ledger-bill-pdf-account-card {
        grid-template-columns: 1fr auto auto;
        grid-template-areas:
            'name edit del'
            'bank edit del'
            'email email email';
    }

    .ledger-bill-pdf-acc-name-text { grid-area: name; }
    .ledger-bill-pdf-acc-bank-text { grid-area: bank; }
    .ledger-bill-pdf-acc-source-text { grid-area: email; }
    .ledger-bill-pdf-acc-edit { grid-area: edit; }
    .ledger-bill-pdf-acc-del { grid-area: del; }
}

.ledger-bill-pdf-add-btn {
    margin-top: 2px;
    cursor: pointer;
    opacity: 1;
}

/* Gmail 同步範圍 */
.ledger-bill-sync-range-card {
    margin-top: 14px;
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.07);
    padding: 16px;
}

.ledger-bill-sync-range-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.875rem;
    color: #334155;
    cursor: pointer;
}

.ledger-bill-sync-range-option input {
    accent-color: #6366f1;
}

.ledger-bill-sync-range-date,
.ledger-bill-sync-range-days {
    margin: 6px 0 4px 22px;
    max-width: 220px;
}

.ledger-bill-sync-range-days {
    max-width: 140px;
}

/* 其他 — Gmail 收信規則 */
.ledger-bill-advanced-wrap {
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.07);
    padding: 16px;
}

.ledger-bill-advanced-head {
    margin-bottom: 14px;
}

.ledger-bill-advanced-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.ledger-bill-advanced-desc {
    font-size: 0.875rem;
    line-height: 1.55;
    color: #64748b;
}

.ledger-bill-advanced-section {
    padding: 14px 0;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.ledger-bill-advanced-section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.ledger-bill-section-head {
    margin-bottom: 10px;
}

.ledger-bill-section-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.ledger-bill-section-desc {
    font-size: 0.84rem;
    line-height: 1.55;
    color: #64748b;
}

.ledger-bill-rules-textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    line-height: 1.5;
    font-size: 0.84rem;
}

.ledger-bill-builtin-list {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px dashed rgba(99, 102, 241, 0.18);
    background: rgba(238, 242, 255, 0.45);
    font-size: 0.8rem;
    line-height: 1.55;
    color: #475569;
    word-break: break-word;
}

.ledger-bill-inline-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
    color: #4338ca;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
}

.ledger-bill-inline-action-btn:hover {
    border-color: rgba(99, 102, 241, 0.38);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.1);
}

.ledger-bill-label-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ledger-bill-label-chip-list.is-hidden {
    display: none;
}

.ledger-bill-label-chip {
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 999px;
    background: #fff;
    color: #4338ca;
    font-size: 0.76rem;
    padding: 6px 10px;
    cursor: pointer;
}

.ledger-bill-label-chip:hover {
    background: #eef2ff;
}

.ledger-bill-inline-empty {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
}

.ledger-bill-advanced-action-btn {
    margin-top: 4px;
    cursor: pointer;
    opacity: 1;
}

body.dark-theme .ledger-bill-settings-menu-section,
body.dark-theme .ledger-bill-gmail-accounts-wrap,
body.dark-theme .ledger-bill-pdf-accounts-wrap,
body.dark-theme .ledger-bill-sync-range-card,
body.dark-theme .ledger-bill-advanced-wrap,
body.dark-theme .ledger-bill-gmail-account-card,
body.dark-theme .ledger-bill-pdf-account-card,
body.dark-theme .ledger-bill-pdf-edit-card {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.24);
}

body.dark-theme .ledger-bill-settings-menu-label,
body.dark-theme .ledger-bill-gmail-accounts-title,
body.dark-theme .ledger-bill-pdf-accounts-title,
body.dark-theme .ledger-bill-advanced-title,
body.dark-theme .ledger-bill-section-title,
body.dark-theme .ledger-bill-gmail-account-email,
body.dark-theme .ledger-bill-gmail-empty-title,
body.dark-theme .ledger-bill-pdf-empty-title,
body.dark-theme .ledger-bill-pdf-acc-name-text,
body.dark-theme .ledger-bill-pdf-edit-title {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-pdf-acc-bank-text,
body.dark-theme .ledger-bill-pdf-acc-source-label {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-pdf-acc-source-value {
    color: #cbd5e1;
}

body.dark-theme .ledger-bill-pdf-acc-source-value.is-empty {
    color: #64748b;
}

body.dark-theme .ledger-bill-settings-menu-desc,
body.dark-theme .ledger-bill-gmail-accounts-count,
body.dark-theme .ledger-bill-pdf-accounts-count,
body.dark-theme .ledger-bill-gmail-empty-desc,
body.dark-theme .ledger-bill-pdf-empty-desc,
body.dark-theme .ledger-bill-advanced-desc,
body.dark-theme .ledger-bill-section-desc,
body.dark-theme .ledger-bill-builtin-list {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-settings-menu-item:hover {
    background: rgba(99, 102, 241, 0.12);
}

body.dark-theme .ledger-bill-gmail-empty {
    background: linear-gradient(180deg, rgba(67, 56, 202, 0.12), rgba(35, 39, 62, 0.5));
    border-color: rgba(129, 140, 248, 0.24);
}

body.dark-theme .ledger-bill-gmail-connected-pill {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.24);
}

body.dark-theme .ledger-bill-gmail-account-remove {
    background: rgba(35, 39, 62, 0.88);
    border-color: rgba(129, 140, 248, 0.2);
    color: #cbd5e1;
}

/* 帳單記帳設定 — Google Client ID 連線設定 */
.ledger-bill-connection-card,
.ledger-bill-tutorial-wrap {
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.07);
    padding: 16px;
}

.ledger-bill-connection-choice {
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.84);
    padding: 14px;
    margin-bottom: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ledger-bill-connection-choice.is-selected {
    border-color: rgba(99, 102, 241, 0.42);
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.82), rgba(255, 255, 255, 0.96));
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.1);
}

.ledger-bill-connection-radio {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.ledger-bill-connection-radio input {
    margin-top: 4px;
    accent-color: #6366f1;
}

.ledger-bill-connection-radio span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ledger-bill-connection-radio strong,
.ledger-bill-connection-radio-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: #1e293b;
}

.ledger-bill-connection-radio small,
.ledger-bill-connection-radio-desc {
    font-size: 0.875rem;
    line-height: 1.55;
    color: #475569;
    display: none;
    margin-top: 4px;
}

.ledger-bill-connection-choice.is-selected .ledger-bill-connection-radio-desc {
    display: block;
}

.ledger-bill-custom-client-wrap {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed rgba(99, 102, 241, 0.18);
}

.ledger-bill-custom-client-wrap.is-hidden {
    display: none;
}

.ledger-bill-settings-input.is-invalid {
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.ledger-bill-client-id-status {
    margin: 6px 0 10px;
    font-size: 0.84rem;
    color: #64748b;
}

.ledger-bill-client-id-status.is-valid {
    color: #059669;
}

.ledger-bill-client-id-status.is-invalid {
    color: #dc2626;
}

.ledger-bill-tutorial-open-btn,
.ledger-bill-tutorial-link,
.ledger-bill-copy-origin-btn,
.ledger-bill-scope-chip {
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
    color: #4338ca;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ledger-bill-tutorial-open-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 13px;
    cursor: pointer;
}

.ledger-bill-tutorial-open-btn:hover,
.ledger-bill-tutorial-link:hover,
.ledger-bill-copy-origin-btn:hover,
.ledger-bill-scope-chip:hover {
    border-color: rgba(99, 102, 241, 0.38);
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.11);
    transform: translateY(-1px);
}

.ledger-bill-connection-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
}

.ledger-bill-connection-info {
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.12);
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.58), rgba(248, 250, 252, 0.9));
    padding: 12px;
}

.ledger-bill-connection-info-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4338ca;
    margin-bottom: 5px;
}

.ledger-bill-connection-info p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #475569;
}

.ledger-bill-tutorial-device-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(254, 243, 199, 0.72);
    border: 1px solid rgba(245, 158, 11, 0.28);
    color: #92400e;
}

.ledger-bill-tutorial-device-tip i {
    margin-top: 2px;
    flex-shrink: 0;
    font-size: 1rem;
    color: #d97706;
}

.ledger-bill-tutorial-device-tip p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.65;
    font-weight: 600;
}

.ledger-bill-tutorial-hero {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.92), rgba(219, 234, 254, 0.72));
    border: 1px solid rgba(99, 102, 241, 0.14);
    margin-bottom: 14px;
}

.ledger-bill-tutorial-hero-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4285f4;
    background: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.ledger-bill-tutorial-hero-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.ledger-bill-tutorial-hero p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #475569;
}

.ledger-bill-tutorial-step {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.ledger-bill-tutorial-step:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.ledger-bill-tutorial-step-no {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.22);
}

.ledger-bill-tutorial-step-body h6 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
}

.ledger-bill-tutorial-step-body p {
    margin: 0 0 10px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #475569;
}

.ledger-bill-tutorial-step-body ul {
    padding-left: 18px;
    margin: 8px 0 0;
    color: #334155;
    font-size: 0.875rem;
    line-height: 1.65;
}

.ledger-bill-tutorial-scope-li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.ledger-bill-scope-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
    color: #4338ca;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ledger-bill-scope-copy-btn:hover {
    border-color: rgba(99, 102, 241, 0.38);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.ledger-bill-tutorial-links,
.ledger-bill-scope-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.ledger-bill-tutorial-link,
.ledger-bill-copy-origin-btn,
.ledger-bill-scope-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.ledger-bill-tutorial-block-text {
    margin: 10px 0 0;
    font-size: 0.875rem;
    line-height: 1.65;
    color: #334155;
}

.ledger-bill-tutorial-figure {
    margin: 10px 0 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.14);
    background: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.08);
}

.ledger-bill-tutorial-figure img {
    display: block;
    width: 100%;
    height: auto;
}

.ledger-bill-tutorial-figure figcaption {
    padding: 9px 12px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #475569;
    background: rgba(248, 250, 252, 0.95);
}

#ledgerBillLedgerGmailSettingsPanel .ledger-sub-view-hint {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #475569;
}

body.dark-theme .ledger-bill-connection-card,
body.dark-theme .ledger-bill-tutorial-wrap,
body.dark-theme .ledger-bill-connection-choice {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(129, 140, 248, 0.24);
}

body.dark-theme .ledger-bill-connection-choice.is-selected {
    background: linear-gradient(180deg, rgba(67, 56, 202, 0.24), rgba(35, 39, 62, 0.9));
}

body.dark-theme .ledger-bill-connection-radio strong,
body.dark-theme .ledger-bill-connection-radio-title,
body.dark-theme .ledger-bill-tutorial-hero-title,
body.dark-theme .ledger-bill-tutorial-step-body h6 {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-connection-radio small,
body.dark-theme .ledger-bill-connection-info p,
body.dark-theme .ledger-bill-tutorial-hero p,
body.dark-theme .ledger-bill-tutorial-step-body p,
body.dark-theme .ledger-bill-tutorial-step-body ul,
body.dark-theme .ledger-bill-tutorial-block-text,
body.dark-theme .ledger-bill-tutorial-figure figcaption,
body.dark-theme #ledgerBillLedgerGmailSettingsPanel .ledger-sub-view-hint {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-connection-info,
body.dark-theme .ledger-bill-tutorial-hero {
    background: linear-gradient(180deg, rgba(67, 56, 202, 0.16), rgba(35, 39, 62, 0.72));
    border-color: rgba(129, 140, 248, 0.24);
}

body.dark-theme .ledger-bill-tutorial-device-tip {
    background: rgba(120, 53, 15, 0.28);
    border-color: rgba(245, 158, 11, 0.32);
    color: #fcd34d;
}

body.dark-theme .ledger-bill-tutorial-device-tip i {
    color: #fbbf24;
}

.ledger-bill-pdf-upload-picker {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ledger-bill-pdf-upload-picker.is-open {
    display: flex;
}

.ledger-bill-pdf-upload-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.ledger-bill-pdf-upload-picker__panel {
    position: relative;
    width: min(420px, 100%);
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    padding: 22px 20px 18px;
}

.ledger-bill-pdf-upload-picker__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #64748b;
    cursor: pointer;
}

.ledger-bill-pdf-upload-picker__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    padding-right: 28px;
}

.ledger-bill-pdf-upload-picker__icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.ledger-bill-pdf-upload-picker__title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
}

.ledger-bill-pdf-upload-picker__desc {
    margin: 0;
    font-size: 0.88rem;
    color: #64748b;
}

.ledger-bill-pdf-upload-picker__actions {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.ledger-bill-pdf-upload-picker__btn {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    width: 100%;
    padding: 14px 14px;
    border-radius: 16px;
    border: 1px solid rgba(239, 68, 68, 0.16);
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ledger-bill-pdf-upload-picker__btn > i {
    grid-row: 1 / span 2;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.ledger-bill-pdf-upload-picker__btn:hover {
    border-color: rgba(239, 68, 68, 0.34);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.08);
    transform: translateY(-1px);
}

.ledger-bill-pdf-upload-picker__btn-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.ledger-bill-pdf-upload-picker__btn-desc {
    font-size: 0.8rem;
    color: #64748b;
}

.ledger-bill-pdf-upload-picker__cancel {
    width: 100%;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.88rem;
    padding: 8px;
    cursor: pointer;
}

body.ledger-bill-pdf-upload-picker-open {
    overflow: hidden;
}

body.dark-theme .ledger-bill-pdf-upload-picker__panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-color: rgba(248, 113, 113, 0.24);
}

body.dark-theme .ledger-bill-pdf-upload-picker__title,
body.dark-theme .ledger-bill-pdf-upload-picker__btn-title {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-pdf-upload-picker__desc,
body.dark-theme .ledger-bill-pdf-upload-picker__btn-desc,
body.dark-theme .ledger-bill-pdf-upload-picker__cancel {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-pdf-upload-picker__btn {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(248, 113, 113, 0.18);
}

.ledger-bill-pdf-password-prompt {
    position: fixed;
    inset: 0;
    z-index: 13100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ledger-bill-pdf-password-prompt.is-open {
    display: flex;
}

.ledger-bill-pdf-password-prompt__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
}

.ledger-bill-pdf-password-prompt__panel {
    position: relative;
    width: min(400px, 100%);
    border-radius: 18px;
    border: 1px solid rgba(239, 68, 68, 0.18);
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    padding: 20px;
}

.ledger-bill-pdf-password-prompt__head {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.ledger-bill-pdf-password-prompt__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    flex-shrink: 0;
}

.ledger-bill-pdf-password-prompt__title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.ledger-bill-pdf-password-prompt__desc {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.45;
}

.ledger-bill-pdf-password-prompt__meta {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.12);
    background: rgba(248, 250, 252, 0.92);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ledger-bill-pdf-password-prompt__meta-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin: 0;
}

.ledger-bill-pdf-password-prompt__meta-row dt {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.02em;
}

.ledger-bill-pdf-password-prompt__meta-row dd {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 500;
    color: #0f172a;
    word-break: break-all;
    line-height: 1.4;
}

.ledger-bill-pdf-password-prompt__meta-row dd.is-muted {
    color: #94a3b8;
    font-weight: 400;
}

.ledger-bill-pdf-password-prompt__label {
    display: block;
    font-size: 0.84rem;
    color: #334155;
    margin-bottom: 6px;
}

.ledger-bill-pdf-password-prompt__input {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.95rem;
    margin-bottom: 14px;
}

.ledger-bill-pdf-password-prompt__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ledger-bill-pdf-password-prompt__btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.88rem;
    cursor: pointer;
}

.ledger-bill-pdf-password-prompt__btn.is-cancel {
    background: rgba(148, 163, 184, 0.16);
    color: #64748b;
}

.ledger-bill-pdf-password-prompt__btn.is-submit {
    background: #dc2626;
    color: #fff;
}

body.ledger-bill-pdf-password-prompt-open {
    overflow: hidden;
}

body.dark-theme .ledger-bill-pdf-password-prompt__panel {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(248, 113, 113, 0.24);
}

body.dark-theme .ledger-bill-pdf-password-prompt__title,
body.dark-theme .ledger-bill-pdf-password-prompt__label {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-pdf-password-prompt__desc {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-pdf-password-prompt__meta {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(248, 113, 113, 0.18);
}

body.dark-theme .ledger-bill-pdf-password-prompt__meta-row dt {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-pdf-password-prompt__meta-row dd {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-pdf-password-prompt__input {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
}

/* ---- Bill ledger settings: dark mode polish ---- */
body.dark-theme .ledger-bill-settings-menu-icon.is-gmail {
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.45);
}

body.dark-theme .ledger-bill-settings-menu-icon.is-connection,
body.dark-theme .ledger-bill-settings-menu-icon.is-general {
    color: #a5b4fc;
    border-color: rgba(165, 180, 252, 0.45);
}

body.dark-theme .ledger-bill-settings-menu-icon.is-pdf {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.45);
}

body.dark-theme .ledger-bill-sync-range-option,
body.dark-theme .ledger-bill-sync-range-option span {
    color: #e2e8f0;
}

body.dark-theme .ledger-bill-settings-note {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-settings-action,
body.dark-theme .ledger-bill-gmail-add-btn,
body.dark-theme .ledger-bill-pdf-add-btn,
body.dark-theme .ledger-bill-advanced-action-btn {
    background: transparent;
    border-color: rgba(129, 140, 248, 0.32);
    color: #c7d2fe;
    opacity: 1;
}

body.dark-theme .ledger-bill-settings-action.is-gmail,
body.dark-theme .ledger-bill-gmail-add-btn {
    border-color: rgba(147, 197, 253, 0.38);
    color: #93c5fd;
}

body.dark-theme .ledger-bill-settings-action.is-pdf,
body.dark-theme .ledger-bill-pdf-add-btn,
body.dark-theme .ledger-bill-pdf-edit-save-btn {
    border-color: rgba(252, 165, 165, 0.38);
    color: #fca5a5;
    background: transparent;
}

body.dark-theme .ledger-bill-settings-action.is-general,
body.dark-theme .ledger-bill-advanced-action-btn {
    border-color: rgba(165, 180, 252, 0.38);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-settings-action.is-restore {
    border-color: rgba(251, 191, 36, 0.38);
    color: #fcd34d;
    background: transparent;
}

body.dark-theme .ledger-bill-gmail-empty-icon,
body.dark-theme .ledger-bill-gmail-account-avatar {
    background: transparent;
    border: 1.5px solid rgba(147, 197, 253, 0.38);
    color: #93c5fd;
}

body.dark-theme .ledger-bill-pdf-empty-icon {
    background: transparent;
    border: 1.5px solid rgba(252, 165, 165, 0.38);
    color: #fca5a5;
}

body.dark-theme .ledger-bill-pdf-accounts-empty {
    background: rgba(127, 29, 29, 0.12);
    border-color: rgba(252, 165, 165, 0.28);
}

body.dark-theme .ledger-bill-pdf-acc-edit,
body.dark-theme .ledger-bill-pdf-edit-cancel-btn {
    background: transparent;
    border-color: rgba(165, 180, 252, 0.35);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-pdf-acc-del {
    background: transparent;
    border-color: rgba(252, 165, 165, 0.35);
    color: #fca5a5;
}

body.dark-theme .ledger-bill-pdf-edit-card {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92), rgba(35, 39, 62, 0.88));
    border-color: rgba(252, 165, 165, 0.24);
}

body.dark-theme .ledger-bill-inline-action-btn,
body.dark-theme .ledger-bill-label-chip {
    background: transparent;
    border-color: rgba(129, 140, 248, 0.32);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-label-chip:hover {
    background: rgba(99, 102, 241, 0.14);
}

body.dark-theme .ledger-bill-builtin-list {
    background: rgba(15, 23, 42, 0.35);
    border-color: rgba(129, 140, 248, 0.22);
    color: #cbd5e1;
}

body.dark-theme .ledger-bill-tutorial-open-btn,
body.dark-theme .ledger-bill-tutorial-link,
body.dark-theme .ledger-bill-scope-copy-btn,
body.dark-theme .ledger-bill-copy-origin-btn,
body.dark-theme .ledger-bill-scope-chip {
    background: transparent;
    border-color: rgba(129, 140, 248, 0.35);
    color: #c7d2fe;
}

body.dark-theme .ledger-bill-tutorial-open-btn:hover,
body.dark-theme .ledger-bill-tutorial-link:hover,
body.dark-theme .ledger-bill-scope-copy-btn:hover,
body.dark-theme .ledger-bill-copy-origin-btn:hover,
body.dark-theme .ledger-bill-scope-chip:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(165, 180, 252, 0.45);
    box-shadow: none;
}

body.dark-theme .ledger-bill-tutorial-hero-icon {
    background: transparent;
    border: 1.5px solid rgba(147, 197, 253, 0.42);
    color: #93c5fd;
}

body.dark-theme .ledger-bill-tutorial-figure {
    border-color: rgba(129, 140, 248, 0.22);
}

body.dark-theme .ledger-bill-tutorial-figure figcaption {
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    border-top: 1px solid rgba(129, 140, 248, 0.18);
}

body.dark-theme .ledger-bill-connection-info-title {
    color: #a5b4fc;
}

body.dark-theme .ledger-bill-connection-radio-desc {
    color: #94a3b8;
}

body.dark-theme .ledger-bill-connection-choice.is-selected .ledger-bill-connection-radio-desc {
    color: #cbd5e1;
}

body.dark-theme .ledger-bill-client-id-status.is-valid {
    color: #6ee7b7;
}

body.dark-theme .ledger-bill-client-id-status.is-invalid {
    color: #fca5a5;
}

body.dark-theme .ledger-bill-pdf-password-prompt__btn.is-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: #cbd5e1;
}

body.dark-theme .ledger-bill-pdf-password-prompt__btn.is-submit {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

body.dark-theme .ledger-bill-pdf-password-prompt__icon {
    background: transparent;
    border: 1.5px solid rgba(165, 180, 252, 0.38);
    color: #a5b4fc;
}

.ledger-bill-tier-lock-card {
    padding: 24px 20px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.88) 100%);
    text-align: center;
}

.ledger-bill-tier-lock-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, 0.18);
    color: #64748b;
    font-size: 1.1rem;
}

.ledger-bill-tier-lock-title {
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.ledger-bill-tier-lock-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.65;
    margin: 0 0 16px;
}

body.dark-theme .ledger-bill-tier-lock-card {
    background: linear-gradient(180deg, rgba(43, 48, 76, 0.92) 0%, rgba(35, 39, 62, 0.88) 100%);
    border-color: rgba(148, 163, 184, 0.28);
}

body.dark-theme .ledger-bill-tier-lock-icon {
    background: rgba(148, 163, 184, 0.16);
    color: #94a3b8;
}

body.dark-theme .ledger-bill-tier-lock-title { color: #e2e8f0; }
body.dark-theme .ledger-bill-tier-lock-desc { color: #94a3b8; }

body.dark-theme .ledger-bill-ledger-header-btn.is-tier-locked {
    opacity: 0.42;
    filter: grayscale(0.9);
}
