:root {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-muted: #eef2f6;
    --text: #172033;
    --muted: #697386;
    --border: #d9dee8;
    --primary: #3f80ea;
    --primary-strong: #3266bb;
    --success: #4bbf73;
    --danger: #d9534f;
    --warning: #e5a54b;
    --info: #1f9bcf;
    --sidebar: #293247;
    --topbar: #202838;
    --topbar-field: #2a3448;
    --sidebar-text: #f7f8fb;
    --sidebar-muted: #9da8bb;
    --blue: #4f86f7;
    --sidebar-expanded-width: 332px;
    --sidebar-collapsed-width: 116px;
    --success-bg: #e8f7ef;
    --success-text: #17693a;
    --warning-bg: #fff4d6;
    --warning-text: #8a5a00;
    --error-bg: #fde8e7;
    --error-text: #991b1b;
    --shadow: 0 14px 40px rgba(17, 24, 39, 0.08);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --sidebar-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.dark-mode {
    --bg: #121722;
    --surface: #1a2231;
    --surface-muted: #222c3d;
    --text: #f4f7fb;
    --muted: #aab4c4;
    --border: #2e3a4f;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    transition: background-color 0.28s var(--ease), color 0.28s var(--ease);
}

.js-booting .sidebar,
.js-booting .main-area,
.js-booting .brand-copy,
.js-booting .nav-section-items,
.js-booting .nav-item,
.js-booting .nav-text,
.js-booting .nav-badge,
.js-booting .nav-label,
.js-booting .nav-chevron {
    transition: none !important;
}

a {
    color: inherit;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 4px 12px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    background: transparent;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.625;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

button:hover,
.button-link:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 4px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.625;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

.btn-outline-primary:hover {
    color: #ffffff;
    background: var(--primary);
}

.btn-outline-secondary {
    color: var(--muted);
    border-color: #8b95a7;
}

.btn-outline-secondary:hover {
    color: #ffffff;
    background: #6c757d;
    border-color: #6c757d;
}

.btn-outline-success {
    color: var(--success);
    border-color: var(--success);
}

.btn-outline-success:hover {
    color: #ffffff;
    background: var(--success);
}

.btn-outline-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    color: #ffffff;
    background: var(--danger);
}

.btn-outline-warning {
    color: var(--warning);
    border-color: var(--warning);
}

.btn-outline-warning:hover {
    color: #151a24;
    background: var(--warning);
}

.btn-outline-info {
    color: var(--info);
    border-color: var(--info);
}

.btn-outline-info:hover {
    color: #ffffff;
    background: var(--info);
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    margin-top: 8px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    transition: background-color 0.22s var(--ease), border-color 0.22s var(--ease), color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.dark-mode input,
.dark-mode select,
.dark-mode textarea {
    background: #141b28;
}

label {
    display: block;
    color: var(--text);
    font-weight: 700;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.stack {
    display: grid;
    gap: 18px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #0d1116;
}

.login-shell {
    width: min(100%, 416px);
}

.login-panel {
    background: #151a20;
    border: 1px solid #2a3139;
    border-radius: 16px;
    padding: 50px 40px 44px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.login-headline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 18px;
}

.login-mark,
.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #f44336, #8b1320);
    color: #ffffff;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.login-panel h1 {
    margin: 0;
    color: var(--primary);
    font-size: 32px;
    line-height: 1;
}

.login-panel p {
    margin: 0 0 38px;
    color: #98a2b3;
    text-align: center;
}

.login-label {
    color: #a7b0bd;
    font-size: 16px;
}

.login-label span {
    display: block;
    margin-bottom: 10px;
}

.login-label input {
    margin-top: 0;
    background: #0e1217;
    border-color: #29313a;
    color: #f4f6fa;
}

.login-label input::placeholder {
    color: #68717d;
}

.login-panel button {
    width: 100%;
    margin-top: 2px;
    background: #171d24;
    border: 1px solid #2b333d;
    border-bottom: 3px solid var(--primary);
}

.login-panel button:hover {
    background: #1d242d;
    color: #ffffff;
}

.login-footer {
    margin-top: 26px;
    color: #596371;
    text-align: center;
    font-size: 14px;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--sidebar-expanded-width);
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 30px 28px;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    transition: width 0.42s var(--sidebar-ease), padding 0.42s var(--sidebar-ease), transform 0.42s var(--sidebar-ease);
}

.brand {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 0 0 42px;
    min-height: 70px;
    overflow: hidden;
}

.brand-mark {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    justify-self: center;
    border-radius: 6px;
    background: var(--blue);
}

.brand-copy {
    min-width: 0;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.24s var(--sidebar-ease), transform 0.32s var(--sidebar-ease);
}

.brand-copy strong {
    display: block;
    font-size: 22px;
    line-height: 1.1;
    max-width: none;
    overflow: hidden;
    white-space: nowrap;
}

.brand-copy span {
    display: block;
    color: var(--sidebar-muted);
    font-size: 13px;
}

.side-nav {
    display: grid;
    gap: 14px;
}

.nav-section {
    display: grid;
    gap: 6px;
}

.nav-section-toggle {
    width: 100%;
    min-height: 38px;
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: transparent;
    color: #ffffff;
    border: 0;
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
}

.nav-section-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-label {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
}

.nav-chevron {
    display: none;
}

.nav-section-items {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    overflow: hidden;
}

.nav-section-inner {
    display: grid;
    gap: 2px;
    min-height: 0;
}

.nav-section.is-open .nav-section-items {
    grid-template-rows: 1fr;
    opacity: 1;
}

.nav-item {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 8px 0;
    color: var(--sidebar-muted);
    font-size: 16px;
    text-decoration: none;
    overflow: hidden;
    border-radius: 8px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: #aeb8ca;
    font-size: 24px;
    line-height: 1;
    flex: 0 0 34px;
}

.nav-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
}

.nav-badge {
    min-width: 30px;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--blue);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.main-area {
    width: calc(100% - var(--sidebar-expanded-width));
    margin-left: var(--sidebar-expanded-width);
    transition: margin-left 0.42s var(--sidebar-ease), width 0.42s var(--sidebar-ease);
}

.topbar {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 16px 34px;
    background: var(--topbar);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

.topbar p {
    margin: 2px 0 0;
    color: #aab4c4;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 22px;
    flex: 1;
}

.icon-button {
    width: 42px;
    padding: 0;
    border: 0;
    flex: 0 0 auto;
    background: transparent;
    color: #c8d0dc;
    gap: 4px;
    flex-direction: column;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.menu-button span {
    display: block;
    width: 26px;
    height: 3px;
    border-radius: 999px;
    background: #c8d0dc;
}

.top-search {
    position: relative;
    display: block;
    width: 310px;
}

.search-popup {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 40;
    width: min(520px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: #2a3347;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.34);
}

.search-popup-empty {
    padding: 14px 16px;
    color: #aeb8ca;
    font-weight: 700;
}

.search-result {
    display: grid;
    gap: 3px;
    padding: 12px 16px;
    color: #dfe5ef;
    text-decoration: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.search-result:first-child {
    border-top: 0;
}

.search-result:hover {
    background: rgba(255, 255, 255, 0.08);
}

.search-result strong,
.search-result span,
.search-result small {
    display: block;
}

.search-result span {
    color: #aeb8ca;
    font-size: 14px;
}

.search-result small {
    color: #8f9bad;
    font-size: 12px;
}

.top-search input {
    min-height: 52px;
    margin: 0;
    padding: 0 48px 0 16px;
    background: var(--topbar-field);
    border-color: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-size: 16px;
}

.top-search input::placeholder {
    color: #aab4c4;
}

.search-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    width: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    transform: translateY(-50%);
    color: #c8d0dc;
    font-size: 26px;
}

.search-icon:hover {
    background: transparent;
    color: #ffffff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #ffffff;
}

.toolbar-button {
    position: relative;
    width: 42px;
    min-height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #c8d0dc;
    font-size: 27px;
    border-radius: 8px;
}

.toolbar-button svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toolbar-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 22px;
    height: 22px;
    padding: 2px 5px;
    border-radius: 999px;
    background: var(--blue);
    color: #ffffff;
    font-size: 13px;
    line-height: 18px;
}

.notification-menu {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 16px);
    right: -56px;
    z-index: 35;
    width: min(360px, calc(100vw - 32px));
    border-radius: 6px;
    background: #2a3347;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.34);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transform: translateY(-8px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.notification-menu.is-open .notification-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.notification-title {
    padding: 14px 18px;
    color: #d5dce8;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
}

.notification-item {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 14px;
    width: 100%;
    min-height: 0;
    padding: 14px 18px;
    background: transparent;
    color: #c6cedb;
    text-decoration: none;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    text-align: left;
    font: inherit;
    transition: background-color 0.2s var(--ease);
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.notification-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    align-self: center;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 800;
}

.notification-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-icon.danger {
    color: #ff5a5f;
}

.notification-icon.warning {
    color: #f5b84b;
}

.notification-icon.info {
    color: #4f86f7;
}

.notification-icon.success {
    color: #4ade80;
}

.notification-item strong,
.notification-item span,
.notification-item small {
    display: block;
}

.notification-item strong {
    color: #dfe5ef;
    font-size: 15px;
    line-height: 1.35;
}

.notification-item span {
    margin-top: 3px;
    color: #aeb8ca;
    line-height: 1.4;
    font-size: 14px;
}

.notification-item small {
    margin-top: 6px;
    color: #9ba6b8;
    font-size: 13px;
}

.notification-item:not(.unread) {
    opacity: 0.58;
}

.notification-item.unread {
    background: rgba(255, 255, 255, 0.035);
}

.notification-item.unread strong::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-radius: 999px;
    background: var(--blue);
    vertical-align: middle;
}

.notification-footer {
    display: block;
    padding: 12px 18px;
    color: #aeb8ca;
    text-align: center;
    text-decoration: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-footer:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.user-menu {
    position: relative;
}

.user-button {
    gap: 13px;
    padding: 6px 8px 6px 6px;
    min-height: 58px;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 18px;
    border-radius: 999px;
}

.user-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.avatar {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #e8edf5;
    color: #202838;
    font-weight: 800;
    border: 3px solid rgba(255, 255, 255, 0.22);
}

.avatar-small {
    width: 42px;
    height: 42px;
    border-width: 2px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 30;
    display: grid;
    min-width: 270px;
    padding: 10px;
    border-radius: 10px;
    background: #2a3347;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.34);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.user-menu.is-open .user-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 14px;
}

.dropdown-user strong,
.dropdown-user span {
    display: block;
}

.dropdown-user strong {
    color: #ffffff;
    font-size: 15px;
    line-height: 1.2;
}

.dropdown-user span {
    margin-top: 2px;
    color: #aeb8ca;
    font-size: 13px;
}

.dropdown-group {
    display: grid;
    gap: 2px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-signout {
    padding-bottom: 0;
}

.user-dropdown a,
.user-dropdown button {
    justify-content: flex-start;
    gap: 14px;
    min-height: 46px;
    padding: 10px 12px;
    background: transparent;
    color: #c6cedb;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border-radius: 8px;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.dropdown-icon {
    width: 28px;
    color: #aeb8ca;
    font-size: 20px;
    text-align: center;
}

.logout-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.content {
    width: 100%;
    padding: 32px 30px;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.metric-card,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
    transition: background-color 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease), transform 0.24s var(--ease);
}

.card:hover,
.metric-card:hover {
    transform: translateY(-1px);
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.metric-link {
    color: inherit;
    text-decoration: none;
}

.metric-card strong {
    display: block;
    font-size: 30px;
}

.card h2,
.card h3 {
    margin: 0 0 12px;
}

.card p,
.hint {
    color: var(--muted);
}

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

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.shortcut-grid a {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.alert {
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-weight: 700;
}

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

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

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

.file-drop {
    display: grid;
    gap: 4px;
    place-items: center;
    min-height: 150px;
    padding: 24px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.file-drop:hover,
.file-drop.has-file {
    border-color: var(--blue);
    background: rgba(79, 134, 247, 0.12);
}

.upload-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.upload-choice {
    display: grid;
    gap: 12px;
}

.file-drop input {
    width: 1px;
    height: 1px;
    min-height: 0;
    opacity: 0;
    position: absolute;
}

.file-drop span {
    color: var(--muted);
    font-weight: 400;
}

.selected-file {
    display: block;
    max-width: 100%;
    color: var(--text);
    font-style: normal;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-feedback {
    min-height: 22px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.upload-feedback.is-error {
    color: var(--error-text);
}

.upload-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-muted);
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}

.upload-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
    transform: translateX(-100%);
}

.upload-choice.is-uploading .upload-progress {
    opacity: 1;
}

.upload-choice.is-uploading .upload-progress span {
    animation: upload-indeterminate 1s var(--ease) infinite;
}

.upload-choice.is-uploading button[type="submit"] {
    opacity: 0.75;
    pointer-events: none;
}

@keyframes upload-indeterminate {
    from {
        transform: translateX(-110%);
    }
    to {
        transform: translateX(245%);
    }
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.info-grid div {
    padding: 12px;
    border-radius: 8px;
    background: var(--surface-muted);
}

.info-grid strong,
.info-grid span {
    display: block;
}

.info-grid strong {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
}

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

.amount-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.amount-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff1f2;
    color: var(--primary-strong);
    border: 1px solid #fecdd3;
    font-weight: 800;
    cursor: pointer;
}

.amount-choice input {
    width: auto;
    min-height: 0;
    margin: 0;
}

.amount-choice.is-selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.amount-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fef3f2;
    color: var(--primary-strong);
    border: 1px solid #fecdca;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.receipt-form textarea {
    resize: vertical;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.compact-row {
    justify-content: flex-start;
}

.compact-row form {
    margin: 0;
}

.file-action-row {
    justify-content: flex-start;
    margin-top: 16px;
}

.inline-receipt-list {
    display: grid;
    gap: 14px;
}

.filter-panel {
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1.2fr) repeat(2, minmax(140px, 0.8fr)) minmax(180px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.filter-panel input,
.filter-panel select {
    min-height: 38px;
    margin-top: 5px;
    padding: 8px 10px;
}

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

.archive-year-action {
    grid-template-columns: minmax(140px, 220px) auto;
    margin-top: 18px;
}

.month-heading {
    margin: 22px 0 8px;
    color: var(--text);
    font-size: 18px;
}

.inline-receipt-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.inline-receipt-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
}

.inline-receipt-meta strong {
    color: var(--text);
    font-size: 16px;
}

.inline-receipt-fields {
    display: grid;
    grid-template-columns: minmax(130px, 0.75fr) minmax(180px, 1.4fr) minmax(180px, 1.1fr) repeat(3, minmax(145px, 0.85fr));
    gap: 12px;
}

.inline-receipt-fields input,
.inline-receipt-fields select,
.inline-comment textarea {
    min-height: 38px;
    margin-top: 5px;
    padding: 8px 10px;
}

.inline-comment {
    margin: 0;
}

.inline-comment[hidden] {
    display: none;
}

.autosave-status {
    min-width: 98px;
    margin-right: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.autosave-status[data-state="saving"] {
    color: var(--warning);
}

.autosave-status[data-state="saved"] {
    color: var(--success);
}

.autosave-status[data-state="error"] {
    color: var(--danger);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.status-pruefung_offen {
    color: var(--warning);
    border-color: var(--warning);
}

.status-freigegeben {
    color: var(--success);
    border-color: var(--success);
}

.status-exportiert,
.status-archiviert {
    color: var(--info);
    border-color: var(--info);
}

.status-fehler,
.status-geloescht {
    color: var(--danger);
    border-color: var(--danger);
}

.file-viewer {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.file-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.file-viewer-head strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-viewer iframe {
    display: block;
    width: 100%;
    height: min(72vh, 760px);
    min-height: 420px;
    border: 0;
    background: #ffffff;
}

.ocr-text {
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 16px;
    border-radius: 8px;
    background: #111827;
    color: #f3f4f6;
    font-size: 13px;
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.server-metric {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.server-metric span,
.server-metric small {
    display: block;
    color: var(--muted);
}

.server-metric strong {
    display: block;
    margin: 8px 0 4px;
    color: var(--text);
    font-size: 26px;
}

.chart-card {
    background: #293247;
    color: #f5f7fb;
    width: 100%;
}

.chart-card h2 {
    font-size: 22px;
}

.chart-card p {
    color: #aeb8ca;
}

.chart-card .filter-panel {
    background: rgba(18, 23, 34, 0.42);
    border-color: rgba(255, 255, 255, 0.08);
}

.statistics-filter {
    grid-template-columns: minmax(140px, 180px) minmax(140px, 180px) minmax(160px, 220px) auto;
    justify-content: start;
}

.statistics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 16px 0 8px;
}

.statistics-summary div {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(18, 23, 34, 0.35);
}

.statistics-summary span,
.statistics-summary strong {
    display: block;
}

.statistics-summary span {
    color: #aeb8ca;
}

.statistics-summary strong {
    margin-top: 4px;
    color: #ffffff;
    font-size: 24px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 16px 0;
    color: #aeb8ca;
    font-weight: 700;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-line {
    display: inline-block;
    width: 34px;
    height: 4px;
    border-radius: 999px;
}

.legend-current {
    background: #d9534f;
}

.legend-compare {
    background: #9aa3b2;
}

.chart-wrap {
    position: relative;
    width: 100%;
    overflow-x: auto;
    padding: 18px 0 0;
    border-radius: 8px;
    background: #293247;
}

.chart-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

.line-chart {
    display: block;
    width: 100%;
    min-width: 720px;
    height: auto;
    aspect-ratio: 980 / 430;
}

.chart-axis,
.chart-grid,
.chart-line {
    fill: none;
    vector-effect: non-scaling-stroke;
}

.chart-axis {
    stroke: #1f2938;
    stroke-width: 1.5;
}

.chart-grid {
    stroke: #243044;
    stroke-width: 1;
    opacity: 0.8;
}

.chart-line {
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line-current {
    stroke: #d9534f;
}

.chart-line-compare {
    stroke: #9aa3b2;
    stroke-dasharray: 7 8;
}

.chart-label,
.chart-month {
    fill: #d0d8e6;
    font-size: 14px;
    font-weight: 700;
}

.chart-month {
    text-anchor: middle;
}

.chart-month.is-selected {
    fill: #ffffff;
}

.chart-dot {
    fill: #293247;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

.chart-dot-interactive {
    transition: r 0.2s ease, filter 0.2s ease;
}

.chart-dot-interactive:hover {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
}

.chart-dot-current {
    stroke: #d9534f;
    stroke-width: 2;
}

.chart-dot-compare {
    stroke: #9aa3b2;
    stroke-width: 2;
}

.chart-dot.is-selected {
    fill: #ffffff;
}

.user-create-panel {
    display: grid;
    grid-template-columns: auto minmax(180px, 260px) minmax(150px, 210px) auto;
    align-items: end;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.user-create-panel strong {
    align-self: center;
    color: var(--text);
}

.user-create-panel input,
.user-create-panel select {
    min-height: 38px;
    margin: 0;
}

.users-overview-card h2 {
    margin-bottom: 18px;
}

.users-table th {
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.users-table tr.is-selected td {
    background: rgba(63, 128, 234, 0.08);
}

.user-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #b91c1c;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

.role-pill {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(108, 117, 125, 0.22);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.role-admin {
    background: rgba(217, 83, 79, 0.18);
    color: #ff5d66;
}

.role-lesend {
    background: rgba(31, 155, 207, 0.18);
    color: #4ec2ed;
}

.user-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.user-actions form {
    margin: 0;
}

.icon-action {
    width: 36px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
}

.icon-action:hover {
    background: rgba(255, 255, 255, 0.08);
}

.icon-action-danger {
    border-color: rgba(217, 83, 79, 0.55);
    background: rgba(217, 83, 79, 0.18);
    color: #ff5d66;
}

.user-form {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.rights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin: 4px 0 18px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-weight: 700;
}

.check-row input {
    width: auto;
    min-height: 0;
    margin: 0;
}

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.segmented-control {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.segmented-control button {
    min-height: 34px;
    padding: 6px 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
}

.segmented-control button.is-active {
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.08);
}

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

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 13px;
}

tfoot th {
    border-top: 2px solid var(--border);
    color: var(--text);
    font-size: 15px;
}

.report-filter {
    grid-template-columns: minmax(140px, 180px) minmax(160px, 220px) auto;
    justify-content: start;
}

.report-table td:nth-child(5),
.report-table td:nth-child(6),
.report-table td:nth-child(7),
.report-table th:nth-child(5),
.report-table th:nth-child(6),
.report-table th:nth-child(7) {
    text-align: right;
}

.report-table .report-total-label {
    padding-right: 34px;
    text-align: right;
}

.monthly-report {
    margin-top: 18px;
}

.monthly-report h3 {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-bottom: 0;
    color: var(--text);
    text-align: center;
}

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

.bookkeeping-table th,
.bookkeeping-table td {
    padding: 7px 10px;
    border: 1px solid var(--border);
}

.bookkeeping-table th {
    color: var(--text);
    text-align: center;
}

.bookkeeping-table td:first-child {
    text-align: center;
    width: 54px;
}

.bookkeeping-table td:nth-child(5),
.bookkeeping-table td:nth-child(6),
.bookkeeping-table th:nth-child(5),
.bookkeeping-table th:nth-child(6) {
    text-align: right;
}

.bookkeeping-table tfoot th {
    font-size: 14px;
}

.print-report-page {
    background: #ffffff;
    color: #000000;
}

.print-report {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px;
}

.print-report .monthly-report {
    page-break-after: always;
}

.print-report .monthly-report:last-child {
    page-break-after: auto;
}

.print-actions {
    margin-bottom: 16px;
    text-align: right;
}

.print-report .monthly-report h3,
.print-report .bookkeeping-table th,
.print-report .bookkeeping-table td {
    border-color: #000000;
    color: #000000;
}

.print-report .bookkeeping-table {
    width: 100%;
    min-width: 0;
}

@media print {
    .print-actions {
        display: none;
    }

    .print-report {
        max-width: none;
        padding: 0;
    }
}

.app-shell.sidebar-collapsed .sidebar,
.sidebar-collapsed-initial .app-shell .sidebar {
    width: var(--sidebar-collapsed-width);
    overflow-y: visible;
    padding-top: 16px;
    padding-left: 8px;
    padding-right: 8px;
}

.app-shell.sidebar-collapsed .main-area,
.sidebar-collapsed-initial .app-shell .main-area {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

.app-shell.sidebar-collapsed .brand,
.sidebar-collapsed-initial .app-shell .brand {
    grid-template-columns: 1fr;
    justify-items: center;
    padding-left: 0;
    padding-bottom: 22px;
    min-height: 48px;
}

.app-shell.sidebar-collapsed .brand-mark,
.app-shell.sidebar-collapsed .nav-icon,
.sidebar-collapsed-initial .app-shell .brand-mark,
.sidebar-collapsed-initial .app-shell .nav-icon {
    justify-self: center;
    font-size: 22px;
    width: 36px;
    height: 36px;
    transition: color 0.2s var(--ease), text-shadow 0.2s var(--ease);
}

.app-shell.sidebar-collapsed .side-nav,
.sidebar-collapsed-initial .app-shell .side-nav {
    gap: 0;
}

.app-shell.sidebar-collapsed .nav-section,
.sidebar-collapsed-initial .app-shell .nav-section {
    gap: 0;
}

.app-shell.sidebar-collapsed .nav-section-toggle,
.sidebar-collapsed-initial .app-shell .nav-section-toggle {
    display: none;
}

.app-shell.sidebar-collapsed .nav-section-items,
.sidebar-collapsed-initial .app-shell .nav-section-items {
    grid-template-rows: 1fr;
    opacity: 1;
    transform: none;
}

.app-shell.sidebar-collapsed .nav-section-inner,
.sidebar-collapsed-initial .app-shell .nav-section-inner {
    gap: 18px;
}

.app-shell.sidebar-text-hidden .brand-copy,
.app-shell.sidebar-collapsed .brand-copy,
.sidebar-collapsed-initial .app-shell .brand-copy {
    width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-8px);
}

.app-shell.sidebar-text-hidden .nav-section-toggle .nav-label,
.app-shell.sidebar-text-hidden .nav-chevron,
.app-shell.sidebar-text-hidden .nav-text,
.app-shell.sidebar-text-hidden .nav-badge,
.app-shell.sidebar-collapsed .nav-section-toggle .nav-label,
.app-shell.sidebar-collapsed .nav-chevron,
.app-shell.sidebar-collapsed .nav-text,
.app-shell.sidebar-collapsed .nav-badge,
.sidebar-collapsed-initial .app-shell .nav-section-toggle .nav-label,
.sidebar-collapsed-initial .app-shell .nav-chevron,
.sidebar-collapsed-initial .app-shell .nav-text,
.sidebar-collapsed-initial .app-shell .nav-badge {
    width: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.app-shell.sidebar-text-hidden .nav-section-toggle,
.app-shell.sidebar-collapsed .nav-section-toggle,
.sidebar-collapsed-initial .app-shell .nav-section-toggle {
    justify-content: center;
}

.app-shell.sidebar-text-hidden .nav-item,
.app-shell.sidebar-collapsed .nav-item,
.sidebar-collapsed-initial .app-shell .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    width: 100%;
    min-height: 40px;
    padding: 0;
    justify-self: center;
    border-radius: 0;
    background: transparent !important;
}

.app-shell.sidebar-collapsed .nav-item:hover,
.app-shell.sidebar-collapsed .nav-item.active,
.sidebar-collapsed-initial .app-shell .nav-item:hover,
.sidebar-collapsed-initial .app-shell .nav-item.active {
    transform: none;
    background: transparent !important;
}

.app-shell.sidebar-collapsed .nav-icon:hover,
.app-shell.sidebar-collapsed .nav-item.active .nav-icon,
.sidebar-collapsed-initial .app-shell .nav-icon:hover,
.sidebar-collapsed-initial .app-shell .nav-item.active .nav-icon {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

@media (max-width: 1100px) {
    .filter-panel {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }

    .statistics-filter {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .inline-receipt-fields {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-left {
        min-width: 0;
        width: 100%;
        flex-wrap: wrap;
    }

    .topbar-actions {
        align-self: flex-end;
    }
}

@media (max-width: 820px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 20;
        width: 300px;
    }

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

    .main-area,
    .app-shell.sidebar-collapsed .main-area {
        width: 100%;
        margin-left: 0;
    }

    .app-shell.sidebar-collapsed .sidebar {
        width: 300px;
        padding: 30px 28px;
    }

    .app-shell.sidebar-collapsed .brand-copy,
    .app-shell.sidebar-collapsed .nav-section-toggle .nav-label,
    .app-shell.sidebar-collapsed .nav-chevron,
    .app-shell.sidebar-collapsed .nav-text,
    .app-shell.sidebar-collapsed .nav-badge {
        width: auto;
        opacity: 1;
        pointer-events: auto;
        overflow: visible;
    }

    .app-shell.sidebar-collapsed .nav-item {
        grid-template-columns: 28px 1fr auto;
        justify-items: stretch;
    }

    .top-search {
        width: min(100%, 310px);
    }

    .content {
        padding: 22px 16px;
    }

    .action-card,
    .section-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-receipt-fields {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        grid-template-columns: 1fr;
    }

    .statistics-filter,
    .user-create-panel {
        grid-template-columns: 1fr;
    }

    .inline-receipt-card .button-row {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .topbar-actions {
        align-self: stretch;
        justify-content: space-between;
        gap: 8px;
    }

    .user-button span:not(.avatar) {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-panel {
        padding: 34px 24px;
    }

    .login-headline {
        gap: 16px;
    }

    .login-panel h1 {
        font-size: 28px;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
    padding: 20px;
}

.modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s var(--ease);
}

.modal-overlay.is-open .modal-content {
    transform: scale(1);
}

.modal-header {
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--text);
}

.modal-body {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.modal-body label {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 14px;
}

.modal-body input,
.modal-body select {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    margin: 0;
}

.modal-body input:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(63, 128, 234, 0.1);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer button {
    min-height: 38px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.modal-large {
    max-width: 700px;
}
