:root {
    --system-navy: #0d3768;
    --system-blue: #174b91;
    --system-yellow: #ffd100;
    --system-red: #df1820;
    --system-ink: #10284b;
    --system-muted: #62718b;
    --system-line: #d6e0ec;
    --system-soft: #f4f7fb;
}

.system-page {
    background: #fff;
    color: var(--system-ink);
    min-height: 60vh;
}

.system-container {
    width: min(1440px, calc(100% - 48px));
    margin-inline: auto;
}

.system-hero {
    background:
        radial-gradient(circle at 90% 18%, rgba(255, 209, 0, .18), transparent 22rem),
        linear-gradient(125deg, #092b55 0%, #164c86 100%);
    border-bottom: 5px solid var(--system-yellow);
    color: #fff;
    padding: 58px 0 54px;
}

.system-hero-inner {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 32px;
}

.system-kicker {
    color: var(--system-yellow);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .16em;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.system-hero h1 {
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    letter-spacing: -.045em;
    line-height: .98;
    margin: 0;
}

.system-hero p:last-child {
    color: rgba(255,255,255,.82);
    font-size: 1.05rem;
    line-height: 1.7;
    margin: 18px 0 0;
    max-width: 720px;
}

.system-manage-link {
    align-items: center;
    background: var(--system-yellow);
    border-radius: 8px;
    color: #071f40;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 800;
    min-height: 48px;
    padding: 0 22px;
    text-decoration: none;
}

.system-directory {
    padding: 54px 0 68px;
}

.system-directory-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.system-directory-heading h2 {
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    letter-spacing: -.035em;
    margin: 0;
}

.system-directory-heading p {
    color: var(--system-muted);
    margin: 6px 0 0;
}

.system-directory-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.system-total {
    background: #eaf1f9;
    border-radius: 999px;
    color: var(--system-navy);
    font-size: .82rem;
    font-weight: 800;
    padding: 8px 14px;
    white-space: nowrap;
}

.system-total strong {
    font-size: 1rem;
}

.system-tools {
    position: sticky;
    top: 10px;
    z-index: 12;
    display: grid;
    margin-bottom: 28px;
    padding: 14px;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--system-line);
    border-radius: 15px;
    box-shadow: 0 14px 34px rgba(16,40,75,.09);
    backdrop-filter: blur(12px);
    gap: 12px;
}

.system-search {
    position: relative;
    display: block;
}

.system-search input {
    box-sizing: border-box;
    width: 100%;
    min-height: 52px;
    padding: 12px 18px 12px 50px;
    color: var(--system-ink);
    background: #f7f9fc;
    border: 1px solid #cbd7e5;
    border-radius: 10px;
    font: inherit;
    font-size: .92rem;
}

.system-search input:focus {
    background: #fff;
    border-color: var(--system-blue);
    outline: 3px solid rgba(23,75,145,.13);
}

.system-search-icon {
    position: absolute;
    top: 50%;
    left: 17px;
    z-index: 1;
    width: 20px;
    height: 20px;
    color: var(--system-blue);
    transform: translateY(-50%);
}

.system-search-icon svg,
.system-category-icon svg,
.system-card-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

.system-filters {
    display: flex;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
    gap: 7px;
}

.system-filter {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 14px;
    color: #34506f;
    cursor: pointer;
    background: #eef3f8;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
}

.system-filter:hover,
.system-filter:focus-visible {
    color: var(--system-navy);
    border-color: #9fb3ca;
    outline: none;
}

.system-filter.active {
    color: #fff;
    background: var(--system-navy);
}

.system-category-grid {
    display: grid;
    gap: 30px;
}

.system-category {
    --category-accent: #174b91;
    --category-soft: #eaf2ff;
    padding: clamp(18px,2.4vw,28px);
    background: #f8fafc;
    border: 1px solid #dce5ef;
    border-radius: 18px;
}

.system-category-tone-2{--category-accent:#087a76;--category-soft:#e5f7f5}
.system-category-tone-3{--category-accent:#8c5a08;--category-soft:#fff4d9}
.system-category-tone-4{--category-accent:#7a3f91;--category-soft:#f5eafa}
.system-category-tone-5{--category-accent:#b4353c;--category-soft:#fdecee}
.system-category-tone-6{--category-accent:#416329;--category-soft:#eef6e8}

.system-category-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 58px;
    margin-bottom: 18px;
    padding: 0;
    color: var(--system-ink);
    background: transparent;
    border: 0;
}

.system-category-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.system-category-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 11px;
    color: var(--category-accent);
    background: var(--category-soft);
    border-radius: 12px;
    box-sizing: border-box;
}

.system-category-title p {
    margin: 0 0 2px;
    color: var(--system-muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.system-category-heading h3 {
    font-size: clamp(1.12rem,2vw,1.35rem);
    margin: 0;
}

.system-category-heading > span {
    padding: 6px 10px;
    color: var(--category-accent);
    background: var(--category-soft);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}

.system-card-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 14px;
}

.system-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 245px;
    padding: 20px;
    overflow: hidden;
    flex-direction: column;
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(16,40,75,.055);
    transition: transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}

.system-card[hidden],
.system-category[hidden] {
    display: none !important;
}

.system-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    content: "";
    background: var(--category-accent);
}

.system-card:hover {
    border-color: color-mix(in srgb,var(--category-accent) 35%,#d9e2ec);
    box-shadow: 0 16px 32px rgba(16,40,75,.1);
    transform: translateY(-3px);
}

.system-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.system-card-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 11px;
    color: var(--category-accent);
    background: var(--category-soft);
    border-radius: 12px;
    box-sizing: border-box;
}

.system-card-number {
    color: #94a3b8;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.system-card-copy {
    flex: 1;
    padding: 17px 0 18px;
}

.system-card-category {
    margin: 0 0 7px;
    color: var(--category-accent);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.system-card h4 {
    margin: 0;
    color: var(--system-ink);
    font-size: 1.03rem;
    line-height: 1.35;
}

.system-card-description {
    display: -webkit-box;
    margin: 9px 0 0;
    overflow: hidden;
    color: var(--system-muted);
    font-size: .78rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.system-unit {
    background: #e8f0fb;
    border-radius: 999px;
    color: var(--category-accent);
    font-size: .68rem;
    font-weight: 800;
    padding: 3px 8px;
    text-transform: uppercase;
}

.system-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid #e7edf4;
    gap: 10px;
}

.system-open-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 13px;
    color: #fff;
    background: var(--category-accent);
    border-radius: 9px;
    font-size: .74rem;
    font-weight: 800;
    text-decoration: none;
    gap: 7px;
    transition: transform .18s ease,filter .18s ease;
}

.system-open-button:hover,
.system-open-button:focus-visible {
    filter: brightness(.9);
    outline: 3px solid color-mix(in srgb,var(--category-accent) 20%,transparent);
    transform: translateY(-1px);
}

.system-empty {
    margin: 0;
    padding: 20px;
    color: var(--system-muted);
    background: #fff;
    border: 1px dashed #cbd7e5;
    border-radius: 12px;
    font-style: italic;
}

.system-no-results {
    padding: 44px 20px;
    color: var(--system-muted);
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #c7d4e2;
    border-radius: 16px;
}

.system-no-results > span {
    display: block;
    margin-bottom: 10px;
    color: var(--system-blue);
    font-size: 2.4rem;
}

.system-no-results h3 {
    margin: 0;
    color: var(--system-ink);
}

.system-no-results p {
    margin: 7px 0 0;
}

.system-admin {
    background: var(--system-soft);
    border-top: 1px solid var(--system-line);
    padding: 54px 0 72px;
}

.system-admin-panel {
    background: #fff;
    border: 1px solid var(--system-line);
    border-top: 5px solid var(--system-yellow);
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(16, 40, 75, .08);
    padding: clamp(22px, 4vw, 38px);
}

.system-admin-header {
    align-items: start;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.system-admin h2,
.system-admin h3 {
    margin-top: 0;
}

.system-admin h2 {
    font-size: 1.55rem;
    margin-bottom: 7px;
}

.system-admin h3 {
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.system-admin p {
    color: var(--system-muted);
}

.system-login-form {
    display: flex;
    gap: 10px;
    max-width: 580px;
}

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

.system-form-grid .wide {
    grid-column: 1 / -1;
}

.system-field label {
    display: block;
    font-size: .78rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.system-field input,
.system-field select,
.system-field textarea,
.system-login-form input,
.system-category-edit input {
    background: #fff;
    border: 1px solid #bfcddd;
    border-radius: 7px;
    box-sizing: border-box;
    font: inherit;
    min-height: 45px;
    padding: 10px 12px;
    width: 100%;
}

.system-field textarea {
    min-height: 86px;
    resize: vertical;
}

.system-button {
    background: var(--system-blue);
    border: 0;
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: .84rem;
    font-weight: 800;
    min-height: 44px;
    padding: 0 18px;
}

.system-button.secondary {
    background: #e8eef6;
    color: var(--system-navy);
}

.system-button.danger {
    background: var(--system-red);
}

.system-flash {
    border-left: 4px solid #198754;
    background: #e9f8ef;
    color: #12613b;
    margin: 0 0 22px;
    padding: 13px 15px;
}

.system-flash.error {
    background: #fff0f1;
    border-color: var(--system-red);
    color: #94151b;
}

.system-admin-layout {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(280px, .8fr) minmax(0, 1.5fr);
}

.system-admin-block {
    border: 1px solid var(--system-line);
    border-radius: 9px;
    padding: 20px;
}

.system-category-list,
.system-item-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.system-category-row,
.system-item-editor {
    background: var(--system-soft);
    border: 1px solid #dbe4ef;
    border-radius: 8px;
    padding: 12px;
}

.system-category-edit {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.system-item-editor summary {
    cursor: pointer;
    font-weight: 800;
    padding: 4px;
}

.system-item-editor form {
    margin-top: 16px;
}

.system-check {
    align-items: center;
    display: flex;
    font-size: .84rem;
    font-weight: 700;
    gap: 8px;
}

.system-check input {
    height: 18px;
    width: 18px;
}

.system-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 14px;
}

@media (max-width: 850px) {
    .system-container {
        width: min(100% - 28px, 1440px);
    }

    .system-hero-inner,
    .system-directory-heading {
        align-items: start;
        flex-direction: column;
    }

    .system-admin-layout {
        grid-template-columns: 1fr;
    }

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

    .system-directory-stats {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .system-hero {
        padding: 42px 0 38px;
    }

    .system-directory {
        padding-block: 38px 50px;
    }

    .system-category-heading {
        align-items: flex-start;
        min-height: 0;
    }

    .system-tools {
        position: static;
        margin-bottom: 22px;
        padding: 10px;
    }

    .system-filter {
        min-height: 42px;
    }

    .system-category {
        padding: 16px;
        border-radius: 14px;
    }

    .system-card-grid {
        grid-template-columns: 1fr;
    }

    .system-card {
        min-height: 225px;
        padding: 18px;
    }

    .system-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .system-open-button {
        width: 100%;
        min-height: 48px;
        box-sizing: border-box;
    }

    .system-login-form,
    .system-admin-header {
        align-items: stretch;
        flex-direction: column;
    }

    .system-form-grid {
        grid-template-columns: 1fr;
    }

    .system-form-grid .wide {
        grid-column: auto;
    }
}
