.button.danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.button.danger-outline {
    border-color: #f1b8c0;
    color: var(--red);
    background: #fff;
}

.danger-card {
    max-width: 620px;
    margin: 70px auto;
    padding: 38px;
    background: #fff;
    border: 1px solid #f0c4ca;
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.danger-card h1 {
    font-size: 32px;
    margin: 10px 0;
}

.danger-card p {
    color: var(--muted);
    line-height: 1.65;
}

.danger-card .actions {
    margin-top: 28px;
}

.danger-text {
    color: var(--red);
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.customer-name-link {
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.customer-name-link:hover {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.customer-actions-cell {
    width: 230px;
}

.row-actions .row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.row-actions .row-action:hover {
    transform: translateY(-1px);
}

.row-actions .view-action {
    color: #42516b;
    background: #f4f7fb;
    border-color: #dce4ef;
}

.row-actions .edit-action {
    color: var(--blue);
    background: #eef5ff;
    border-color: #bfd5fb;
}

.row-actions .delete-action {
    color: #c72f43;
    background: #fff1f3;
    border-color: #f4c2ca;
}

.row-actions .icon-action {
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.icon-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .head-actions {
        justify-content: flex-start;
    }
}

.csv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.csv-card,
.csv-help {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.csv-card {
    padding: 26px;
}

.csv-card-head > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.csv-card h2,
.csv-help h2 {
    margin: 0;
}

.csv-card-head > p,
.csv-upload small,
.csv-help {
    color: var(--muted);
}

.csv-card-head > p {
    line-height: 1.55;
    margin: 10px 0 22px;
}

.csv-step {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #eaf2ff;
    color: var(--blue);
    font-size: 12px;
    font-weight: 850;
}

.csv-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.csv-upload {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.csv-upload label {
    color: #42516b;
    font-size: 13px;
    font-weight: 750;
}

.csv-upload input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 9px;
    padding: 12px;
    border: 1px dashed #b9c8dd;
    border-radius: 11px;
    background: #f8faff;
    color: var(--muted);
}

.csv-upload small {
    line-height: 1.5;
}

.csv-upload .button {
    justify-self: start;
}

.csv-help {
    margin-top: 20px;
    padding: 24px 28px;
}

.csv-help ul {
    margin: 14px 0 0;
    padding-left: 20px;
    line-height: 1.8;
}

@media (max-width: 900px) {
    .csv-grid {
        grid-template-columns: 1fr;
    }
}

.entry-type-field {
    min-width: 0;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

.entry-type-field legend {
    margin-bottom: 8px;
    color: #42516b;
    font-size: 13px;
    font-weight: 750;
}

.entry-type-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.form .type-option {
    margin: 0;
    cursor: pointer;
}

.type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.type-option span {
    min-height: 44px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid;
    border-radius: 11px;
    font-weight: 800;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.type-option:hover span {
    transform: translateY(-1px);
}

.debit-option span {
    color: #c72f43;
    background: #fff5f6;
    border-color: #efb7c0;
}

.credit-option span {
    color: #08764c;
    background: #f0fbf6;
    border-color: #a9dfc8;
}

.debit-option input:checked + span {
    color: #fff;
    background: #d13b4d;
    border-color: #d13b4d;
    box-shadow: 0 7px 16px rgba(209, 59, 77, .22);
}

.credit-option input:checked + span {
    color: #fff;
    background: #0b9b63;
    border-color: #0b9b63;
    box-shadow: 0 7px 16px rgba(11, 155, 99, .22);
}

.type-option input:focus-visible + span {
    outline: 3px solid rgba(7, 93, 231, .2);
    outline-offset: 2px;
}

.save-entry-button:disabled {
    opacity: .7;
    cursor: wait;
    transform: none;
}

.entry-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.entry-row-actions .row-action {
    min-height: 32px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
}

.entry-row-actions .edit-action {
    color: var(--blue);
    background: #eef5ff;
    border-color: #bfd5fb;
}

.entry-row-actions .delete-action {
    color: #c72f43;
    background: #fff1f3;
    border-color: #f4c2ca;
}

.delete-entry-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 24px 0;
}

.delete-entry-summary > div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft);
}

.delete-entry-summary span,
.delete-entry-summary strong {
    display: block;
}

.delete-entry-summary span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 600px) {
    .delete-entry-summary {
        grid-template-columns: 1fr;
    }
}

.pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pagination-status,
.pagination > div > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.pagination > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-button {
    min-height: 38px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cad5e5;
    border-radius: 10px;
    background: #fff;
    color: var(--blue);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
}

.pagination-button.disabled {
    color: #99a6ba;
    background: #f3f6fa;
    cursor: not-allowed;
    pointer-events: none;
}

.button.warning,
.button.warning-outline {
    color: #9a5b00;
    border-color: #e8bd76;
}

.button.warning {
    color: #fff;
    background: #c77a08;
}

.button.warning-outline {
    background: #fff8e9;
}

.warning-text {
    color: #a96500;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .03em;
    vertical-align: middle;
}

.status-badge.defaulter {
    color: #9a5b00;
    background: #fff0cf;
}

.archive-card {
    max-width: 680px;
    margin: 70px auto;
    padding: 38px;
    background: #fff;
    border: 1px solid #ecd3a6;
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.archive-card h1 {
    margin: 10px 0;
    font-size: 32px;
}

.archive-card p {
    color: var(--muted);
    line-height: 1.65;
}

.archived-banner {
    margin-bottom: 18px;
    padding: 14px 18px;
    color: #855008;
    background: #fff3d8;
    border: 1px solid #edcf94;
    border-radius: 12px;
    font-weight: 700;
}

.interest-settings {
    margin: 8px 0 22px;
    padding: 22px;
    border: 1px solid #bed5fa;
    border-radius: 15px;
    background: #f5f9ff;
}

.form .interest-toggle {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
}

.interest-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.interest-toggle span {
    width: 44px;
    height: 24px;
    padding: 3px;
    display: block;
    flex: 0 0 auto;
    border-radius: 99px;
    background: #aebbd0;
    transition: background-color .16s ease;
}

.interest-toggle span::after {
    content: "";
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    transition: transform .16s ease;
}

.interest-toggle input:checked + span {
    background: var(--blue);
}

.interest-toggle input:checked + span::after {
    transform: translateX(20px);
}

.interest-toggle input:focus-visible + span {
    outline: 3px solid rgba(7,93,231,.2);
    outline-offset: 2px;
}

.interest-settings > p {
    margin: 8px 0 18px 55px;
    color: var(--muted);
    font-size: 13px;
}

.interest-settings .form-grid label {
    margin-bottom: 0;
}

.interest-settings input:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.defaulter-total-card {
    margin: -4px 0 22px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: #8a4e00;
    background: linear-gradient(135deg, #fff8e8, #ffefd0);
    border: 1px solid #edcf94;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.defaulter-total-card span,
.defaulter-total-card strong {
    display: block;
}

.defaulter-total-card span,
.defaulter-total-card small {
    color: #8f6a32;
    font-size: 13px;
    font-weight: 650;
}

.defaulter-total-card strong {
    margin-top: 4px;
    color: #b86400;
    font-size: 30px;
    letter-spacing: -.03em;
}

@media (max-width: 600px) {
    .defaulter-total-card {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .pagination > div {
        justify-content: space-between;
    }
}

.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
    gap: 18px;
    align-items: start;
}

.report-grid.two-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-grid.two-charts .default-chart-card {
    grid-column: 1 / -1;
}

.report-chart-card,
.report-summary {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.report-chart-card {
    padding: 26px;
}

.report-chart-card h2 {
    margin: 0 0 4px;
}

.report-chart-card > p {
    color: var(--muted);
    margin: 0 0 24px;
}

.pie-chart {
    width: min(280px, 75vw);
    aspect-ratio: 1;
    border-radius: 50%;
    margin: 12px auto 28px;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(9, 34, 77, .06);
}

.pie-chart > div {
    width: 54%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 5px 22px rgba(15, 48, 105, .12);
}

.pie-chart strong {
    font-size: 21px;
}

.pie-chart span,
.report-summary span,
.report-summary small {
    color: var(--muted);
    font-size: 13px;
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 22px;
}

.chart-legend a {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    text-decoration: none;
}

.chart-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.chart-legend span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-legend strong {
    font-size: 13px;
}

.chart-empty {
    min-height: 280px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 16px;
}

.report-summary {
    padding: 28px;
}

.report-summary span,
.report-summary small {
    display: block;
}

.report-summary strong {
    display: block;
    margin: 7px 0;
    font-size: 30px;
}

@media (max-width: 760px) {
    .report-grid,
    .chart-legend {
        grid-template-columns: 1fr;
    }

    .topbar nav a:not(.logout) {
        display: inline-flex;
    }

    .report-grid.two-charts {
        grid-template-columns: 1fr;
    }

    .report-grid.two-charts .default-chart-card {
        grid-column: auto;
    }
}
