html, body {
    margin: 0;
    padding: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: #f3f5f9;
    color: #0f172a;
}

a {
    text-decoration: none;
}

* {
    box-sizing: border-box;
}

.blank-layout-root {
    min-height: 100vh;
}

/* LOGIN */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    background: #ffffff;
}

.login-hero-panel {
    min-height: 100vh;
    padding: 34px 34px 22px;
    background: radial-gradient(circle at 20% 20%, rgba(84, 62, 246, 0.10), transparent 25%), linear-gradient(135deg, #111935 0%, #141c3f 52%, #0e1431 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.login-brand-header,
.company-picker-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-brand-icon,
.company-picker-brand-icon,
.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #6456ff 0%, #513df4 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(89, 70, 255, 0.28);
}

.login-brand-title,
.company-picker-brand-title,
.brand-title {
    font-size: 20px;
    line-height: 1.1;
    font-weight: 800;
}

.login-brand-subtitle,
.company-picker-brand-subtitle,
.brand-subtitle {
    font-size: 13px;
    color: #8ea0c8;
}

.login-hero-card {
    margin-top: 52px;
    width: 100%;
    max-width: 840px;
    min-height: 466px;
    padding: 42px;
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-hero-illustration {
    position: relative;
    width: 100%;
    max-width: 620px;
    height: 320px;
}

.hero-shape {
    position: absolute;
    border-radius: 18px;
    background: linear-gradient(180deg, #7081f7 0%, #4756d9 100%);
    box-shadow: 0 16px 30px rgba(57, 77, 171, 0.24);
}

.hero-book {
    left: 50px;
    top: 48px;
    width: 150px;
    height: 92px;
    transform: rotate(-28deg);
}

.hero-cloud {
    left: 200px;
    top: 162px;
    width: 160px;
    height: 78px;
    border-radius: 40px;
    background: linear-gradient(180deg, #8795ff 0%, #6272ee 100%);
}

.hero-bars {
    right: 52px;
    top: 28px;
    width: 164px;
    height: 108px;
    transform: skew(-10deg);
}

.hero-coins {
    left: 205px;
    top: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.hero-scales {
    left: 64px;
    bottom: 6px;
    width: 182px;
    height: 112px;
}

.hero-bank {
    left: 260px;
    bottom: 8px;
    width: 80px;
    height: 58px;
}

.hero-gear {
    right: 110px;
    bottom: 26px;
    width: 136px;
    height: 86px;
    transform: rotate(26deg);
}

.login-copy-block {
    margin-top: 28px;
    max-width: 560px;
}

    .login-copy-block h1 {
        margin: 0;
        font-size: 59px;
        line-height: 1.02;
        font-weight: 900;
        letter-spacing: -0.03em;
    }

        .login-copy-block h1 span {
            color: #7f8fff;
        }

    .login-copy-block p {
        margin: 26px 0 0;
        color: #b7c2df;
        font-size: 17px;
        line-height: 1.65;
    }

.login-footer-status {
    margin-top: auto;
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
    color: #7f8db7;
    font-size: 14px;
}

    .login-footer-status span,
    .login-inline-status span,
    .topbar-online {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

        .login-footer-status i,
        .login-inline-status i,
        .topbar-online i {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #2bc57b;
            box-shadow: 0 0 0 3px rgba(43, 197, 123, 0.12);
        }

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 56px;
    background: #fff;
}

.login-form-wrap {
    width: 100%;
    max-width: 454px;
}

.login-form-box h2 {
    margin: 0;
    font-size: 50px;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.login-form-box > p {
    margin: 14px 0 32px;
    color: #8b97b1;
    font-size: 22px;
}

.login-input {
    margin-bottom: 18px;
}

    .login-input .mud-input-slot,
    .login-input .mud-input > input {
        font-size: 20px !important;
    }

    .login-input .mud-input-control {
        min-height: 72px;
    }

.login-submit {
    height: 58px;
    border-radius: 8px;
    margin-top: 6px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.login-submit-hint {
    opacity: 0.75;
    font-weight: 500;
    margin-left: 4px;
}

.login-demo-box {
    margin-top: 28px;
    padding: 18px 18px 14px;
    border: 1px solid #dfe5ef;
    border-radius: 8px;
    color: #66748d;
    font-size: 15px;
    line-height: 1.6;
    background: #fbfcfe;
}

.login-inline-status {
    display: flex;
    gap: 24px;
    margin-top: 26px;
    color: #8aa0b3;
    font-size: 15px;
}

/* COMPANY PICKER */
.company-picker-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: #f2f4f8;
}

.company-picker-card {
    width: 100%;
    max-width: 1180px;
}

.company-picker-box {
    margin-top: 18px;
    background: #fff;
    border: 1px solid #dce2ec;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(12, 23, 49, 0.04);
    overflow: hidden;
}

.company-picker-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 20px 24px 16px;
}

.company-picker-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5b4df7;
    background: #f0edff;
}

.company-picker-title {
    font-size: 34px;
    line-height: 1.1;
    font-weight: 800;
    color: #111827;
}

.company-picker-subtitle {
    margin-top: 6px;
    color: #8b97ae;
    font-size: 16px;
}

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

    .company-picker-table thead th {
        text-align: left;
        font-size: 13px;
        font-weight: 700;
        color: #77849f;
        letter-spacing: 0.06em;
        padding: 14px 20px;
        background: #fafbfe;
        border-top: 1px solid #ebeff5;
        border-bottom: 1px solid #ebeff5;
    }

    .company-picker-table tbody td {
        padding: 16px 20px;
        border-bottom: 1px solid #edf1f7;
        font-size: 16px;
        color: #1f2937;
    }

    .company-picker-table tbody tr {
        cursor: pointer;
        transition: background 0.15s ease;
    }

        .company-picker-table tbody tr.selected {
            background: #eef0ff;
        }

        .company-picker-table tbody tr:hover {
            background: #f7f8fd;
        }

.firma-name-cell {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-weight: 700;
}

.role-badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 8px;
    background: #eef0ff;
    color: #4c43db;
    font-size: 13px;
    font-weight: 800;
}

.year-cell {
    font-weight: 800;
}

.arrow-cell {
    text-align: right;
    color: #6056f7;
}

.company-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fafbfd;
}

.company-picker-logout,
.sidebar-bottom-link.logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: #5f6d88;
    font-size: 16px;
    cursor: pointer;
}

.company-picker-footer-right {
    display: flex;
    align-items: center;
    gap: 18px;
    color: #9aa6bd;
    font-size: 15px;
}

.company-picker-open {
    min-width: 120px;
    height: 44px;
}

.company-picker-hints {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 18px;
    color: #96a2b7;
    font-size: 14px;
}

    .company-picker-hints kbd,
    .topbar-searchbox kbd {
        padding: 2px 6px;
        border-radius: 6px;
        border: 1px solid #e2e8f0;
        background: #fff;
        color: #8a95aa;
        font-size: 12px;
        font-family: inherit;
    }

/* MAIN SHELL */
.finknjig-layout {
    min-height: 100vh;
    background: #f3f5f9;
}

.finknjig-drawer {
    background: #06102d;
    color: #d9e2ff;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.finknjig-sidebar {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #081233 0%, #040d25 100%);
}

.finknjig-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-collapse {
    margin-left: auto;
    color: #8091b6;
}

.finknjig-sidebar-company {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-section-caption,
.sidebar-group-title {
    color: #6f80a8;
    font-size: 12px;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.sidebar-company-name {
    margin-top: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    line-height: 1.25;
}

.sidebar-company-meta {
    margin-top: 4px;
    color: #8da0cb;
    font-size: 15px;
}

    .sidebar-company-meta span {
        margin: 0 5px;
    }

.sidebar-nav-tree {
    flex: 1;
    overflow: auto;
    padding: 10px 10px 20px;
}

.sidebar-group {
    margin-top: 14px;
}

.sidebar-group-title {
    padding: 10px 10px 8px;
}

.sidebar-link,
.sidebar-bottom-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: #d7def2;
    font-size: 16px;
    transition: background 0.15s ease, color 0.15s ease;
}

    .sidebar-link em {
        margin-left: auto;
        color: #7486af;
        font-style: normal;
        font-size: 12px;
    }

    .sidebar-link:hover,
    .sidebar-bottom-link:hover {
        background: rgba(255,255,255,0.06);
    }

    .sidebar-link.active {
        background: linear-gradient(90deg, #6048ff 0%, #6e41ff 100%);
        color: #fff;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
    }

.sidebar-bottom-actions {
    padding: 12px 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-bottom-link.logout {
    width: 100%;
    color: #ff7c9f;
}

.finknjig-main {
    margin-left: 286px;
    min-height: 100vh;
}

.finknjig-topbar {
    height: 76px;
    padding: 0 22px;
    background: #fff;
    border-bottom: 1px solid #e7ebf2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-breadcrumbs {
    color: #7b879c;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 9px;
}

    .topbar-breadcrumbs .sep {
        color: #c4cad7;
    }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #6c7a92;
    font-size: 14px;
}

.topbar-searchbox {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e4e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8996ae;
    background: #fff;
}

.topbar-online {
    color: #3e9f66;
}

.topbar-notify {
    position: relative;
    color: #60708b;
}

    .topbar-notify span {
        position: absolute;
        top: -7px;
        right: -8px;
        min-width: 16px;
        height: 16px;
        border-radius: 999px;
        background: #ef476f;
        color: #fff;
        font-size: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

.topbar-user,
.topbar-date,
.topbar-role {
    white-space: nowrap;
}

.finknjig-page-body {
    padding: 26px 26px 32px;
}

/* DASHBOARD */
.dashboard-page-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dashboard-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-kpi-card,
.dashboard-panel {
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.dashboard-kpi-card {
    min-height: 170px;
    padding: 16px 18px 18px;
    position: relative;
    overflow: hidden;
}

    .dashboard-kpi-card::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        width: 4px;
        height: 100%;
    }

    .dashboard-kpi-card.purple::before {
        background: #5f52f7;
    }

    .dashboard-kpi-card.green::before {
        background: #16a34a;
    }

    .dashboard-kpi-card.orange::before {
        background: #f59e0b;
    }

    .dashboard-kpi-card.red::before {
        background: #ef4444;
    }

.kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fb;
    color: #635bff;
}

.kpi-period {
    position: absolute;
    top: 16px;
    right: 18px;
    color: #9aa7bc;
    font-size: 14px;
}

.kpi-value {
    margin-top: 22px;
    font-size: 46px;
    line-height: 1;
    font-weight: 900;
    color: #111827;
}

.kpi-title {
    margin-top: 8px;
    font-size: 19px;
    color: #3d4b63;
}

.kpi-meta {
    margin-top: 8px;
    color: #97a3ba;
    font-size: 15px;
}

    .kpi-meta.success {
        color: #16a34a;
    }

.dashboard-middle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel-header {
    min-height: 40px;
    padding: 10px 14px;
    border-bottom: 1px solid #e9edf4;
    color: #7c8ba4;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
}

    .panel-header span {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

.panel-header-between {
    justify-content: space-between;
}

    .panel-header-between a,
    .click-hint {
        color: #787ff7;
        font-weight: 700;
        letter-spacing: 0;
        font-size: 13px;
    }

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
}

.quick-action-card {
    min-height: 66px;
    padding: 14px;
    border: 1px solid #e7ebf1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #334155;
    background: #fff;
}

    .quick-action-card strong {
        display: block;
        font-size: 17px;
        line-height: 1.25;
    }

    .quick-action-card span {
        display: block;
        margin-top: 2px;
        color: #94a3b8;
        font-size: 13px;
    }

.budget-list {
    padding: 14px 12px 10px;
}

.budget-item + .budget-item {
    margin-top: 12px;
}

.budget-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #374151;
    font-size: 16px;
}

    .budget-row.subtle {
        margin-top: 4px;
        color: #9aa6bc;
        font-size: 13px;
    }

.budget-bar {
    margin-top: 6px;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #e7edf5;
    overflow: hidden;
}

    .budget-bar span {
        display: block;
        height: 100%;
        border-radius: 999px;
    }

    .budget-bar .orange {
        background: #f59e0b;
    }

    .budget-bar .red {
        background: #ef4444;
    }

    .budget-bar .purple {
        background: #6157f8;
    }

    .budget-bar .indigo {
        background: #4f46e5;
    }

.dashboard-alerts-panel .panel-header em {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ef476f;
    color: #fff;
    font-style: normal;
    font-size: 11px;
}

.alert-feed {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-row {
    min-height: 72px;
    border-radius: 8px;
    border: 1px solid #e8edf4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
}

    .alert-row strong {
        display: block;
        font-size: 16px;
        color: #5b4a00;
    }

    .alert-row span {
        display: block;
        margin-top: 4px;
        color: #8d8b75;
        font-size: 14px;
    }

    .alert-row.yellow {
        background: #fbf7dd;
        border-left: 4px solid #f59e0b;
    }

    .alert-row.red {
        background: #fdeced;
        border-left: 4px solid #ef4444;
    }

    .alert-row.blue {
        background: #eef4ff;
        border-left: 4px solid #3b82f6;
    }

    .alert-row.green {
        background: #edf8f1;
        border-left: 4px solid #16a34a;
    }

    .alert-row.red strong {
        color: #7f1d1d;
    }

    .alert-row.blue strong {
        color: #1e3a8a;
    }

    .alert-row.green strong {
        color: #166534;
    }

    .alert-row.red span {
        color: #a56a6a;
    }

    .alert-row.blue span {
        color: #6f83b8;
    }

    .alert-row.green span {
        color: #6c947a;
    }

/* old helpers kept */
.app-main-content {
    padding-top: 0 !important;
}

@media (max-width: 1400px) {
    .login-page {
        grid-template-columns: 1fr 1fr;
    }

    .login-copy-block h1 {
        font-size: 48px;
    }

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

@media (max-width: 1100px) {
    .login-page,
    .dashboard-middle-grid {
        grid-template-columns: 1fr;
    }

    .finknjig-main {
        margin-left: 0;
    }

    .finknjig-drawer {
        display: none;
    }

    .finknjig-topbar {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding: 16px;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 760px) {
    .login-form-panel,
    .login-hero-panel,
    .finknjig-page-body {
        padding: 20px;
    }

    .login-copy-block h1,
    .login-form-box h2,
    .company-picker-title {
        font-size: 34px;
    }

    .dashboard-kpi-row,
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .company-picker-footer,
    .company-picker-footer-right,
    .login-inline-status {
        flex-direction: column;
        align-items: flex-start;
    }
}


.company-picker-table-mud {
    border: 1px solid #ebeff5;
    border-radius: 14px;
    overflow: hidden;
}

.company-picker-table-mud .mud-table-container {
    max-height: 420px;
}

.company-picker-table-mud .mud-table-head th {
    background: #fafbfe;
    color: #77849f;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.company-picker-table-mud .lookup-selected-row > td {
    background: #eef2ff !important;
    color: #2f3ea8 !important;
    font-weight: 600;
}

.company-picker-table-mud .lookup-selected-row .role-badge {
    background: #dfe4ff;
}


.sidebar-group {
    margin-bottom: 6px;
}

.sidebar-group-toggle {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: none;
    background: transparent;
    color: #56627c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 10px;
    cursor: pointer;
}

.sidebar-group-toggle:hover {
    background: rgba(100, 86, 255, 0.06);
    color: #2f3b57;
}

.sidebar-group-toggle-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-group-icon {
    color: #6a78a1;
}

.sidebar-group-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: inherit;
}

.sidebar-group-children {
    margin-top: 4px;
    padding-left: 12px;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
}
