:root {
    --app-bg: #f3f4f7;
    --panel: #ffffff;
    --panel-soft: #f9fafc;
    --sidebar: #171314;
    --sidebar-border: #2d2628;
    --sidebar-text: #f2efef;
    --sidebar-muted: #b7adb0;
    --accent: #ff3347;
    --accent-dark: #db2438;
    --text: #23252c;
    --muted: #7f8795;
    --line: #dfe3ea;
    --line-dark: #cfd5de;
    --success: #06b26b;
    --blue: #0a78ff;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--text);
    background: var(--app-bg);
}

body:not(.login-page) {
    height: 100svh;
    overflow: hidden;
}

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

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

.login-page {
    min-height: 100svh;
    background: linear-gradient(90deg, #232443 0 50%, #585ca9 50% 100%);
}

.login-layout {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(1120px, 100%);
    min-height: 640px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: #262748;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.login-card__visual,
.login-card__form {
    padding: 44px;
}

.login-card__visual {
    background: #28294b;
    color: #e8ebff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
}

.login-card__form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
    color: #fff;
    background: #242544;
}

.login-card__copy h1,
.login-card__form h2,
.sidebar__brand h1,
.topbar h2,
.panel-heading h3 {
    margin: 0;
}

.login-card__copy p,
.muted,
.sidebar__brand p,
.topbar p,
.panel-heading p {
    margin: 6px 0 0;
    color: var(--muted);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: 0.14em;
    color: #8f96de;
    text-transform: uppercase;
}

.login-card__art {
    position: relative;
    height: 320px;
    background: linear-gradient(180deg, #35366b, #2e2f58);
    border-radius: 6px;
    overflow: hidden;
}

.art-screen {
    position: absolute;
    left: 86px;
    right: 86px;
    top: 74px;
    bottom: 84px;
    border-radius: 18px;
    background: #a7aac0;
    box-shadow: inset 0 0 0 12px #7f82c9;
}

.art-chart {
    position: absolute;
    left: 176px;
    right: 176px;
    top: 138px;
    bottom: 138px;
    border-radius: 12px;
    background:
        linear-gradient(90deg, #5d58c8 0 22%, transparent 22% 38%, #5c967f 38% 52%, transparent 52% 68%, #a65d67 68% 84%, transparent 84% 100%),
        linear-gradient(180deg, transparent 0 66%, rgba(94, 96, 172, 0.4) 66% 100%);
}

.art-circle {
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
}

.art-circle--one {
    width: 274px;
    height: 274px;
    right: -34px;
    top: 32px;
}

.art-circle--two {
    width: 190px;
    height: 190px;
    left: -20px;
    bottom: -10px;
}

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

.field label {
    font-size: 13px;
}

.field input,
.field textarea,
.field select,
.searchable-select__input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.field-note {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge--active {
    border-color: #b7e2d5;
    background: #effaf6;
    color: #24725c;
}

.status-badge--muted {
    background: #f3f4f6;
    color: var(--muted);
}

.login-card__form .field input {
    background: #181a34;
    border-color: #181a34;
    color: #fff;
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select__native {
    position: absolute;
    inset: 0;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.searchable-select__control {
    position: relative;
    width: 100%;
}

.searchable-select__input {
    height: 42px;
    padding: 10px 34px 10px 13px;
}

.searchable-select__arrow {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    font-size: 11px;
    color: #6f7786;
    pointer-events: none;
    transition: transform 0.15s ease;
}

.searchable-select__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    overflow: auto;
    max-height: 220px;
    z-index: 80;
}

.searchable-select__option,
.searchable-select__empty {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
}

.searchable-select__option {
    display: block;
    border: 0;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.searchable-select__option.is-active,
.searchable-select__option:hover {
    background: #f0f3f8;
}

.searchable-select__option.is-selected {
    color: var(--accent-dark);
    font-weight: 600;
}

.searchable-select__empty {
    color: var(--muted);
}

.searchable-select.is-open .searchable-select__input,
.searchable-select__input:focus {
    border-color: #95a1b4;
}

.searchable-select.is-open .searchable-select__arrow {
    transform: translateY(-50%) rotate(180deg);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.searchable-select__input:focus {
    border-color: #95a1b4;
}

.field-display-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 11px 13px;
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    background: #fff;
    color: var(--accent-dark);
    font-weight: 600;
    cursor: default;
}

.button {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 10px 16px;
    cursor: pointer;
    transition: 0.15s ease;
    text-align: center;
}

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

.button--primary:hover {
    background: var(--accent-dark);
}

.button--ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

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

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

.button--tiny {
    padding: 6px 10px;
    font-size: 12px;
}

.button--icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 14px;
    line-height: 1;
}

.button--icon .action-icon {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button--full {
    width: 100%;
}

.app-shell {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    height: 100svh;
    overflow: hidden;
}

.sidebar-backdrop {
    display: none;
}

.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    padding: 18px 10px;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 18px;
    margin-bottom: 6px;
}

.sidebar__logo {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    border-radius: 3px;
    overflow: hidden;
}

.sidebar__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar__brand h1 {
    font-size: 14px;
    font-weight: 600;
}

.sidebar__brand p {
    font-size: 11px;
    color: var(--sidebar-muted);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar__link,
.sidebar__toggle,
.sidebar__sublink {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--sidebar-text);
    border-radius: 3px;
}

.sidebar__link,
.sidebar__toggle {
    padding: 10px 12px;
    font-size: 14px;
}

.sidebar__button {
    font-family: inherit;
    cursor: pointer;
}

.sidebar__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar__link-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.sidebar__icon,
.sidebar__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sidebar__icon svg,
.sidebar__arrow svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar__arrow {
    color: var(--sidebar-muted);
    transition: transform 0.18s ease;
}

.sidebar__group.is-open .sidebar__arrow {
    transform: rotate(90deg);
}

.sidebar__link.is-active,
.sidebar__sublink.is-active,
.sidebar__link:hover,
.sidebar__toggle:hover,
.sidebar__sublink:hover {
    background: var(--accent);
    color: #fff;
}

.sidebar__submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px 12px;
}

.sidebar__group.is-open .sidebar__submenu {
    display: flex;
}

.sidebar__sublink {
    padding: 8px 10px;
    font-size: 13px;
    color: var(--sidebar-muted);
}

.main-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(220px, 520px) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.burger-button {
    display: none;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 4px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.burger-button span {
    width: 14px;
    height: 2px;
    background: #3b4250;
    display: block;
}

.topbar__title h2 {
    font-size: 14px;
    font-weight: 600;
}

.topbar__title p {
    display: none;
}

.topbar__search input {
    width: 100%;
    height: 34px;
    border: 1px solid var(--line-dark);
    border-radius: 18px;
    background: #fff;
    padding: 0 14px;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    justify-self: end;
}

.system-banner {
    margin: 12px 18px 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.system-banner--warning {
    border-color: #f3b4bd;
    background: #fff4f5;
    color: var(--accent);
    animation: lightningWarning 2.4s ease-in-out infinite;
}

@keyframes lightningWarning {
    0% {
        opacity: 0;
        transform: translateY(-8px);
        box-shadow: none;
    }
    12% {
        opacity: 1;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(245, 49, 67, 0.18);
    }
    22% {
        background: #fff4f5;
        box-shadow: none;
    }
    34% {
        background: #fff;
        box-shadow: 0 0 18px rgba(245, 49, 67, 0.35);
    }
    48% {
        transform: translateY(0);
        background: #fff4f5;
        box-shadow: none;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        background: #fff4f5;
        box-shadow: none;
    }
}

.topbar__user {
    font-size: 13px;
    color: #4a4f5c;
}

.topbar__password-short {
    display: none;
}

.dashboard-grid,
.page-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 14px 18px 18px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-content: start;
}

.dashboard-grid .panel--wide {
    grid-column: 1 / -1;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: var(--shadow);
    padding: 14px;
    min-width: 0;
    margin-bottom: 16px;
}

.panel--spaced {
    margin-top: 16px;
}

.panel--wide {
    grid-column: span 1;
}

.panel--summary {
    grid-column: span 1;
}

.panel--top-customers {
    grid-column: span 1;
}

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

.panel-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow-x: auto;
}

.tabs__button {
    border: 0;
    border-right: 1px solid var(--line);
    background: #f6f7fa;
    color: #4c5361;
    padding: 13px 18px;
    min-width: 150px;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
}

.tabs__button:last-child {
    border-right: 0;
}

.tabs__button.is-active {
    background: #fff;
    color: var(--text);
    box-shadow: inset 0 -3px 0 var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.company-logo-preview {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.company-logo-preview img,
.company-logo-preview__fallback {
    width: 72px;
    height: 72px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.company-logo-preview img {
    object-fit: cover;
}

.company-logo-preview__fallback {
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--accent);
}

.order-table {
    margin-top: 16px;
}

.order-table__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.order-table__header h4 {
    margin: 0;
    font-size: 13px;
    text-transform: uppercase;
}

.order-summary {
    display: grid;
    justify-content: end;
    gap: 6px;
    margin-top: 14px;
    font-size: 14px;
}

.order-summary__line {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    min-width: 220px;
}

.order-summary__line--grand {
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.order-summary strong {
    font-size: 16px;
}

.print-page {
    background: #fff;
    padding: 24px;
}

.print-invoice {
    max-width: 960px;
    margin: 0 auto;
}

.print-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.print-company {
    display: flex;
    gap: 14px;
}

.print-company h1,
.print-order-meta h2 {
    margin: 0 0 8px;
}

.print-company p,
.print-order-meta p {
    margin: 4px 0;
}

.print-logo {
    width: 72px;
    height: 72px;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.print-logo--large {
    width: 86px;
    height: 86px;
}

.print-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.print-customer {
    margin-bottom: 20px;
}

.print-meta-grid {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.print-meta-grid div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid #c7ccda;
    padding-bottom: 4px;
    font-size: 12px;
}

.print-addresses {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.print-address-box h3,
.print-notes-box h3 {
    margin: 0 0 8px;
    padding: 6px 10px;
    background: #4d588e;
    color: #fff;
    font-size: 12px;
    text-transform: uppercase;
}

.print-address-box p {
    margin: 4px 0;
    font-size: 12px;
}

.print-footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
    gap: 18px;
    margin-top: 18px;
}

.print-notes-box {
    border: 1px solid #c7ccda;
    min-height: 120px;
}

.print-notes-box div {
    padding: 10px;
    font-size: 12px;
    min-height: 84px;
}

.print-totals-box {
    border: 1px solid #c7ccda;
}

.print-totals-box div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid #c7ccda;
    font-size: 12px;
}

.print-totals-box__grand {
    background: #edf0fb;
    font-weight: 700;
}

.print-bottom-note {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
}

.print-bottom-note strong {
    display: block;
    margin-top: 8px;
    font-style: italic;
}

.print-report-totals {
    margin-bottom: 18px;
}

.panel-heading h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.panel-heading__link,
.dashboard-link {
    color: inherit;
}

.panel-heading__link:hover,
.dashboard-link:hover {
    color: var(--accent);
}

.panel-heading p {
    font-size: 11px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

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

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 14px 12px;
    text-align: center;
}

.stat-card span,
.stat-card small {
    display: block;
}

.stat-card span {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    font-size: 24px;
    font-weight: 500;
    color: var(--blue);
    margin-bottom: 6px;
}

.stat-card:nth-child(2) strong {
    color: var(--accent);
}

.stat-card:nth-child(3) strong {
    color: var(--success);
}

.stat-card:nth-child(4) strong {
    color: #c66b00;
}

.stat-card:nth-child(6) strong {
    color: #008574;
}

.stat-card:nth-child(8) strong {
    color: #b1285c;
}

.stat-card small {
    font-size: 11px;
    color: #5c6472;
}

.dashboard-pie-summary {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.dashboard-pie,
.dashboard-customer-pie,
.dashboard-mini-pie {
    display: grid;
    place-items: center;
    border-radius: 50%;
    position: relative;
}

.dashboard-pie {
    width: 112px;
    height: 112px;
    background: conic-gradient(var(--accent) 0 var(--pie-a), #14806f var(--pie-a) 100%);
}

.dashboard-customer-pie {
    width: 112px;
    height: 112px;
    background: conic-gradient(var(--accent) 0 100%);
}

.dashboard-pie::after,
.dashboard-customer-pie::after,
.dashboard-mini-pie::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: #fff;
}

.dashboard-pie::after {
    inset: 32px;
}

.dashboard-customer-pie::after {
    inset: 32px;
}

.dashboard-pie span,
.dashboard-customer-pie span,
.dashboard-mini-pie span {
    position: relative;
    z-index: 1;
    font-weight: 700;
    color: var(--text);
}

.dashboard-pie span,
.dashboard-customer-pie span {
    font-size: 18px;
}

.dashboard-pie-legend {
    display: grid;
    gap: 8px;
    align-content: start;
}

.dashboard-pie-legend div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.dashboard-pie-legend div:last-child {
    border-bottom: 0;
}

.dashboard-pie-summary .summary-list {
    grid-column: 1 / -1;
    margin-top: 4px;
}

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

.legend-dot--receivable {
    background: var(--accent);
}

.legend-dot--cash {
    background: #14806f;
}

.dashboard-chart {
    min-height: 236px;
}

.dashboard-chart__bars {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 226px;
}

.dashboard-chart__item {
    display: grid;
    gap: 8px;
    align-items: end;
}

.dashboard-chart__value,
.dashboard-chart__label {
    font-size: 12px;
    text-align: center;
}

.dashboard-chart__value {
    color: #5a6372;
    font-weight: 600;
}

.dashboard-chart__label {
    color: var(--muted);
}

.dashboard-chart__bar-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 156px;
    padding: 0 10px;
}

.dashboard-chart__bar {
    width: 100%;
    max-width: 46px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #ff6674 0%, var(--accent) 100%);
}

.dashboard-chart__empty,
.dashboard-list__empty {
    color: var(--muted);
    font-size: 13px;
}

.dashboard-list,
.dashboard-pie-list {
    display: grid;
    gap: 12px;
}

.dashboard-list__item {
    display: grid;
    gap: 8px;
}

.dashboard-list__text {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.dashboard-list__bar {
    width: 100%;
    height: 10px;
    background: #eef1f5;
    border-radius: 999px;
    overflow: hidden;
}

.dashboard-list__bar div {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff8894, var(--accent));
}

.dashboard-pie-card {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.dashboard-pie-card:last-child {
    border-bottom: 0;
}

.dashboard-mini-pie {
    width: 112px;
    height: 112px;
    background: conic-gradient(var(--accent) 0 var(--pie-value), #eef1f5 var(--pie-value) 100%);
}

.dashboard-mini-pie::after {
    inset: 32px;
}

.dashboard-mini-pie span {
    font-size: 18px;
}

.dashboard-pie-card__text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.summary-list,
.overview-list {
    display: grid;
    gap: 8px;
}

.summary-list div,
.overview-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.summary-list div:last-child,
.overview-list div:last-child {
    border-bottom: 0;
}

.summary-list strong,
.overview-list strong {
    color: var(--text);
    font-weight: 700;
}

.page-grid {
    display: block;
}

.page-grid .panel {
    max-width: 100%;
}

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

.field--full,
.field--actions {
    grid-column: 1 / -1;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.table-toolbar,
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.table-toolbar__search {
    flex: 1;
}

.table-toolbar__search input,
.table-toolbar__dates input {
    width: 100%;
    max-width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    background: #fff;
}

.table-toolbar__dates {
    display: flex;
    gap: 8px;
}

.table-pagination {
    margin-top: 12px;
    margin-bottom: 0;
}

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    background: #fff;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
}

.data-table td input,
.data-table td select,
.data-table td .searchable-select__input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-dark);
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    outline: none;
    box-shadow: none;
}

.data-table td .searchable-select {
    min-width: 220px;
}

.data-table td .searchable-select__input {
    padding-right: 34px;
}

.data-table td input[readonly] {
    background: var(--panel-soft);
    color: #475062;
}

.data-table td input:focus,
.data-table td select:focus,
.data-table td .searchable-select__input:focus {
    border-color: #95a1b4;
}

.data-table th {
    background: #fafbfd;
    color: #4e5664;
    font-weight: 600;
}

.data-table tbody tr:nth-child(even) {
    background: #fbfcfe;
}

.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 18, 36, 0.28);
    display: grid;
    place-items: center;
    gap: 10px;
    color: #fff;
    z-index: 9999;
}

.spinner-overlay[hidden] {
    display: none !important;
}

.spinner {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    min-width: 220px;
    padding: 12px 14px;
    border-radius: 4px;
    background: #1d2534;
    color: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: 0.18s ease;
    z-index: 10000;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-error {
    background: #b4233d;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
}

.modal[hidden] {
    display: none !important;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

.modal__dialog {
    position: relative;
    width: min(520px, calc(100vw - 24px));
    margin: 8vh auto 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: 0 16px 50px rgba(15, 23, 42, 0.18);
    padding: 16px;
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 10030;
}

.drawer[hidden] {
    display: none !important;
}

.drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
}

.drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100%;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.16);
    padding: 16px;
    overflow-y: auto;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-entry {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
}

.history-entry strong {
    font-size: 13px;
}

.history-entry span,
.history-entry time,
.history-list__empty {
    color: var(--muted);
    font-size: 12px;
}

.mobile-nav {
    display: none;
}

.mobile-nav__icon {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .login-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-card__visual,
    .login-card__form {
        padding: 24px;
    }

    .login-card__art {
        height: 220px;
    }

    .art-screen {
        left: 44px;
        right: 44px;
        top: 50px;
        bottom: 54px;
    }

    .art-chart {
        left: 112px;
        right: 112px;
        top: 102px;
        bottom: 94px;
    }

    .app-shell {
        grid-template-columns: 1fr;
        height: 100svh;
    }

    .sidebar {
        display: block;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 252px;
        max-width: calc(100vw - 56px);
        z-index: 9500;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.34);
        z-index: 9400;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        grid-template-columns: auto minmax(120px, 1fr) minmax(120px, 1.3fr) auto;
        padding: 10px 12px;
        gap: 8px;
        align-items: center;
    }

    .burger-button {
        display: inline-flex;
        grid-column: 1;
        grid-row: 1;
    }

    .topbar__title {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }

    .topbar__search {
        grid-column: 3;
        grid-row: 1;
        min-width: 0;
        order: initial;
    }

    .topbar__actions {
        grid-column: 4;
        grid-row: 1;
        justify-content: flex-end;
        align-items: center;
        min-width: 0;
    }

    .topbar__title h2 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar__title p {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar__user {
        display: none;
    }

    .topbar__actions .button {
        padding: 9px 12px;
        white-space: nowrap;
    }

    .topbar__password-full {
        display: none;
    }

    .topbar__password-short {
        display: inline;
    }

    .topbar__search input {
        height: 36px;
    }

    .dashboard-grid,
    .page-grid {
        padding: 10px 10px 82px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

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

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

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

    .dashboard-pie-summary {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .dashboard-pie-legend {
        width: 100%;
    }

    .panel-actions {
        flex-direction: column;
    }

    .panel {
        padding: 12px;
    }

    .table-wrapper {
        overflow: visible;
    }

    .table-toolbar,
    .table-pagination {
        flex-direction: column;
        align-items: stretch;
    }

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

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table th,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table {
        min-width: 0;
        background: transparent;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: grid;
        gap: 10px;
    }

    .data-table tbody tr {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 4px;
        padding: 6px 10px;
    }

    .data-table td {
        position: relative;
        padding: 9px 0 9px 46%;
        min-height: 36px;
        white-space: normal;
        border-bottom: 1px solid var(--line);
        text-align: left;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 9px;
        width: 42%;
        color: #4e5664;
        font-weight: 600;
        white-space: normal;
    }

    .data-table td[colspan] {
        padding: 12px 0;
        text-align: center;
    }

    .data-table td[colspan]::before {
        content: none;
    }

    .mobile-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: #fff;
        border-top: 1px solid var(--line);
        z-index: 9000;
    }

.mobile-nav__link {
        padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
        display: grid;
        place-items: center;
        gap: 4px;
        text-align: center;
        font-size: 11px;
        color: #4c5361;
    }

    .mobile-nav__icon {
        display: inline-grid;
        place-items: center;
    }

    .mobile-nav__icon svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
}

.print-page {
    min-width: 1100px;
}

.print-page .data-table,
.print-page .data-table thead,
.print-page .data-table tbody {
    display: table;
    width: 100%;
}

.print-page .data-table thead {
    display: table-header-group;
}

.print-page .data-table tbody {
    display: table-row-group;
}

.print-page .data-table tr {
    display: table-row;
}

.print-page .data-table th,
.print-page .data-table td {
    display: table-cell;
    width: auto;
    position: static;
    padding: 10px 8px;
    white-space: normal;
    border-bottom: 1px solid #c7ccda;
}

.print-page .data-table td::before {
    content: none !important;
}

.print-page .print-table {
    min-width: 0;
    table-layout: fixed;
    background: #fff;
}

.print-page .print-table thead th {
    background: #4d588e;
    color: #fff;
    font-size: 12px;
    text-transform: uppercase;
}

@media print {
    .print-page {
        padding: 0;
        min-width: 0;
    }
}
