html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: #eef2f5;
    color: #25313d;
}

#root {
    min-height: 100vh;
    height: 100vh;
    min-width: 0;
}

.accounting-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #eef2f5;
}

.accounting-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
}

.accounting-er-module {
    height: 100%;
}

.accounting-login-shell {
    min-height: 100vh;
}

.crm-login-card {
    width: min(390px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 56px rgba(19, 31, 43, 0.32);
}

.crm-login-brand {
    margin-bottom: 6px;
    color: #1f6fb2;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.crm-login-card .crm-login-title {
    margin-bottom: 12px;
}

.crm-login-card .crm-login-form {
    padding: 8px 0 0;
}

.accounting-shell .crm-shell-top {
    flex: 0 0 54px;
    height: 54px;
    padding: 0 16px 0 18px;
    border-bottom: 1px solid #5f646a;
    background: #747980;
    box-shadow: 0 1px 2px rgba(20, 31, 42, 0.12);
}

.crm-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}

.crm-brand-title {
    color: #fff;
    font-size: 18px;
    line-height: 22px;
    font-weight: 700;
    white-space: nowrap;
}

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

.crm-top-button {
    height: 30px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.crm-top-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.accounting-tenant-label {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 13px;
    font-weight: 500;
    opacity: 0.85;
}

.accounting-import-button {
    border-color: rgba(255, 193, 7, 0.55);
    background: rgba(255, 193, 7, 0.16);
    color: #fff;
}

.accounting-import-button:hover {
    background: rgba(255, 193, 7, 0.25);
}

.accounting-tenant-card {
    width: min(520px, calc(100vw - 32px));
}

.accounting-er-module,
.accounting-er-module .fibu-tab-pane,
.accounting-er-module .fibu-list-panel {
    min-height: 0;
}

.accounting-er-module .fibu-list-panel {
    overflow: hidden;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 39, 54, 0.08);
}

.accounting-er-module .fibu-panel-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    justify-content: start;
    column-gap: 18px;
    min-height: 56px;
    padding: 10px 12px;
    border-bottom-color: #e0e6ec;
    background: #fff;
}

.accounting-er-module .fibu-panel-title {
    font-size: 16px;
    line-height: 21px;
}

.accounting-er-module .fibu-panel-subtitle {
    margin-top: 2px;
    font-size: 12px;
}

.accounting-er-module .fibu-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 7px;
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
}

.accounting-er-module .fibu-actions .fibu-button {
    flex: 0 0 auto;
}

.accounting-er-module .fibu-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #e7ecf1;
    background: #f7f9fb;
}

.accounting-er-module .fibu-filter-controls {
    display: flex;
    align-items: end;
    flex: 0 0 auto;
    gap: 8px;
}

.accounting-er-module .fibu-filter-field input {
    width: 142px;
}

.accounting-er-module .fibu-summe-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 220px;
    margin-left: 0;
    white-space: normal;
}

.fibu-summe-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 3px 9px;
    border: 1px solid #d7e1eb;
    border-radius: 6px;
    background: #fff;
    color: #526171;
    font-size: 12px;
}

.fibu-summe-chip span {
    color: #24313d;
    font-weight: 650;
}

.fibu-summe-chip b {
    color: #1f6fb2;
    font-weight: 650;
}

.fibu-camt-tx-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid #d7e3ef;
    border-radius: 6px;
    background: #f8fbff;
    color: #344250;
    font-size: 12px;
}

.fibu-camt-tx-card span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fibu-camt-tx-card b {
    margin-right: 4px;
    color: #1d2733;
}

.fibu-camt-candidate-status {
    min-height: 18px;
    color: #607080;
    font-size: 12px;
    line-height: 18px;
}

.accounting-elba-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #dde5ec;
    font-size: 12px;
}

.accounting-elba-table th,
.accounting-elba-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #edf1f5;
    text-align: left;
    vertical-align: top;
}

.accounting-elba-table th {
    background: #f4f7fa;
    color: #263442;
    font-weight: 650;
}

.accounting-elba-table td {
    word-break: break-word;
}

.accounting-elba-table .accounting-elba-amount {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
    text-align: right;
    white-space: nowrap;
    word-break: normal;
    font-variant-numeric: tabular-nums;
}

.accounting-er-module .crm-grid-container {
    border-top: 0;
}

.accounting-er-module .crm-grid .dhx_grid-header-cell {
    background: #f1f4f7 !important;
    border-bottom: 1px solid #cfd8e2 !important;
    color: #263442 !important;
}

.accounting-er-module .crm-grid .dhx_grid-row:nth-child(even),
.accounting-er-module .crm-grid .dhx_grid-row:nth-child(even) .dhx_grid-cell {
    background: #fafbfc !important;
}

.accounting-er-module .crm-grid .dhx_grid-row.row-green,
.accounting-er-module .crm-grid .dhx_grid-row.row-green:nth-child(even),
.accounting-er-module .crm-grid .dhx_grid-row.row-green .dhx_grid-cell,
.accounting-er-module .crm-grid .dhx_grid-row.row-green:nth-child(even) .dhx_grid-cell,
.accounting-er-module .crm-grid .dhx_grid-row.row-green .dhx_grid-cell__content,
.accounting-er-module .crm-grid .dhx_grid-row.row-green .fibu-grid-input {
    background: #dff3df !important;
}

.accounting-er-module .crm-grid .dhx_grid-row.row-green input,
.accounting-er-module .crm-grid .dhx_grid-row.row-green select {
    background-color: #dff3df !important;
}

.accounting-er-module .fibu-button {
    height: 30px;
    border-radius: 4px;
    font-weight: 500;
}

.accounting-er-module .fibu-button-secondary {
    background: #fff;
}

.accounting-er-module .fibu-button-separated {
    margin-right: 12px;
    position: relative;
}

.accounting-er-module .fibu-button-separated::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 5px;
    bottom: 5px;
    width: 1px;
    background: #ccd6e0;
}

.accounting-er-module .fibu-button-right {
    margin-left: auto;
    margin-right: 12px;
}

.accounting-er-module .fibu-button-right-start {
    margin-left: auto;
}

.accounting-er-module .fibu-button-right-end {
    margin-right: 12px;
}

.accounting-faq-modal {
    display: grid;
    gap: 8px;
    max-height: 640px;
}

.accounting-faq-modal h3 {
    margin: 10px 0 0;
    color: #25313d;
    font-size: 14px;
    line-height: 20px;
}

.accounting-faq-modal p {
    margin: 0;
    color: #465565;
    font-size: 13px;
    line-height: 20px;
}

.accounting-er-module .fibu-grid-input,
.accounting-er-module .fibu-input {
    border-radius: 4px;
}

.fibu-modal {
    border-radius: 8px;
    border-color: #d2dbe4;
    box-shadow: 0 24px 70px rgba(15, 29, 43, 0.34);
}

.fibu-modal-head {
    min-height: 52px;
    box-sizing: border-box;
    background: #f8fafc;
}

.fibu-modal-body {
    background: #fff;
}

.fibu-modal-actions {
    background: #f8fafc;
}

.fibu-modal-toolbar {
    justify-content: flex-start !important;
    flex-wrap: wrap;
    border-top: 0 !important;
    border-bottom: 1px solid #d8dee5 !important;
}

.fibu-icon-button {
    border-color: #cfd8e2;
    background: #fff;
    color: #263442;
}

.fibu-icon-button:hover {
    border-color: #1f6fb2;
    color: #1f6fb2;
}

.tenant-admin {
    display: grid;
    grid-template-columns: minmax(360px, 0.8fr) minmax(560px, 1.2fr);
    gap: 14px;
    height: 100%;
    min-height: 0;
}

.tenant-admin-list,
.tenant-admin-form {
    min-height: 0;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 39, 54, 0.08);
}

.tenant-admin-list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tenant-admin-head {
    flex: 0 0 auto;
    border-bottom: 1px solid #e0e6ec;
}

#tenant-grid {
    flex: 1 1 auto;
    min-height: 0;
}

.tenant-admin-form {
    padding: 14px;
    box-sizing: border-box;
    overflow: auto;
}

.tenant-admin-card {
    padding: 12px;
    border: 1px solid #dde5ec;
    border-radius: 8px;
    background: #fbfcfd;
}

.tenant-admin-card + .tenant-admin-card {
    margin-top: 12px;
}

.tenant-admin-card-main {
    background: #fff;
}

.tenant-form-title {
    margin-bottom: 10px;
    color: #25313d;
    font-size: 16px;
    line-height: 22px;
    font-weight: 700;
}

.tenant-form-subtitle {
    margin: 14px 0 8px;
    color: #526171;
    font-size: 12px;
    line-height: 18px;
    font-weight: 700;
}

.tenant-field {
    display: block;
    margin-bottom: 12px;
}

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

.tenant-field-wide {
    grid-column: 1 / -1;
}

.tenant-field span,
.tenant-check span {
    color: #526171;
    font-size: 12px;
    line-height: 18px;
    font-weight: 600;
}

.tenant-field input {
    width: 100%;
    box-sizing: border-box;
}

.tenant-field input[readonly] {
    background: #f4f6f8;
    color: #687584;
}

.tenant-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

.tenant-check-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 6px;
}

.tenant-check-row .tenant-check {
    margin: 0;
}

.tenant-status {
    margin: 14px 0;
    padding: 9px 10px;
    border: 1px solid #d7e1eb;
    border-radius: 6px;
    background: #f8fafc;
    color: #526171;
    font-size: 12px;
    line-height: 18px;
}

.tenant-status-ok {
    border-color: #bdddc7;
    background: #f1fbf4;
    color: #276738;
}

.tenant-status-warning {
    border-color: #ead39b;
    background: #fff8e8;
    color: #7a5a15;
}

.tenant-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.tenant-user-section {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.tenant-user-create {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
    align-items: end;
    gap: 8px;
}

.tenant-user-create .tenant-field {
    margin-bottom: 0;
}

.tenant-user-create .fibu-button {
    margin-top: 0;
}

.tenant-user-create-admin {
    margin: 0;
    align-self: center;
}

.tenant-user-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px auto;
    align-items: center;
    gap: 8px;
}

.tenant-user-add button {
    justify-self: start;
}

.tenant-user-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.tenant-user-manage-list {
    display: grid;
    gap: 8px;
}

.tenant-manage-row {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) 88px 120px minmax(220px, auto);
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid #dde5ec;
    border-radius: 6px;
    background: #fff;
}

.tenant-manage-row .tenant-field,
.tenant-manage-row .tenant-check {
    margin: 0;
}

.tenant-user-2fa,
.tenant-user-last-active {
    color: #687584;
    font-size: 12px;
    white-space: nowrap;
}

.tenant-user-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.tenant-user-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}

.tenant-manage-row .fibu-button {
    height: 28px;
    min-width: 82px;
    padding: 0 10px;
    white-space: nowrap;
}

.tenant-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #dde5ec;
    border-radius: 6px;
    background: #fbfcfd;
}

.tenant-user-main {
    min-width: 0;
}

.tenant-user-main b,
.tenant-user-main span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-user-main b {
    color: #25313d;
    font-size: 13px;
}

.tenant-user-main span,
.tenant-user-empty {
    color: #687584;
    font-size: 12px;
}

.tenant-user-role-inline {
    width: 110px;
}

.tenant-user-remove {
    height: 28px;
    padding: 0 8px;
}

@media (max-width: 980px) {
    .accounting-content {
        padding: 10px;
    }

    .accounting-shell .crm-shell-top {
        height: auto;
        min-height: 54px;
        flex-basis: auto;
        align-items: flex-start;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
        flex-direction: column;
    }

    .crm-top-actions,
    .accounting-er-module .fibu-panel-head,
    .accounting-er-module .fibu-actions,
    .accounting-er-module .fibu-filter-bar,
    .accounting-er-module .fibu-filter-controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .accounting-er-module .fibu-panel-head {
        display: flex;
    }

    .accounting-er-module .fibu-actions {
        max-width: none;
    }

    .accounting-er-module .fibu-button-separated {
        margin-right: 0;
    }

    .accounting-er-module .fibu-button-separated::after {
        display: none;
    }

    .accounting-er-module .fibu-button-right {
        margin-left: 0;
        margin-right: 0;
    }

    .accounting-er-module .fibu-button-right-start,
    .accounting-er-module .fibu-button-right-end {
        margin-left: 0;
        margin-right: 0;
    }

    .accounting-er-module .fibu-summe-label {
        justify-content: flex-start;
        min-width: 0;
    }

    .fibu-camt-tx-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tenant-admin {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .tenant-admin-list {
        min-height: 420px;
    }

    .tenant-form-grid,
    .tenant-user-create,
    .tenant-user-add {
        grid-template-columns: 1fr;
    }

    .tenant-manage-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .tenant-user-meta,
    .tenant-user-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.accounting-tenant-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.accounting-tenant-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #d8dee5;
    background: #fff;
    color: #1f2933;
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.accounting-tenant-button:hover {
    border-color: #6c8ebf;
    background: #f7faff;
}

.accounting-tenant-button span {
    font-weight: 650;
}

.accounting-tenant-button small {
    color: #697386;
}

.crm-2fa-setup {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin: 14px 0 18px;
}

.crm-2fa-qr {
    width: 180px;
    height: 180px;
    border: 1px solid #d8dee5;
    border-radius: 8px;
    background: #fff;
}

.crm-2fa-secret {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d8dee5;
    border-radius: 6px;
    background: #f8fafc;
    color: #3b4754;
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    text-align: center;
    word-break: break-all;
}

.crm-login-hint {
    color: #697386;
    font-size: 13px;
    line-height: 1.45;
}

.crm-login-card-wide {
    width: min(460px, calc(100vw - 32px));
}
