*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f5f8fc;
    --bg-soft: #ffffff;
    --bg-elev: #ffffff;
    --surface: #ffffff;
    --border: #e5eaf2;
    --border-soft: #eef2f7;
    --text: #0f172a;
    --text-soft: #475569;
    --text-mute: #94a3b8;
    --primary: #0ea5e9;
    --primary-600: #0284c7;
    --primary-50: #f0f9ff;
    --accent: #6366f1;
    --success: #10b981;
    --success-50: #ecfdf5;
    --warning: #f59e0b;
    --warning-50: #fffbeb;
    --danger: #ef4444;
    --danger-50: #fef2f2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 4px 14px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .08);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

[data-theme="dark"] {
    --bg: #0b1220;
    --bg-soft: #0f172a;
    --bg-elev: #111a2e;
    --surface: #111a2e;
    --border: #1f2a44;
    --border-soft: #18223a;
    --text: #e6edf7;
    --text-soft: #a9b4c9;
    --text-mute: #6b7794;
    --primary: #38bdf8;
    --primary-600: #0ea5e9;
    --primary-50: #0b1a2b;
    --accent: #818cf8;
    --success: #34d399;
    --success-50: #0d2a22;
    --warning: #fbbf24;
    --warning-50: #2a2210;
    --danger: #f87171;
    --danger-50: #2a1214;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 6px 18px rgba(0, 0, 0, .35);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, .45);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-bottom: calc(75px + env(safe-area-inset-bottom));
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

a {
    color: var(--primary-600);
    text-decoration: none;
}

::selection {
    background: var(--primary);
    color: #fff;
}

/* Layout */
.app {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 14px 80px;
}

@media(min-width:768px) {
    .app {
        padding: 24px 22px 80px;
    }
}

header.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 20px;
    box-shadow: var(--shadow);
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.1
}

.top-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: right;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-soft);
    transition: .15s;
}

.icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.card.pilih-strategi {
    margin: 25px 0;
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
}

.card+.card {
    margin-top: 14px;
}

.card h2 {
    font-size: 15px;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h3 {
    font-size: 14px;
    margin: 0 0 8px;
    color: var(--text-soft);
}

.muted {
    color: var(--text-mute);
    font-size: 13px;
}

.to-debt-free {
    color: var(--text-mute);
    margin: 5px 0 -6px;
    font-size: 11px;
    line-height: normal;
}

/* Grid */
.grid {
    display: grid;
    gap: 14px;
}

.grid-2 {
    grid-template-columns: 1fr;
}

.grid-3 {
    grid-template-columns: 1fr;
}

.grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

@media(min-width:768px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    transition: .15s;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-600);
}

.btn-upgrade {
    background: #fff;
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--bg-soft);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(.95);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    filter: brightness(.95);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: right;
}

.btn-row.btn-extra {
    justify-content: left;
}

/* Form */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 600;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    transition: .15s;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}

.input.error {
    border-color: var(--danger);
}

.err {
    color: var(--danger);
    font-size: 12px;
    margin-top: 2px;
    min-height: 0;
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

@media(max-width:480px) {
    .row-3 {
        grid-template-columns: 1fr 1fr;
    }
}

/* BOTTOM NAVIGATION (Mobile App Style) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    /* Sokongan iPhone */
    z-index: 100;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    scrollbar-width: none;
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

@media(min-width:768px) {
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
        border: 1px solid var(--border);
        border-bottom: none;
    }
}

.nav-item {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 2px;
    font-size: 10px;
    color: var(--text-mute);
    border: none;
    background: none;
    cursor: pointer;
    transition: .15s;
}

.nav-item .icon {
    font-size: 20px;
    margin-bottom: 2px;
    transition: .15s;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-item.active .icon {
    transform: translateY(-2px);
}

/* Strategy pills */
.strat-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.strat-pill {
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    text-align: center;
    transition: .15s;
}

.strat-pill .emoji {
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

.strat-pill .name {
    font-weight: 700;
    font-size: 13px;
}

.strat-pill .desc {
    font-size: 11px;
    color: var(--text-mute);
    margin-top: 2px;
}

.strat-pill.active {
    border-color: var(--primary);
    background: var(--primary-50);
    color: var(--primary);
}

[data-theme="dark"] .strat-pill.active {
    color: #bae6fd;
}

/* Debt list */
.debt-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
}

.debt-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.debt-name {
    font-weight: 700;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.debt-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    font-size: 12px;
}

.debt-meta div {
    background: var(--surface);
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}

.debt-meta .lbl {
    color: var(--text-mute);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.debt-meta .val {
    font-weight: 700;
    font-size: 13px;
}

.debt-actions {
    display: flex;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px dashed var(--primary);
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-50);
    color: var(--primary);
}

.chip.success,
.chip.tracker {
    background: var(--success-50);
    color: var(--success);
    border-color: var(--success);
}

.chip.warn {
    background: var(--warning-50);
    color: var(--warning);
}

.chip.danger {
    background: var(--danger-50);
    color: var(--danger);
}

/* Countdown */
.countdown {
    text-align: center;
    padding: 20px 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: var(--shadow);
}

.countdown .big {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.5px;
}

.countdown .sub {
    opacity: .9;
    font-size: 13px;
    margin-top: 6px;
}

.countdown.done {
    background: linear-gradient(135deg, var(--success), #059669);
}

/* Progress bar */
.progress-wrap {
    margin-top: 10px;
}

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
    transition: width .4s;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 6px;
}

/* Stat card */
.stat {
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
}

.stat .lbl {
    font-size: 11px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.stat .val {
    font-size: 18px;
    font-weight: 700;
    margin-top: 4px;
}

.stat .val.sm {
    font-size: 15px;
}

.stat .hint {
    font-size: 11px;
    color: var(--text-mute);
    margin-top: 2px;
}

.tl-item {
    position: relative;
    padding: 8px 0 14px;
}

.tl-item::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--primary);
}

.tl-item.done::before {
    background: var(--success);
    border-color: var(--success);
}

.tl-item.final::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .15);
}

.tl-title {
    font-weight: 700;
    font-size: 13px;
}

.tl-desc {
    font-size: 12px;
    color: var(--text-soft);
}

/* Monthly plan */
.month-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-soft);
}

.month-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.month-num {
    font-weight: 800;
    font-size: 14px;
}

.pay-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.pay-row:last-child {
    border-bottom: none;
}

.pay-row .name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.pay-row .name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pay-row .amt {
    font-weight: 700;
    white-space: nowrap;
}

.pay-row.focus {
    background: rgba(187, 225, 243, 0.25);
    border-radius: 8px;
    padding: 6px 8px;
    margin: 2px -4px;
}

[data-theme="dark"] .pay-row.focus {
    color: #bae6fd;
}

/* Compare */
.compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compare-card {
    position: relative;
    padding: 20px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    text-align: center;
    align-content: center;
}

.compare-card .emoji {
    font-size: 22px;
}

.compare-card .name {
    font-weight: 800;
    font-size: 14px;
    margin-top: 4px;
}

.compare-card .big {
    font-size: 20px;
    font-weight: 800;
    margin-top: 6px;
}

.compare-card .row {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 4px;
}

.compare-winner {
    border-color: var(--primary-50);
    box-shadow: 0 0 0 2px rgb(10 200 112 / 35%)
}

.compare-card.locked {
    cursor: default;
}

.compare-card.locked.dim {
    opacity: .45;
    filter: grayscale(.6);
}

.compare-card.locked.selected {
    background: var(--primary-50);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, .35);
}

/* Badge pemenang */
.badge-winner {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 3px 15px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

/* Chart */
.chart-wrap {
    width: 100%;
    overflow: hidden;
}

svg.chart {
    width: 100%;
    height: auto;
    display: block;
}

/* Table */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 65vh;
    overflow-y: auto;
}

.info-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--primary);
    background: var(--primary-50);
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.5;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 500px;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px dashed var(--border-soft);
    border-right: 1px solid var(--border-soft);
}

th {
    background: var(--bg);
    font-weight: 700;
    font-size: 12px;
    color: var(--text-soft);
    position: sticky;
    top: 0;
    z-index: 2;
}

tr:last-child td {
    border-bottom: none;
}

td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.amort-load-more {
    text-align: center;
    margin-top: 12px;
}

/* Toast */
.toast-wrap {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
    width: calc(100% - 28px);
    max-width: 380px;
    bottom: calc(85px + env(safe-area-inset-bottom));
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    pointer-events: auto;
    animation: slide .25s ease;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.warn {
    border-left-color: var(--warning);
}

.toast.error {
    border-left-color: var(--danger);
}

@keyframes slide {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal */
.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal-back.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 18px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.modal p {
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 14px;
}

.modal.shake {
    animation: shake 0.4s;
}

.modal-list {
    padding: 0 0 12px 24px;
    font-size: 13px;
}

/* Onboarding */
.onb-step {
    display: none;
}

.onb-step.active {
    display: block;
}

.onb-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.onb-dot {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--border);
}

.onb-dot.done {
    background: var(--primary);
}

/* Empty state */
.empty {
    text-align: center;
    padding: 30px 16px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: var(--bg-soft);
}

.empty .emoji {
    font-size: 40px;
}

.empty .title {
    font-weight: 700;
    margin-top: 6px
}

.empty .desc {
    color: var(--text-soft);
    font-size: 13px;
    margin-top: 4px;
}

/* Success screen */
.success-screen {
    text-align: center;
    padding: 30px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.success-screen .big {
    font-size: 36px;
    font-weight: 700;
}

/* Pagination */
.pagination-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-mute);
    font-weight: 600;
}

.pagination-row button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Slider */
.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
}

/* Save status */
.save-status {
    position: fixed;
    right: 12px;
    bottom: 12px;
    font-size: 11px;
    color: var(--text-mute);
    background: var(--surface);
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    z-index: 50;
    bottom: calc(85px + env(safe-area-inset-bottom));
}

/* Section title */
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin: 18px 0 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-mute);
}

/* Matrix payment schedule */
table.matrix {
    min-width: 600px;
}

table.matrix td,
table.matrix th {
    padding: 10px;
    font-size: 12px;
}

table.matrix td.num {
    color: var(--text-soft);
}

/* ---------- Strategy Lock & Bulan Semasa ---------- */
.strat-pill {
    position: relative;
}

.pill-badge {
    position: absolute;
    top: auto;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: .4px;
    text-transform: uppercase;
    padding: 2px 9px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.month-card.current {
    border-color: var(--primary-50);
    background: var(--primary-50);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, .25);
}

.strat-select {
    cursor: pointer;
    transition: .15s;
}

.strat-select:hover {
    border-color: var(--primary-50);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, .35);
    background: var(--primary-50);
}

.strat-select.selected {
    border-color: var(--primary-50);
    background: var(--primary-50);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, .35);
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.input:disabled,
input[type="range"]:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Extra controls (custom + preset) */
.extra-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media(min-width:560px) {
    .extra-controls {
        grid-template-columns: 1fr 1fr;
    }
}

/* Utility */
.hide {
    display: none !important;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px
}

.mt-8 {
    margin-top: 8px;
}

.mt-12 {
    margin-top: 20px;
}

.mt-16 {
    margin-top: 16px;
}

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success);
}

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

.text-warn {
    color: var(--warning);
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* ========== Currency Picker ========== */
.cur-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cur-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-soft);
    text-align: left;
    transition: .15s;
}

.cur-item:hover {
    border-color: var(--primary);
}

.cur-item.active {
    border-color: var(--primary);
    background: var(--primary-50);
}

.cur-code {
    font-weight: 800;
    font-size: 13px;
    min-width: 44px;
}

.cur-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== Install Modal (Locked) ========== */
.modal-back.locked {
    /* Block pointer events pada backdrop — user tak boleh click luar */
    cursor: not-allowed;
}

.modal-back.locked .modal {
    animation: modalPulse 2s ease-in-out infinite alternate;
}

@keyframes modalPulse {
    from {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.3);
    }

    to {
        box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
    }
}

.install-modal-header {
    text-align: center;
    margin-bottom: 16px;
}

.install-modal-header .big-icon {
    font-size: 56px;
    margin-bottom: 8px;
    display: block;
}

.install-modal-header h3 {
    font-size: 18px;
    margin: 0 0 6px;
    color: var(--text);
}

.install-modal-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

.install-guide {
    background: var(--primary-50);
    border: 1px solid var(--primary);
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.install-guide strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.install-guide ol {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.6;
}

.install-guide ol li {
    margin-bottom: 2px;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* ========== Disabled Nav Items ========== */
.nav-item:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-item:disabled .icon {
    filter: grayscale(1);
}

.nav-item:disabled:hover {
    color: var(--text-mute);
}

/* License Modal */
.license-modal {
    text-align: center;
}

.license-header {
    margin-bottom: 20px;
}

.license-header .big-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 8px;
}

.license-header h3 {
    font-size: 18px;
    margin: 0 0 6px;
}

.license-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

#licenseInput {
    text-align: center;
}

/* Trial Banner */
.trial-banner {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    z-index: 50;
    position: sticky;
    top: 5px;
}

.trial-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.trial-icon {
    font-size: 20px;
}

.trial-text {
    flex: 1;
}

body.trial [data-trial-lock] {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(.5);
}

body.trial #btnDemo {
    display: none;
}

.trial-banner.shake {
    animation: shake 0.4s;
}

/* Locked features in trial mode */
.btn-ghost:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Print */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: #fff;
        color: #000;
        padding-bottom: 0;
    }

    .hide {
        display: block !important;
    }

    .no-print,
    .top-actions,
    .icon-btn,
    .btn,
    .toast-wrap,
    .save-status,
    .bottom-nav,
    .amort-load-more,
    .strat-pills,
    #cardTarget {
        display: none !important;
    }

    .table-wrap {
        max-height: none !important;
        overflow: visible !important;
        border: none;
    }

    table {
        min-width: 0 !important;
    }

    th {
        position: static;
    }

    .app {
        max-width: 100%;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    #view-dashboard {
        order: 1;
    }

    #view-debts {
        order: 2;
    }

    #view-plan {
        order: 3;
    }

    #view-jadual {
        order: 4;
    }

    #view-tracker {
        order: 5;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: auto;
    }

    tr,
    .debt-item,
    .month-card,
    .stat {
        break-inside: avoid;
    }

    h2 {
        break-after: avoid;
    }

    section {
        margin-bottom: 24px;
    }
}