* {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.panel-card {
    border: 1px solid rgb(226 232 240);
    border-radius: 16px;
    background: white;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

main {
    padding-bottom: env(safe-area-inset-bottom);
}

.dark .panel-card {
    border-color: rgb(30 41 59);
    background: rgb(15 23 42);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.login-screen {
    background:
        radial-gradient(circle at top left, rgba(45, 212, 191, 0.22), transparent 34rem),
        linear-gradient(135deg, #020617, #111827 52%, #0f172a);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0;
}

.stat-card {
    min-height: 112px;
    border: 1px solid rgb(226 232 240);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    padding: 1.2rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.stat-card span {
    display: block;
    color: rgb(100 116 139);
    font-size: 0.82rem;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 0.85rem;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 800;
}

.dark .stat-card {
    border-color: rgb(30 41 59);
    background: linear-gradient(180deg, #111827, #0f172a);
}

.dark .stat-card span {
    color: rgb(148 163 184);
}

.btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 11px;
    padding: 0.65rem 1rem;
    font-weight: 800;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #0f172a;
    color: white;
}

.btn-primary:hover {
    background: #1e293b;
}

.dark .btn-primary {
    background: white;
    color: #0f172a;
}

.btn-secondary {
    border: 1px solid rgb(226 232 240);
    background: white;
    color: #0f172a;
}

.dark .btn-secondary {
    border-color: rgb(51 65 85);
    background: rgb(15 23 42);
    color: white;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.icon-btn {
    display: grid;
    height: 42px;
    min-width: 42px;
    width: 42px;
    flex: 0 0 42px;
    place-items: center;
    border: 1px solid rgb(226 232 240);
    border-radius: 12px;
    background: white;
    font-weight: 900;
}

.brand-logo {
    height: 44px;
    width: 44px;
    flex: 0 0 44px;
    border-radius: 12px;
    object-fit: contain;
    background: white;
}

.topbar-logo {
    display: none;
}

.dark .icon-btn {
    border-color: rgb(51 65 85);
    background: rgb(15 23 42);
}

.nav-link {
    display: block;
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    color: rgb(71 85 105);
    font-weight: 800;
}

.nav-link:hover,
.nav-link.active {
    background: rgb(241 245 249);
    color: rgb(15 23 42);
}

.dark .nav-link {
    color: rgb(203 213 225);
}

.dark .nav-link:hover,
.dark .nav-link.active {
    background: rgb(30 41 59);
    color: white;
}

.mobile-nav {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
}

.mobile-nav a {
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
    color: rgb(71 85 105);
    font-size: 0.85rem;
    font-weight: 800;
}

.dark .mobile-nav a {
    color: rgb(203 213 225);
}

.form-label {
    display: block;
    color: rgb(71 85 105);
    font-size: 0.78rem;
    font-weight: 800;
}

.dark .form-label {
    color: rgb(203 213 225);
}

.form-input {
    width: 100%;
    border: 1px solid rgb(203 213 225);
    border-radius: 12px;
    background: white;
    padding: 0.78rem 0.9rem;
    color: rgb(15 23 42);
    outline: none;
}

.form-input:focus {
    border-color: #0f172a;
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

.dark .form-input {
    border-color: rgb(51 65 85);
    background: rgb(2 6 23);
    color: white;
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.method-option {
    position: relative;
    display: flex;
    min-height: 52px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(203 213 225);
    border-radius: 12px;
    background: white;
    padding: 0.8rem;
    text-align: center;
    font-weight: 800;
}

.method-option input {
    position: absolute;
    opacity: 0;
}

.method-option:has(input:checked) {
    border-color: #0f172a;
    background: #0f172a;
    color: white;
}

.dark .method-option {
    border-color: rgb(51 65 85);
    background: rgb(2 6 23);
}

.dark .method-option:has(input:checked) {
    border-color: white;
    background: white;
    color: #0f172a;
}

.table-wrap {
    overflow-x: auto;
}

.record-cards {
    display: none;
}

.data-table {
    width: 100%;
    min-width: 780px;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    border-bottom: 1px solid rgb(226 232 240);
    color: rgb(100 116 139);
    font-size: 0.76rem;
    font-weight: 800;
    padding: 0.8rem;
    text-align: left;
}

.data-table td {
    border-bottom: 1px solid rgb(241 245 249);
    padding: 0.9rem 0.8rem;
    vertical-align: middle;
}

.dark .data-table th {
    border-color: rgb(51 65 85);
    color: rgb(148 163 184);
}

.dark .data-table td {
    border-color: rgb(30 41 59);
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgb(226 232 240);
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 800;
}

.dark .pill {
    background: rgb(30 41 59);
}

.link {
    color: #0f766e;
    font-weight: 800;
}

.danger-link {
    color: #dc2626;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    white-space: nowrap;
}

.dark .link {
    color: #5eead4;
}

.empty-state {
    padding: 2.5rem 1rem !important;
    text-align: center;
    color: rgb(100 116 139);
}

.message {
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-weight: 700;
}

.message-success {
    background: #ecfdf5;
    color: #047857;
}

.message-error {
    background: #fef2f2;
    color: #b91c1c;
}

.field-error,
.form-error {
    margin-top: 0.4rem;
    display: block;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 640px) {
    body {
        background: rgb(248 250 252);
    }

    .dark body {
        background: rgb(2 6 23);
    }

    main {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 1rem !important;
    }

    .panel-card {
        border-radius: 18px;
        padding: 1rem !important;
    }

    .quick-add-card {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .stat-card {
        min-height: 98px;
        border-radius: 14px;
        padding: 0.9rem;
    }

    .stat-card span {
        font-size: 0.74rem;
    }

    .stat-card strong {
        margin-top: 0.65rem;
        font-size: 1.12rem;
        line-height: 1.2;
    }

    .mobile-nav {
        padding-left: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }

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

    .mobile-nav a {
        background: rgb(248 250 252);
        padding: 0.62rem 0.85rem;
    }

    .dark .mobile-nav a {
        background: rgb(15 23 42);
    }

    .form-input {
        min-height: 52px;
        border-radius: 14px;
        font-size: 1rem;
    }

    .quick-form input[name="amount"] {
        min-height: 64px;
        font-size: 1.75rem;
    }

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

    .method-option {
        min-height: 58px;
        border-radius: 14px;
        font-size: 1rem;
    }

    .btn {
        width: 100%;
        min-height: 48px;
        border-radius: 14px;
    }

    header .btn,
    header .icon-btn {
        width: auto;
        min-height: 42px;
    }

    .topbar-logo {
        display: block;
        height: 38px;
        width: 38px;
        flex-basis: 38px;
        border-radius: 10px;
    }

    header .icon-btn {
        width: 46px;
        min-width: 46px;
        flex-basis: 46px;
        padding: 0;
    }

    .filter-actions,
    .export-actions {
        width: 100%;
    }

    .export-actions {
        display: grid;
        grid-template-columns: 0.8fr 1.2fr;
    }

    .table-wrap {
        display: none;
    }

    .record-cards {
        display: grid;
        gap: 0.85rem;
    }

    .record-card {
        border: 1px solid rgb(226 232 240);
        border-radius: 16px;
        background: rgb(248 250 252);
        padding: 0.95rem;
    }

    .dark .record-card {
        border-color: rgb(30 41 59);
        background: rgb(2 6 23);
    }

    .record-card-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .record-card-head strong {
        display: block;
        font-size: 1.25rem;
        font-weight: 900;
        line-height: 1.2;
    }

    .record-card-head span:not(.pill) {
        display: block;
        margin-top: 0.25rem;
        color: rgb(100 116 139);
        font-size: 0.82rem;
        font-weight: 700;
    }

    .dark .record-card-head span:not(.pill) {
        color: rgb(148 163 184);
    }

    .record-card dl {
        margin-top: 0.85rem;
        display: grid;
        gap: 0.55rem;
    }

    .record-card dl div {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border-top: 1px solid rgb(226 232 240);
        padding-top: 0.55rem;
    }

    .dark .record-card dl div {
        border-color: rgb(30 41 59);
    }

    .record-card dt {
        color: rgb(100 116 139);
        font-size: 0.78rem;
        font-weight: 800;
    }

    .record-card dd {
        max-width: 60%;
        text-align: right;
        font-weight: 700;
        overflow-wrap: anywhere;
    }

    .record-actions {
        margin-top: 0.9rem;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .mobile-empty {
        border: 1px dashed rgb(203 213 225);
        border-radius: 16px;
        padding: 1.5rem;
        text-align: center;
        color: rgb(100 116 139);
        font-weight: 700;
    }
}
