.gk-ledger-workspace {
    --gk-field-height: var(--app-field-height, 40px);
    --gk-control-height: var(--gk-field-height);
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 5px 7px 0;
}

.gk-main-grid {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.gk-card {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--color-border, #dce3ee);
    border-radius: 12px;
    background: var(--color-surface, #fff);
    box-shadow: 0 5px 16px rgba(23, 45, 82, .08);
}

.gk-card-header {
    min-height: 52px;
    padding: 8px 13px;
    border-bottom: 1px solid var(--color-border, #dce3ee);
    background: color-mix(in srgb, var(--color-surface-muted, #f6f8fc) 82%, #fff);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.gk-card-header > div {
    min-width: 0;
}

.gk-card-header h2 {
    margin: 2px 0 0;
    color: var(--color-primary, #244781);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .045em;
    line-height: 1.1;
    text-transform: uppercase;
}

.gk-card-eyebrow {
    display: block;
    color: var(--color-text-muted, #66748a);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.gk-active-badge,
.gk-count-badge {
    flex: 0 0 auto;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid color-mix(in srgb, var(--color-success, #16875a) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-success, #16875a) 9%, var(--color-surface, #fff));
    color: var(--color-success, #16875a);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.gk-count-badge {
    border-color: color-mix(in srgb, var(--color-primary, #244781) 22%, transparent);
    background: color-mix(in srgb, var(--color-primary, #244781) 7%, var(--color-surface, #fff));
    color: var(--color-primary, #244781);
}

.gk-document-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.gk-document-fields {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gk-field-group {
    min-width: 0;
    margin: 0;
    padding: 17px 14px 18px;
    border: 0;
    border-bottom: 1px solid var(--color-border, #dce3ee);
}

.gk-field-group:last-child {
    border-bottom: 0;
}

.gk-field-group legend {
    width: auto;
    margin: 0 0 10px;
    padding: 0;
    color: var(--color-primary, #244781);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.gk-two-column-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.gk-field-group--document {
    display: grid;
    grid-template-columns: 1fr;
    gap: 13px;
}

.gk-field-group--document legend {
    margin-bottom: 0;
}

.gk-readonly-field {
    min-width: 0;
    min-height: 49px;
    padding: 7px 9px;
    border: 1px solid var(--color-border, #dce3ee);
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface-muted, #f6f8fc) 72%, #fff);
}

.gk-readonly-field span,
.gk-readonly-field strong {
    display: block;
}

.gk-readonly-field span {
    margin-bottom: 4px;
    color: var(--color-text-muted, #66748a);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.gk-readonly-field strong {
    overflow: hidden;
    color: var(--color-text, #24324a);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gk-document-empty,
.gk-items-empty {
    min-height: 0;
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-text-muted, #66748a);
    text-align: center;
}

.gk-document-empty i,
.gk-items-empty i {
    margin-bottom: 4px;
    color: var(--color-border-strong, #bcc7d6);
    font-size: 40px;
}

.gk-document-empty strong,
.gk-items-empty strong {
    color: var(--color-text, #24324a);
    font-size: 17px;
}

.gk-document-empty span,
.gk-items-empty span {
    max-width: 390px;
    font-size: 12px;
    line-height: 1.45;
}

.gk-empty-action {
    min-height: 36px;
    margin-top: 8px;
    padding: 0 13px;
    border: 1px solid var(--color-primary, #244781);
    border-radius: 8px;
    background: var(--color-primary, #244781);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.gk-items-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: 100%;
}

.gk-items-panel > .gk-items-empty {
    grid-row: 2 / -1;
}

.gk-entry-panel {
    min-width: 0;
    padding: 7px 12px 0;
    background: color-mix(in srgb, var(--color-primary-soft, #eef4ff) 52%, var(--color-surface, #fff));
}

.gk-entry-heading {
    min-height: 19px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--color-text-muted, #66748a);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
}

.gk-reset-entry {
    padding: 2px 5px;
    border: 0;
    background: transparent;
    color: var(--color-danger, #dc3545);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 750;
    cursor: pointer;
}

.gk-entry-grid {
    display: grid;
    grid-template-columns: minmax(215px, 1.15fr) minmax(245px, 1.35fr) minmax(90px, .48fr) minmax(90px, .48fr) 100px;
    align-items: end;
    gap: 7px;
    min-width: 0;
}

.gk-entry-field,
.gk-entry-control {
    min-width: 0;
}

.gk-entry-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gk-entry-field > label {
    margin: 0;
    color: var(--color-text-muted, #66748a);
    display: flex;
    align-items: center;
    min-height: 14px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .025em;
    line-height: 1.4;
    text-transform: uppercase;
}

.gk-ledger-workspace .input-wrapper {
    margin-bottom: 0 !important;
}

.gk-ledger-workspace .error-message {
    display: none !important;
}

.gk-entry-grid .gk-entry-control .readonly-value__wrapper {
    margin-bottom: 0;
}

.gk-entry-grid .gk-entry-control .readonly-value__content {
    min-height: var(--gk-control-height);
    padding: 4px 10px;
}

.gk-entry-control .col-md-12 {
    width: 100%;
    max-width: none;
    padding: 0;
}

.gk-entry-control .lookup-field,
.gk-entry-control .kl-row {
    gap: 6px;
}

.gk-entry-control .lookup-code-cell--konto {
    flex-basis: 78px;
    max-width: 78px;
    min-width: 68px;
}

.gk-entry-control .kl-col-id {
    flex-basis: 82px;
    max-width: 82px;
    min-width: 70px;
    width: 82px;
}

.gk-ledger-workspace .gk-entry-grid .gk-entry-control .kl-actions,
.gk-ledger-workspace .gk-entry-grid .gk-entry-control .lookup-actions {
    padding-top: 0;
}

.gk-entry-grid .gk-entry-control .lookup-action-btn,
.gk-entry-grid .gk-entry-control .kl-action-btn {
    width: var(--gk-control-height);
    min-width: var(--gk-control-height);
    height: var(--gk-control-height);
}

.gk-entry-field--amount .input-label {
    display: flex;
    align-items: center;
    min-height: 14px;
    margin-bottom: 4px;
    color: var(--color-text-muted, #66748a);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .025em;
    line-height: 1.4;
    text-transform: uppercase;
}

.gk-entry-field--amount .input-field {
    font-weight: 750;
    text-align: right;
}

.gk-add-entry {
    height: var(--gk-control-height);
    padding: 0 12px;
    border: 1px solid var(--color-primary, #244781);
    border-radius: 8px;
    background: var(--color-primary, #244781);
    box-shadow: 0 4px 9px rgba(36, 71, 129, .18);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.gk-add-entry:hover,
.gk-empty-action:hover {
    background: color-mix(in srgb, var(--color-primary, #244781) 88%, #000);
}

.gk-shortcuts {
    min-height: 28px;
    margin: 6px -12px 0;
    padding: 4px 13px;
    border-top: 1px solid var(--color-border, #dce3ee);
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--color-text-muted, #66748a);
    font-size: 9px;
    font-weight: 650;
}

.gk-shortcuts span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.gk-shortcuts kbd {
    min-width: 20px;
    padding: 1px 4px;
    border: 1px solid var(--color-border-strong, #cad4e2);
    border-radius: 3px;
    background: var(--color-surface, #fff);
    color: var(--color-text-muted, #66748a);
    font-family: inherit;
    font-size: 8px;
    font-weight: 800;
    text-align: center;
}

.gk-items-table {
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.gk-items-table .dt-wrapper {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.gk-items-table .dt-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.gk-items-table .dt-table thead th {
    padding: 8px 13px;
    background: var(--color-surface, #fff);
    font-size: 11px;
}

.gk-items-table .dt-table tbody td {
    padding: 9px 13px;
    font-size: 12px;
}

.gk-items-table .gk-cell-stack {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.gk-items-table .gk-cell-stack strong {
    overflow: hidden;
    color: var(--color-text, #24324a);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gk-items-table .gk-cell-stack small {
    color: var(--color-text-muted, #66748a);
    font-size: 9px;
}

.gk-items-table .dt-empty,
.gk-items-table .dt-empty-cell {
    min-height: 0;
    padding: 20px 12px !important;
}

.gk-items-table .dt-pagination {
    min-height: 27px;
    padding: 2px 8px;
}

.gk-items-table .dt-actions-col {
    width: 38px;
    padding-right: 5px;
    padding-left: 5px;
}

.gk-row-delete {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: color-mix(in srgb, var(--color-text-muted, #66748a) 50%, transparent);
    font-size: 11px;
    cursor: pointer;
}

.gk-row-delete:hover {
    background: var(--color-danger, #dc3545);
    color: #fff;
}

.gk-summary-panel {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) minmax(105px, .42fr) minmax(105px, .42fr) minmax(90px, .32fr);
    min-width: 0;
    border-top: 1px solid var(--color-border, #dce3ee);
    background: color-mix(in srgb, var(--color-primary-soft, #eef4ff) 45%, var(--color-surface, #fff));
}

.gk-summary-title {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--color-text-muted, #66748a);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.gk-summary-item {
    min-width: 0;
    padding: 9px 14px;
}

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

.gk-summary-item span {
    margin-bottom: 2px;
    color: var(--color-text-muted, #66748a);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.gk-summary-item strong {
    color: var(--color-text, #24324a);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.gk-summary-item.is-balanced {
    background: color-mix(in srgb, var(--color-success, #16875a) 8%, var(--color-surface, #fff));
}

.gk-summary-item.is-unbalanced {
    background: color-mix(in srgb, var(--color-danger, #dc3545) 8%, var(--color-surface, #fff));
}

.gk-summary-item.is-unbalanced strong {
    color: var(--color-danger, #dc3545);
}

.gk-footer-status {
    min-height: 34px;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--color-text-muted, #66748a);
    font-size: 10px;
    font-weight: 650;
}

.gk-footer-status.is-balanced {
    color: var(--color-success, #16875a);
}

.gk-footer-status.is-neutral i {
    color: var(--color-warning, #d89116);
}

.gk-drawer-search {
    min-height: 44px;
    margin-bottom: 10px;
    padding: 0 12px;
    border: 1px solid var(--color-border, #dce3ee);
    border-radius: 10px;
    background: var(--color-surface, #fff);
    display: flex;
    align-items: center;
    gap: 9px;
}

.gk-drawer-search > i {
    color: var(--color-text-muted, #66748a);
}

.gk-drawer-search input {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--color-text, #24324a);
    font-size: 13px;
}

.gk-drawer-search button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted, #66748a);
}

.gk-drawer-search button:hover {
    background: var(--color-surface-muted, #f3f6fb);
}

.gk-drawer-hint {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--color-text-muted, #66748a);
    font-size: 10px;
    font-weight: 650;
}

.gk-promene-empty {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-text-muted, #66748a);
    text-align: center;
}

.gk-promene-empty i {
    color: var(--color-border-strong, #bcc7d6);
    font-size: 42px;
}

.gk-promene-empty strong {
    color: var(--color-text, #24324a);
    font-size: 18px;
}

.gk-promene-table-wrap {
    max-height: min(62vh, 680px);
    overflow: auto;
    border: 1px solid var(--color-border, #dce3ee);
    border-radius: 12px;
    background: var(--color-surface, #fff);
}

.gk-promene-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--color-text, #24324a);
    font-size: 12px;
}

.gk-promene-table th,
.gk-promene-table td {
    padding: 10px 11px;
    border-bottom: 1px solid var(--color-border, #dce3ee);
    vertical-align: middle;
    white-space: nowrap;
}

.gk-promene-table th {
    position: sticky;
    z-index: 1;
    top: 0;
    background: var(--color-surface-muted, #f3f6fb);
    color: var(--color-text-muted, #66748a);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.gk-promene-table tbody tr {
    cursor: pointer;
    transition: background .15s ease;
}

.gk-promene-table tbody tr:hover,
.gk-promene-table tbody tr:focus {
    outline: 0;
    background: var(--color-primary-soft, #edf3ff);
}

.gk-promene-table tbody tr:last-child td {
    border-bottom: 0;
}

.gk-promene-table td.is-balanced {
    color: var(--color-success, #16875a);
    font-weight: 750;
}

.gk-promene-table td.is-unbalanced {
    color: var(--color-danger, #dc3545);
    font-weight: 750;
}

@media (max-width: 1120px) {
    .gk-ledger-workspace {
        height: auto;
        padding: 8px;
    }

    .gk-main-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .gk-document-panel {
        min-height: 350px;
    }

    .gk-items-panel {
        min-height: 540px;
    }
}

@media (max-width: 760px) {
    .gk-entry-grid,
    .gk-two-column-fields {
        grid-template-columns: 1fr;
    }

    .gk-shortcuts {
        flex-wrap: wrap;
    }

    .gk-summary-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gk-summary-title,
    .gk-summary-spacer {
        grid-column: 1 / -1;
    }

    .gk-summary-spacer {
        display: none;
    }

    .gk-drawer-hint {
        flex-direction: column;
    }
}
