.theme-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid #cad5e5;
    border-radius: 12px;
    background: #f7faff;
    color: #243651;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: transform .16s ease, background-color .16s ease, border-color .16s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: #edf4ff;
    border-color: #aabbd4;
}

[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e7eefb;
    --muted: #9eacc3;
    --line: #263653;
    --soft: #101a2e;
    --deep: #eef4ff;
    --green: #35d391;
    --red: #ff7183;
    --shadow: 0 18px 50px rgba(0, 0, 0, .26);
}

[data-theme="dark"] body {
    color: var(--ink);
    background: linear-gradient(135deg, #0b1220, #101a2e);
}

[data-theme="dark"] .topbar {
    background: rgba(10, 18, 32, .94);
}

[data-theme="dark"] .topbar nav a,
[data-theme="dark"] .topbar .user {
    color: #aebbd0;
}

[data-theme="dark"] .topbar nav a:hover,
[data-theme="dark"] td a,
[data-theme="dark"] .section-title a {
    color: #64a1ff;
}

[data-theme="dark"] .theme-toggle {
    color: #ffd166;
    background: #16243d;
    border-color: #344766;
}

[data-theme="dark"] .theme-toggle:hover {
    background: #203252;
    border-color: #4a638b;
}

[data-theme="dark"] .stats > div,
[data-theme="dark"] .panel,
[data-theme="dark"] .balance-card,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .login-card,
[data-theme="dark"] .error-card,
[data-theme="dark"] .danger-card,
[data-theme="dark"] .report-chart-card,
[data-theme="dark"] .report-summary,
[data-theme="dark"] .csv-card,
[data-theme="dark"] .csv-help {
    background: #121e33;
    border-color: var(--line);
}

[data-theme="dark"] th {
    background: #17253d;
    color: #a8b7ce;
}

[data-theme="dark"] th,
[data-theme="dark"] td {
    border-color: var(--line);
}

[data-theme="dark"] .form input,
[data-theme="dark"] .form textarea,
[data-theme="dark"] .form select,
[data-theme="dark"] .search input,
[data-theme="dark"] .csv-upload input[type="file"] {
    color: var(--ink);
    background: #0e192b;
    border-color: #344766;
}

[data-theme="dark"] .button {
    color: #dce7f8;
    background: #182740;
    border-color: #344766;
}

[data-theme="dark"] .button.primary {
    color: #fff;
    background: linear-gradient(135deg, #1676ff, #0754db);
    border-color: transparent;
}

[data-theme="dark"] .button.danger-outline {
    color: #ff8997;
    background: #251923;
    border-color: #793745;
}

[data-theme="dark"] .button.danger {
    color: #fff;
    background: #ce4053;
    border-color: #ce4053;
}

[data-theme="dark"] .row-actions .view-action {
    color: #c1cde0;
    background: #1b2940;
    border-color: #34445f;
}

[data-theme="dark"] .row-actions .edit-action {
    color: #82b5ff;
    background: #10284b;
    border-color: #28538c;
}

[data-theme="dark"] .row-actions .delete-action {
    color: #ff8997;
    background: #301a25;
    border-color: #6f3441;
}

[data-theme="dark"] .entry-row-actions .edit-action {
    color: #82b5ff;
    background: #10284b;
    border-color: #28538c;
}

[data-theme="dark"] .entry-row-actions .delete-action {
    color: #ff8997;
    background: #301a25;
    border-color: #6f3441;
}

[data-theme="dark"] .pagination-button {
    color: #82b5ff;
    background: #182740;
    border-color: #344766;
}

[data-theme="dark"] .pagination-button.disabled {
    color: #65748c;
    background: #111d31;
}

[data-theme="dark"] .button.warning-outline {
    color: #f4c66f;
    background: #312714;
    border-color: #765a28;
}

[data-theme="dark"] .button.warning {
    color: #fff;
    background: #a96808;
    border-color: #c98724;
}

[data-theme="dark"] .status-badge.defaulter,
[data-theme="dark"] .archived-banner {
    color: #f4c66f;
    background: #382b14;
    border-color: #715625;
}

[data-theme="dark"] .archive-card {
    background: #121e33;
    border-color: #715625;
}

[data-theme="dark"] .interest-settings {
    background: #10213c;
    border-color: #315586;
}

[data-theme="dark"] .interest-toggle span {
    background: #52647f;
}

[data-theme="dark"] .interest-toggle input:checked + span {
    background: #1676ff;
}

[data-theme="dark"] .defaulter-total-card {
    color: #f4c66f;
    background: linear-gradient(135deg, #382b14, #2c2314);
    border-color: #715625;
}

[data-theme="dark"] .defaulter-total-card span,
[data-theme="dark"] .defaulter-total-card small {
    color: #d5b77d;
}

[data-theme="dark"] .defaulter-total-card strong {
    color: #f4c66f;
}

[data-theme="dark"] .pie-chart > div {
    background: #121e33;
}

[data-theme="dark"] .csv-step {
    color: #82b5ff;
    background: #10284b;
}

[data-theme="dark"] .flash.success,
[data-theme="dark"] .badge.credit {
    color: #58e0a5;
    background: #123529;
}

[data-theme="dark"] .badge.debit {
    color: #ff8997;
    background: #3a1c27;
}

[data-theme="dark"] .chart-empty {
    border-color: #344766;
}

[data-theme="dark"] .entry-type-field legend {
    color: #b8c5d9;
}

[data-theme="dark"] .debit-option span {
    color: #ff8997;
    background: #301a25;
    border-color: #6f3441;
}

[data-theme="dark"] .credit-option span {
    color: #58e0a5;
    background: #123529;
    border-color: #286c52;
}

[data-theme="dark"] .debit-option input:checked + span {
    color: #fff;
    background: #ce4053;
    border-color: #ce4053;
}

[data-theme="dark"] .credit-option input:checked + span {
    color: #fff;
    background: #098a58;
    border-color: #098a58;
}

@media (max-width: 760px) {
    .theme-toggle {
        width: 36px;
        height: 36px;
    }
}
