:root {
    --logic-blue: #326f93;
    --logic-blue-dark: #244e68;
    --logic-blue-soft: #e3eff5;
    --logic-bg: #eef3f6;
    --logic-panel: #ffffff;
    --logic-text: #1d3040;
    --logic-muted: #6b7e8b;
    --logic-border: #d9e3e9;
    --logic-green: #39745c;
    --logic-green-soft: #e8f2ed;
    --logic-red: #ad5960;
    --logic-red-soft: #f8eaec;
    --logic-shadow: 0 6px 22px rgba(29, 59, 78, .065);
}

* {
    box-sizing: border-box;
}

body.logic-page {
    background: var(--logic-bg);
    color: var(--logic-text);
    overflow-x: hidden;
}

.logic-page .lcm-topbar {
    background: rgba(36, 78, 104, .98);
    border-bottom-color: rgba(255, 255, 255, .18);
    box-shadow: 0 2px 14px rgba(42, 67, 101, .08);
}

.logic-page .lcm-nav a {
    color: rgba(255, 255, 255, .82);
    border-color: transparent;
}

.logic-page .lcm-nav a[aria-current="page"],
.logic-page .lcm-nav a:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .14);
}

.logic-page .lcm-footer {
    background: #fff;
    color: var(--logic-muted);
    border-top-color: var(--logic-border);
    box-shadow: 0 -6px 20px rgba(42, 67, 101, .06);
}

.logic-shell {
    width: min(1440px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 92px;
}

.logic-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
}

.logic-heading h1 {
    margin: 8px 0 6px;
    color: var(--logic-text);
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.05;
}

.logic-heading p {
    margin: 0;
    color: var(--logic-muted);
}

.logic-eyebrow,
.logic-section-label {
    color: var(--logic-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.logic-back {
    flex: 0 0 auto;
    padding: 10px 14px;
    border: 1px solid var(--logic-border);
    border-radius: 10px;
    background: #fff;
    color: var(--logic-blue-dark);
    font-weight: 800;
    text-decoration: none;
}

.logic-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.logic-kpi,
.logic-panel,
.logic-status {
    border: 1px solid var(--logic-border);
    border-radius: 10px;
    background: var(--logic-panel);
    box-shadow: var(--logic-shadow);
}

.logic-kpi {
    position: relative;
    min-height: 140px;
    padding: 20px;
    overflow: hidden;
}

.logic-kpi::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--logic-blue);
    content: '';
}

.logic-kpi--ok::before {
    background: var(--logic-green);
}

.logic-kpi--error::before {
    background: var(--logic-red);
}

.logic-kpi span,
.logic-kpi small {
    display: block;
}

.logic-kpi span {
    color: var(--logic-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.logic-kpi strong {
    display: block;
    margin: 12px 0 8px;
    color: var(--logic-text);
    font-family: var(--lcm-font-title);
    font-size: 38px;
}

.logic-kpi small {
    color: var(--logic-muted);
}

.logic-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    padding: 16px 20px;
}

.logic-status__title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logic-status__title span:not(.logic-status__dot),
.logic-status dt {
    color: var(--logic-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.logic-status__title strong {
    display: block;
    margin-top: 3px;
}

.logic-status__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 5px #eef2f7;
}

.logic-status__dot.is-ok {
    background: var(--logic-green);
    box-shadow: 0 0 0 5px var(--logic-green-soft);
}

.logic-status__dot.is-error {
    background: var(--logic-red);
    box-shadow: 0 0 0 5px var(--logic-red-soft);
}

.logic-status dl {
    display: flex;
    gap: 32px;
    margin: 0;
}

.logic-status dd {
    margin: 4px 0 0;
    font-weight: 800;
}

.logic-panel {
    margin-top: 14px;
    overflow: hidden;
}

.logic-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--logic-border);
}

.logic-panel__head h2 {
    margin: 4px 0 0;
    color: var(--logic-text);
    font-size: 21px;
}

.logic-filter-grid {
    display: grid;
    grid-template-columns: minmax(170px, .8fr) repeat(2, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 18px 20px 12px;
}

.logic-filter-grid label {
    display: grid;
    gap: 7px;
}

.logic-filter-grid label > span {
    color: var(--logic-muted);
    font-size: 12px;
    font-weight: 800;
}

.logic-filter-grid input,
.logic-filter-grid select {
    width: 100%;
    height: 42px;
    border: 1px solid var(--logic-border);
    border-radius: 10px;
    outline: 0;
    background: #fff;
    color: var(--logic-text);
    padding: 0 12px;
    font: 600 14px var(--lcm-font-base);
}

.logic-filter-grid input:focus,
.logic-filter-grid select:focus {
    border-color: var(--logic-blue);
    box-shadow: 0 0 0 3px rgba(23, 105, 224, .12);
}

.logic-filter-help {
    margin: 0;
    padding: 0 20px 16px;
    color: var(--logic-muted);
    font-size: 12px;
}

.logic-button {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 15px;
    font: 800 13px var(--lcm-font-base);
    cursor: pointer;
}

.logic-button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.logic-button--primary {
    height: 42px;
    background: var(--logic-blue);
    color: #fff;
}

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

.logic-button--ghost {
    border-color: var(--logic-border);
    background: #fff;
    color: var(--logic-blue-dark);
}

.logic-result-count {
    color: var(--logic-muted);
    font-size: 13px;
    font-weight: 700;
}

.logic-table-wrap {
    overflow: auto;
    max-height: 620px;
}

.logic-results table {
    width: 100%;
    border-collapse: collapse;
}

.logic-results th,
.logic-results td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--logic-border);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.logic-results th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: var(--logic-muted);
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.logic-results td {
    color: var(--logic-text);
    font-size: 13px;
}

.logic-results tbody tr:hover {
    background: #f8fbff;
}

.logic-message {
    display: block;
    max-width: 330px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logic-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 900;
}

.logic-badge--type {
    background: var(--logic-blue-soft);
    color: var(--logic-blue-dark);
}

.logic-badge--ok {
    background: var(--logic-green-soft);
    color: var(--logic-green);
}

.logic-badge--error {
    background: var(--logic-red-soft);
    color: var(--logic-red);
}

.logic-badge--neutral {
    background: #eef2f7;
    color: var(--logic-muted);
}

.logic-empty {
    padding: 34px !important;
    color: var(--logic-muted) !important;
    text-align: center !important;
}

.logic-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 14px 20px;
}

.logic-pagination span {
    min-width: 120px;
    color: var(--logic-muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.logic-notice {
    margin: 16px 20px 0;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: var(--logic-red-soft);
    color: var(--logic-red);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
}

.logic-notice--hidden {
    display: none;
}

@media (max-width: 980px) {
    .logic-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logic-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logic-status {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .logic-page .lcm-topbar {
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }

    .logic-page .lcm-nav {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    .logic-shell {
        width: min(calc(100% - 20px), 1440px);
        padding-top: 18px;
    }

    .logic-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .logic-heading h1,
    .logic-heading p {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .logic-kpis,
    .logic-filter-grid {
        grid-template-columns: 1fr;
    }

    .logic-kpi {
        min-height: 118px;
        padding: 17px;
    }

    .logic-status dl {
        display: grid;
        gap: 12px;
    }

    .logic-panel__head,
    .logic-results__head {
        align-items: flex-start;
        flex-direction: column;
    }

    .logic-filter-grid {
        padding-inline: 14px;
    }

    .logic-filter-help {
        padding-inline: 14px;
    }

    .logic-pagination {
        justify-content: space-between;
        gap: 8px;
        padding-inline: 12px;
    }
}
