:root {
    --bg-soft: #f5f7fb;
    --bg-strong: #eef2f7;
    --card-white: #ffffff;
    --primary-accent: #ff5a5f;
    --primary-accent-dark: #ef4444;
    --text-dark: #162033;
    --text-muted: #677489;
    --text-soft: #8a95a8;
    --input-border: #d8e0ea;
    --line-color: #e7ecf2;
    --success-soft: #effaf3;
    --success-text: #15803d;
    --danger-soft: #fff2f2;
    --danger-text: #dc2626;
    --error-bg: #fff1f2;
    --error-border: #fecdd3;
    --error-text: #be123c;
    --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-dark);
    background: var(--bg-soft);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-page {
    background:
        radial-gradient(circle at top left, rgba(255, 90, 95, 0.10), transparent 32%),
        linear-gradient(180deg, #fcfcfd 0%, #f6f8fb 100%);
    min-height: 100vh;
}

.login-shell {
    min-height: calc(100vh - 90px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--card-white);
    padding: 40px 32px;
    border-radius: 32px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.welcome-title {
    text-align: center;
    margin-bottom: 28px;
}

.welcome-title h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.welcome-title p {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.6;
}

.alert-box {
    border-radius: 16px;
    padding: 14px 16px;
    margin: 0 0 18px;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.alert-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.alert-box strong,
.alert-box span {
    display: block;
}

.alert-box strong {
    margin-bottom: 6px;
}

.alert-box span {
    font-weight: 600;
    line-height: 1.5;
}

.alert-error {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}

.alert-success {
    background: var(--success-soft);
    border-color: #b7ebc6;
    color: var(--success-text);
}

.login-form,
.finance-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group label,
.dashboard-form-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.92rem;
    font-weight: 700;
}

.form-group input,
.dashboard-form-group input,
.dashboard-form-group select {
    width: 100%;
    padding: 16px;
    background: #ffffff;
    border: 2px solid var(--input-border);
    border-radius: 16px;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 500;
}

.form-textarea {
    width: 100%;
    padding: 16px;
    background: #ffffff;
    border: 2px solid var(--input-border);
    border-radius: 16px;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 500;
    resize: vertical;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 88px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-login,
.btn-dark,
.btn-light,
.logout-link,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 14px 20px;
    border-radius: 16px;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn-login {
    width: 100%;
    background: var(--primary-accent);
    color: #ffffff;
    border: none;
    box-shadow: 0 12px 24px rgba(255, 90, 95, 0.22);
    cursor: pointer;
}

.btn-dark,
.logout-link {
    background: #101828;
    color: #ffffff;
    border: 1px solid #101828;
}

.btn-light {
    background: #ffffff;
    color: var(--text-dark);
    border: 1px solid var(--line-color);
}

.btn-danger {
    background: #ffffff;
    color: var(--danger-text);
    border: 1px solid #fecaca;
}

.btn-dark:hover,
.btn-light:hover,
.btn-danger:hover,
.logout-link:hover,
.btn-login:hover {
    transform: translateY(-1px);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line-color);
}

.site-header-inner,
.site-footer-inner {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header-inner {
    min-height: 84px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.site-brand-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-accent);
}

.site-brand-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.top-nav-link {
    padding: 12px 16px;
    border-radius: 14px;
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}

.top-nav-link.active,
.top-nav-link:hover {
    color: var(--primary-accent);
    background: rgba(255, 90, 95, 0.10);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary-accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.header-user-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-user-meta strong {
    font-size: 0.95rem;
}

.header-user-meta span {
    color: var(--text-soft);
    font-size: 0.84rem;
}

.menu-toggle {
    display: none;
    border: none;
    background: #101828;
    color: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
}

.dashboard-main {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 36px;
}

.page-head,
.dashboard-hero,
.stats-card,
.panel-card {
    background: #ffffff;
    border: 1px solid var(--line-color);
    border-radius: 24px;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.04);
}

.page-head {
    padding: 28px;
    margin-bottom: 20px;
}

.page-head h1 {
    margin: 0 0 10px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.page-head p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 760px;
}

.toolbar-card {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    border: 1px solid var(--line-color);
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.04);
}

.toolbar-search {
    flex: 1;
}

.toolbar-search label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.92rem;
    font-weight: 700;
}

.toolbar-search input {
    width: 100%;
    padding: 16px;
    background: #ffffff;
    border: 2px solid var(--input-border);
    border-radius: 16px;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 500;
}

.dashboard-hero {
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 90, 95, 0.10);
    color: var(--primary-accent);
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.dashboard-hero h1 {
    margin: 0 0 10px;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.dashboard-hero p {
    margin: 0;
    max-width: 760px;
    color: var(--text-muted);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stats-card {
    padding: 22px;
}

.stats-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.stats-value {
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    margin-bottom: 12px;
}

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

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

.stats-note {
    display: block;
    color: var(--text-soft);
    font-size: 0.9rem;
    line-height: 1.5;
}

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

.admin-grid {
    grid-template-columns: 400px minmax(0, 1fr);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-stats-grid {
    margin-bottom: 20px;
}

.panel-card {
    padding: 24px;
    min-width: 0;
}

.panel-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.panel-card-head-compact {
    align-items: center;
}

.panel-card-head h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.panel-card-head span {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.btn-full {
    width: 100%;
}

.btn-flex {
    flex: 1;
}

.btn-small {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
}

.form-actions-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-actions-stretch > * {
    min-width: 150px;
}

.switch-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.switch-row input {
    width: 18px;
    height: 18px;
}

.detail-list {
    display: grid;
    gap: 14px;
    margin-bottom: 20px;
}

.detail-list div {
    display: grid;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-color);
}

.detail-list strong {
    font-size: 0.9rem;
}

.detail-list span {
    color: var(--text-muted);
    line-height: 1.6;
}

.form-grid-two,
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.filter-actions {
    display: flex;
    align-items: end;
    gap: 12px;
}

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

.finance-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

.finance-table th,
.finance-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--line-color);
    text-align: left;
    font-size: 0.95rem;
}

.finance-table th {
    color: var(--text-soft);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.finance-table tbody tr:last-child td {
    border-bottom: none;
}

.align-right {
    text-align: right !important;
}

.inline-form {
    display: inline;
}

.table-actions {
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    min-width: 104px;
}

.is-disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.admin-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-cell strong {
    font-size: 0.96rem;
}

.admin-cell span,
.self-note {
    color: var(--text-soft);
    font-size: 0.86rem;
}

.empty-state {
    text-align: center !important;
    color: var(--text-soft);
    padding: 28px 16px !important;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-badge.income {
    background: var(--success-soft);
    color: var(--success-text);
}

.status-badge.expense {
    background: var(--danger-soft);
    color: var(--danger-text);
}

.site-footer {
    border-top: 1px solid var(--line-color);
    background: #ffffff;
}

.site-footer-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 1200px) {
    .site-header-inner {
        grid-template-columns: auto auto;
    }

    .top-nav {
        grid-column: 1 / -1;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }

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

    .content-grid,
    .admin-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .site-header-inner {
        width: calc(100% - 24px);
        min-height: 76px;
        grid-template-columns: auto auto;
        gap: 14px;
        padding: 12px 0;
    }

    .menu-toggle {
        display: inline-flex;
        justify-self: end;
    }

    .top-nav {
        display: none;
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: stretch;
        background: #ffffff;
        border: 1px solid var(--line-color);
        border-radius: 18px;
        padding: 10px;
        overflow: hidden;
    }

    .top-nav.open {
        display: flex;
    }

    .header-actions {
        grid-column: 1 / -1;
        justify-content: space-between;
        width: 100%;
    }

    .dashboard-main {
        width: calc(100% - 24px);
        padding: 18px 0 28px;
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .hero-actions,
    .btn-dark,
    .btn-light,
    .logout-link,
    .btn-danger {
        width: 100%;
    }

    .toolbar-card,
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions-inline {
        flex-direction: column;
    }

    .form-grid-two,
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .site-footer-inner {
        width: calc(100% - 24px);
        min-height: auto;
        padding: 18px 0;
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .login-shell {
        padding: 16px;
    }

    .login-card,
    .page-head,
    .dashboard-hero,
    .panel-card,
    .stats-card {
        padding: 18px;
        border-radius: 20px;
    }

    .welcome-title h1,
    .page-head h1,
    .dashboard-hero h1 {
        font-size: 1.8rem;
    }

    .header-user-meta {
        display: none;
    }

    .finance-table {
        min-width: 540px;
    }
}
