:root,
:root[data-theme="dark"],
body[data-theme="dark"] {
    --primary: #941415;
    --primary-dark: #b71c1c;

    --background: #181818;
    --surface: #242424;
    --surface-light: #313131;

    --text: #ffffff;
    --text-secondary: #d6d6d6;
    --text-muted: #a0a0a0;

    --border: #3a3a3a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.28);
    --transition: all 0.25s ease;
    --container-width: 1280px;
    --header-height: 78px;
    --font-base: "Inter", "Segoe UI", Arial, sans-serif;

    --brand-logo-height-desktop: 44px;
    --brand-logo-height-mobile: 36px;
    --brand-logo-height-login: 82px;
}

:root[data-theme="light"],
body[data-theme="light"] {
    --primary: #941415;
    --primary-dark: #b71c1c;

    --background: #f4f4f5;
    --surface: #ffffff;
    --surface-light: #ececec;

    --text: #1f1f1f;
    --text-secondary: #4f4f4f;
    --text-muted: #777777;

    --border: #d7d7d7;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.10);
    --transition: all 0.25s ease;
    --container-width: 1280px;
    --header-height: 78px;
    --font-base: "Inter", "Segoe UI", Arial, sans-serif;

    --brand-logo-height-desktop: 44px;
    --brand-logo-height-mobile: 36px;
    --brand-logo-height-login: 82px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: var(--font-base);
    line-height: 1.5
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition)
}

img {
    display: block;
    max-width: 100%
}

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

button {
    cursor: pointer;
    border: none;
    background: none
}

ul {
    margin: 0;
    padding: 0;
    list-style: none
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin-top: 0
}

.container {
    width: min(100% - 32px, var(--container-width));
    margin-inline: auto
}

.page-content {
    padding: 24px 0 40px
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px
}

.page-title {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 700
}

.page-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: .95rem
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-container {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 10px;
}

.theme-toggle {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: 0 8px 22px rgba(148, 20, 21, 0.28);
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.theme-toggle i {
    font-size: 1.05rem;
}

.nav-link--icon-only {
    width: 44px;
    height: 44px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.nav-link--icon-only i {
    font-size: 1rem;
}

.nav-link--icon-only span {
    display: none;
}

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

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--primary);
    background: var(--surface-light);
    color: var(--primary-dark);
}

.theme-toggle i {
    font-size: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0
}

.logo img {
    height: var(--brand-logo-height-desktop);
    width: auto;
    object-fit: contain;
}

.menu-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: var(--transition)
}

.menu-toggle:hover {
    border-color: var(--primary);
    background: var(--surface-light);
    color: var(--primary-dark)
}

.main-nav {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(320px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: none
}

.main-nav.is-open {
    display: block
}

.main-nav ul {
    display: flex;
    flex-direction: column
}

.main-nav li+li {
    border-top: 1px solid var(--border)
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 500
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(148, 20, 21, .12);
    color: var(--text)
}

.main-nav a.active {
    border-left: 3px solid var(--primary);
    padding-left: 13px
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden
}

.card-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

.card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700
}

.card-body {
    padding: 18px
}

.card-footer {
    padding: 16px 18px;
    border-top: 1px solid var(--border)
}

.grid,
.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 18px
}

@media(min-width:768px) {
    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

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

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

.kpi-card {
    background: linear-gradient(180deg, rgba(58, 58, 58, .35), rgba(42, 42, 42, 1));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm)
}

.kpi-label {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: .9rem;
    font-weight: 500
}

.kpi-value {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 700
}

.kpi-meta {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: .9rem
}

.alert-banner {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 16px 18px;
    font-weight: 600
}

.alert-banner--danger {
    background: rgba(239, 68, 68, .16);
    border-color: rgba(239, 68, 68, .45);
    color: #ffd6d6
}

.alert-banner--success {
    background: rgba(16, 185, 129, .16);
    border-color: rgba(16, 185, 129, .45);
    color: #ddfff3
}

.alert-banner--blink {
    animation: pulseDanger 1.2s infinite
}

@keyframes pulseDanger {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, .4);
        transform: scale(1)
    }

    50% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
        transform: scale(1.01)
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(1)
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    transition: var(--transition)
}

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

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

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

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
    border-color: var(--border)
}

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

.btn-danger {
    background: rgba(239, 68, 68, .16);
    color: #ffd6d6;
    border-color: rgba(239, 68, 68, .35)
}

.btn-danger:hover {
    background: rgba(239, 68, 68, .24)
}

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

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

.form-grid {
    display: grid;
    gap: 16px
}

@media(min-width:768px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .form-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr))
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.form-label {
    color: var(--text-secondary);
    font-size: .92rem;
    font-weight: 600
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0 14px;
    outline: none;
    transition: var(--transition)
}

.form-textarea {
    min-height: 120px;
    padding: 14px;
    resize: vertical
}

.form-control::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted)
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(148, 20, 21, .18)
}

.form-control[readonly],
.form-control[disabled],
.form-select[disabled],
.form-textarea[disabled] {
    opacity: .65;
    cursor: not-allowed
}

.field-hint,
.form-error {
    font-size: .85rem
}

.field-hint {
    color: var(--text-muted)
}

.form-error {
    color: #ff8c8c
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm)
}

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

.table thead {
    background: rgba(255, 255, 255, .03)
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle
}

.table th {
    color: var(--text-secondary);
    font-size: .88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em
}

.table td {
    color: var(--text);
    font-size: .95rem
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, .02)
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: .85rem;
    font-weight: 600
}

.badge-neutral {
    background: rgba(255, 255, 255, .05);
    color: var(--text-secondary)
}

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

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(148, 20, 21, 0.18), transparent 26%),
        radial-gradient(circle at bottom right, rgba(214, 40, 40, 0.12), transparent 20%),
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
        var(--background);
}

.auth-card {
    width: min(100%, 560px);
    background: rgba(42, 42, 42, .92);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    padding: 38px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-logo img {
    height: var(--brand-logo-height-login);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.auth-title {
    margin-bottom: 8px;
    text-align: center;
    font-size: 1.9rem;
    font-weight: 700;
}

.auth-subtitle {
    html[data-theme="light"] .auth-page,
body[data-theme="light"] .auth-page {
    background:
        radial-gradient(circle at top left, rgba(148, 20, 21, 0.10), transparent 24%),
        radial-gradient(circle at bottom right, rgba(214, 40, 40, 0.08), transparent 18%),
        linear-gradient(180deg, #fafafa 0%, #f1f1f3 100%);
}

html[data-theme="light"] .auth-card,
body[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 0.96);
    border-color: #d9d9d9;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .auth-title,
body[data-theme="light"] .auth-title {
    color: #1f1f1f;
}

html[data-theme="light"] .auth-subtitle,
body[data-theme="light"] .auth-subtitle {
    color: #5f5f5f;
}

html[data-theme="light"] .auth-card .form-control,
html[data-theme="light"] .auth-card .form-select,
html[data-theme="light"] .auth-card .form-textarea,
body[data-theme="light"] .auth-card .form-control,
body[data-theme="light"] .auth-card .form-select,
body[data-theme="light"] .auth-card .form-textarea {
    background: #ffffff;
    border-color: #d7d7d7;
    color: #1f1f1f;
}

html[data-theme="light"] .auth-card .form-control::placeholder,
body[data-theme="light"] .auth-card .form-control::placeholder {
    color: #8a8a8a;
}
    margin-bottom: 28px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-logo img {
    max-width: 220px;
    height: auto
}

.auth-title {
    margin-bottom: 8px;
    text-align: center;
    font-size: 1.7rem;
    font-weight: 700
}

.auth-subtitle {
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-secondary)
}

.site-footer {
    padding: 0 0 24px
}

.site-footer__inner {
    padding-top: 12px;
    border-top: 1px solid var(--border)
}

.text-muted {
    color: var(--text-muted)
}

.text-secondary {
    color: var(--text-secondary)
}

.text-center {
    text-align: center
}

.mt-0 {
    margin-top: 0
}

.mb-0 {
    margin-bottom: 0
}

.mb-8 {
    margin-bottom: 8px
}

.mb-12 {
    margin-bottom: 12px
}

.mb-16 {
    margin-bottom: 16px
}

.mb-24 {
    margin-bottom: 24px
}

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

.mt-24 {
    margin-top: 24px
}

.hidden {
    display: none !important
}

.empty-state {
    max-width: 720px;
    margin: 64px auto;
    text-align: center;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px
}

@media(min-width:992px) {

        .main-nav {
        margin-left: auto;
    }

    .header-actions {
        margin-left: 12px;
    }

    .menu-toggle {
        display: none
    }

    .main-nav {
        position: static;
        width: auto;
        display: block;
        background: transparent;
        border: none;
        box-shadow: none;
        overflow: visible
    }

    .main-nav ul {
        flex-direction: row;
        align-items: center;
        gap: 6px
    }

    .main-nav li+li {
        border-top: none
    }

    .main-nav a {
        padding: 10px 14px;
        border: 1px solid transparent;
        border-radius: 12px
    }

    .main-nav a.active {
        border-left: none;
        padding-left: 14px;
        border-color: rgba(148, 20, 21, .35)
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important
    }
}


.alert-banner--success {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
    color: #d8fff1;
}

.alert-banner--button {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.header-search {
    display: none;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 460px;
    margin-left: auto;
}

.header-search__input {
    width: 100%;
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0 14px;
}

.header-search__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(148, 20, 21, 0.18);
}

.header-search__button {
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 18px 0 28px;
}

.site-footer__inner {
    display: flex;
    justify-content: center;
}

@media (min-width: 992px) {
    .header-search {
        display: flex;
    }
}


/* Alert variants */
.alert-banner--success {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.45);
    color: #d1fae5;
}

.alert-banner--info {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.35);
    color: #dbeafe;
}

.alert-banner--button {
    width: 100%;
    text-align: left;
}

/* Print layout */
.print-layout-body {
    background: #ffffff;
    color: #111111;
}

.print-layout {
    width: min(100% - 40px, 1100px);
    margin: 20px auto;
    background: #ffffff;
    color: #111111;
}

.print-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #cccccc;
}

.print-header h1 {
    margin-bottom: 6px;
    color: #111111;
}

.print-header p {
    color: #444444;
}

.print-block {
    margin-bottom: 18px;
}

.print-block h2 {
    margin-bottom: 10px;
    color: #111111;
    font-size: 1.1rem;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
}

.print-table th,
.print-table td {
    border: 1px solid #d4d4d4;
    padding: 10px;
    text-align: left;
    vertical-align: top;
    color: #111111;
}

.print-note {
    min-height: 80px;
    border: 1px solid #d4d4d4;
    padding: 12px;
    white-space: pre-wrap;
}

.form-check {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 991px) {
    .logo img {
        height: var(--brand-logo-height-mobile);
    }

    .auth-card {
        width: min(100%, 96vw);
        padding: 28px;
    }
}

:root {
    --brand-logo-height-desktop: 44px;
    --brand-logo-height-mobile: 36px;
    --brand-logo-height-login: 82px;
}

.logo img {
    height: var(--brand-logo-height-desktop);
    width: auto;
    object-fit: contain;
}

.auth-card {
    width: min(100%, 560px);
    background: rgba(42, 42, 42, 0.92);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    padding: 38px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-logo img {
    height: var(--brand-logo-height-login);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.main-footer {
    border-top: 1px solid var(--border);
    background: rgba(42, 42, 42, 0.7);
    padding: 18px 0;
    margin-top: 32px;
}

.main-footer__inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.main-footer__brand {
    font-weight: 700;
    color: var(--text);
}

.main-footer__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

@media (max-width: 991px) {
    .logo img {
        height: var(--brand-logo-height-mobile);
    }

    .auth-card {
        width: min(100%, 96vw);
        padding: 28px;
    }
}

@media (max-width: 991px) {
    .header-actions {
        margin-left: auto;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
}

.auth-card {
    width: min(100%, 560px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    padding: 38px;
}

.money-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.money-prefix {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-weight: 700;
    pointer-events: none;
}

.money-input-wrap .form-control {
    padding-left: 46px;
}