:root {
    color-scheme: light;
    --brand-teal: rgb(51, 88, 93);
    --brand-teal-light: rgb(112, 168, 174);
    --brand-navy: rgb(24, 43, 84);
    --brand-taupe: rgb(178, 158, 143);
    --ink: #182b54;
    --muted: #5f6f78;
    --line: #d7dfdf;
    --surface: #ffffff;
    --surface-soft: #f9fbfb;
    --wash: #eef4f4;
    --accent: var(--brand-teal);
    --accent-strong: #253f43;
    --accent-soft: #dceced;
    --warm: #e6ded8;
    --warm-strong: var(--brand-taupe);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        linear-gradient(180deg, rgba(24, 43, 84, 0.07), rgba(112, 168, 174, 0.11) 280px, var(--wash) 560px);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: inherit;
}

.site-header {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(51, 88, 93, 0.18);
    box-shadow: 0 10px 28px rgba(24, 43, 84, 0.06);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
}

.brand {
    align-items: center;
    color: var(--brand-navy);
    display: inline-flex;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.brand::before {
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-teal) 58%, var(--brand-teal-light));
    border-radius: 5px;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.35);
    content: "";
    display: inline-block;
    height: 24px;
    width: 24px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

nav a,
.nav-group summary {
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    list-style: none;
    padding: 8px 10px;
    text-decoration: none;
}

nav a:hover,
.nav-group summary:hover {
    background: var(--accent-soft);
    color: var(--brand-teal);
}

.nav-group {
    position: relative;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    content: " v";
    font-size: 11px;
}

.nav-group[open] summary {
    background: var(--accent-soft);
    color: var(--brand-teal);
}

.nav-group-menu {
    background: var(--surface);
    border: 1px solid rgba(51, 88, 93, 0.18);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(24, 43, 84, 0.12);
    display: grid;
    gap: 4px;
    min-width: 180px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 10;
}

.content {
    margin: 0 auto;
    max-width: 1160px;
    padding: 36px 24px;
    width: 100%;
}

.hero {
    align-items: start;
    display: grid;
    gap: 32px;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    padding-top: 44px;
}

.hero h1,
.page-heading h1,
.panel h1 {
    font-size: 42px;
    line-height: 1.1;
    margin: 0 0 12px;
}

.hero h1,
.page-heading h1,
.panel h1,
.card h2 {
    color: var(--brand-navy);
}

.hero p,
.panel p,
.card p {
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    color: var(--brand-teal);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 10px;
    text-transform: uppercase;
}

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

.portal-tile,
.card,
.panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(51, 88, 93, 0.16);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(24, 43, 84, 0.07);
}

.portal-tile {
    border-top: 4px solid var(--brand-teal);
    display: block;
    min-height: 150px;
    padding: 22px;
    text-decoration: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.portal-tile:nth-child(2) {
    border-top-color: var(--brand-teal-light);
}

.portal-tile:nth-child(3) {
    border-top-color: var(--brand-taupe);
}

.portal-tile:hover {
    box-shadow: 0 20px 38px rgba(24, 43, 84, 0.11);
    transform: translateY(-2px);
}

.portal-tile span,
.card h2 {
    display: block;
    font-size: 20px;
    margin: 0 0 8px;
}

.portal-tile small {
    color: var(--muted);
    display: block;
}

.page-heading {
    margin-bottom: 22px;
}

.card {
    border-top: 4px solid var(--brand-teal-light);
    min-height: 150px;
    padding: 22px;
}

.cards .card:nth-child(2) {
    border-top-color: var(--brand-teal);
}

.cards .card:nth-child(3) {
    border-top-color: var(--brand-taupe);
}

.panel {
    max-width: 100%;
    min-width: 0;
    padding: 28px;
}

.narrow {
    max-width: 560px;
}

.stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    color: var(--brand-navy);
    display: grid;
    font-weight: 700;
    gap: 6px;
}

input {
    background: var(--surface-soft);
    border: 1px solid rgba(51, 88, 93, 0.24);
    border-radius: 6px;
    font: inherit;
    padding: 11px 12px;
    width: 100%;
}

select,
textarea {
    background: var(--surface-soft);
    border: 1px solid rgba(51, 88, 93, 0.24);
    border-radius: 6px;
    font: inherit;
    padding: 11px 12px;
    width: 100%;
}

.output {
    background: var(--surface-soft);
    border: 1px solid rgba(51, 88, 93, 0.18);
    border-radius: 6px;
    color: var(--brand-navy);
    min-height: 46px;
    overflow-wrap: anywhere;
    padding: 12px;
    white-space: pre-wrap;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-teal-light);
    box-shadow: 0 0 0 3px rgba(112, 168, 174, 0.24);
    outline: 0;
}

button {
    background: var(--brand-teal);
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 12px 16px;
}

.button-link {
    background: var(--brand-teal);
    border-radius: 6px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 46px;
    padding: 12px 16px;
    text-decoration: none;
}

button:hover {
    background: var(--accent-strong);
}

button.secondary {
    background: transparent;
    border: 1px solid rgba(51, 88, 93, 0.28);
    color: var(--brand-teal);
}

button.secondary:hover {
    background: rgba(112, 168, 174, 0.12);
}

button.danger {
    background: #8f2f2f;
}

button.danger:hover {
    background: #6f2424;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-link:hover {
    background: var(--accent-strong);
}

.portal-toolkit .site-header {
    border-bottom-color: rgba(51, 88, 93, 0.24);
}

.portal-portal .site-header {
    border-bottom-color: rgba(112, 168, 174, 0.32);
}

.portal-ops .site-header {
    border-bottom-color: rgba(24, 43, 84, 0.24);
}

.ops-grid {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(240px, 0.3fr) minmax(0, 0.7fr);
}

.ops-grid .wide {
    min-width: 0;
    overflow: hidden;
}

.panel h2 {
    color: var(--brand-navy);
    font-size: 22px;
    margin: 0 0 16px;
}

.table-wrap {
    max-width: 100%;
    overflow-x: visible;
    width: 100%;
}

table {
    border-collapse: collapse;
    table-layout: fixed;
    max-width: 100%;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
}

th {
    color: var(--brand-navy);
    font-size: 13px;
    text-transform: uppercase;
}

.badge {
    background: var(--accent-soft);
    border: 1px solid rgba(51, 88, 93, 0.18);
    border-radius: 999px;
    color: var(--brand-teal);
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 9px;
}

.text-link {
    color: var(--brand-teal);
    font-weight: 700;
}

.command-link,
button.link-button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--brand-teal);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    min-height: auto;
    padding: 0;
    text-decoration: underline;
}

.command-link:hover,
button.link-button:hover {
    background: transparent;
    color: var(--accent-strong);
}

button.danger-link {
    color: #8a2f22;
}

button.danger-link:hover {
    color: #6f241b;
}

.admin-command-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 12px;
}

.filter-strip {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 16px;
}

.filter-strip label {
    min-width: min(100%, 320px);
}

.admin-table th {
    background: var(--surface-soft);
}

.admin-table td:last-child,
.admin-table th:last-child {
    width: 110px;
}

.table-select {
    width: 100%;
}

.command-cell {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.command-cell form {
    margin: 0;
}

.detail-stack {
    display: grid;
    gap: 16px;
}

.summary-strip {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    padding: 14px 16px;
}

.summary-strip div {
    display: grid;
    gap: 4px;
}

.summary-strip strong {
    color: var(--brand-navy);
    overflow-wrap: anywhere;
}

.inline-admin-form,
.access-edit-row {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-admin-form label {
    min-width: min(100%, 220px);
}

.access-edit-row {
    justify-content: space-between;
}

.record-list {
    display: grid;
    gap: 10px;
}

.admin-page,
.blade-main {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.command-bar {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 14px 16px;
}

.command-bar h2,
.section-command h2 {
    margin: 0;
}

.command-actions,
.form-actions,
.row-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.filter-bar {
    align-items: end;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
}

.filter-bar label {
    min-width: min(100%, 320px);
}

.admin-list {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    overflow: hidden;
}

.admin-list-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr) minmax(120px, 0.7fr) auto auto;
    min-width: 0;
    padding: 14px 16px;
}

.admin-list-row:last-child {
    border-bottom: 0;
}

.admin-list-row:hover {
    background: rgba(112, 168, 174, 0.08);
}

.empty-row {
    grid-template-columns: minmax(0, 1fr);
}

.identity-cell,
.identity-card {
    align-items: center;
    display: flex;
    gap: 12px;
    min-width: 0;
}

.identity-cell strong,
.identity-card strong {
    color: var(--brand-navy);
    display: block;
    overflow-wrap: anywhere;
}

.identity-cell span:not(.identity-avatar),
.identity-card span:not(.identity-avatar) {
    color: var(--muted);
    display: block;
    overflow-wrap: anywhere;
}

.identity-avatar {
    align-items: center;
    background: var(--brand-navy);
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.identity-avatar.large {
    height: 48px;
    width: 48px;
}

.admin-list-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.admin-list-meta span:last-child {
    color: var(--brand-navy);
    overflow-wrap: anywhere;
}

.meta-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-list-state {
    justify-self: start;
}

.detail-heading {
    align-items: end;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.blade-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
}

.blade-rail {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 18px;
    padding: 16px;
}

.detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.detail-list div {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-list dd {
    color: var(--brand-navy);
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.rail-actions {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    padding-top: 14px;
}

.rail-actions button {
    width: 100%;
}

.section-command {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin: -4px 0 16px;
    padding-bottom: 12px;
}

.access-list {
    display: grid;
    gap: 12px;
}

.access-row {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    padding: 14px;
}

.access-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-width: 0;
}

.access-heading strong {
    color: var(--brand-navy);
    margin-right: 8px;
    overflow-wrap: anywhere;
}

.add-access-form {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
}

.filters {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.filters label {
    min-width: min(100%, 280px);
}

.record-row {
    align-items: start;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: 100%;
    min-width: 0;
    padding: 12px;
}

.record-link-row {
    color: inherit;
    text-decoration: none;
}

.record-link-row:hover {
    border-color: rgba(51, 88, 93, 0.36);
    box-shadow: 0 8px 18px rgba(24, 43, 84, 0.08);
}

.record-main {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.record-main strong {
    color: var(--brand-navy);
    overflow-wrap: anywhere;
}

.record-meta {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    grid-column: 1 / -1;
    min-width: 0;
}

.record-meta span {
    overflow-wrap: anywhere;
}

.article-body {
    color: var(--text);
    grid-column: 1 / -1;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: normal;
}

.record-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.record-actions form {
    margin: 0;
}

.record-state {
    align-self: center;
    justify-self: end;
}

.record-state .badge {
    white-space: nowrap;
}

.portal-access-form {
    display: grid;
    gap: 10px;
    grid-column: 1 / -1;
}

.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

@media (max-width: 980px) {
    .admin-list-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-list-state,
    .command-actions,
    .form-actions,
    .row-actions {
        justify-self: start;
        justify-content: flex-start;
    }

    .blade-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 680px) {
    .command-bar,
    .detail-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-bar label,
    .command-actions .button-link {
        width: 100%;
    }
}

.inline-name-form,
.report-title-form {
    align-items: center;
    display: flex;
    gap: 10px;
    margin: 0;
    width: min(100%, 620px);
}

.inline-name-form input,
.report-title-form input {
    color: var(--brand-navy);
    flex: 1 1 260px;
    font-weight: 700;
    min-width: 0;
}

.inline-name-form button,
.report-title-form button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.panel-title-row {
    align-items: baseline;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-title-row h2 {
    margin-bottom: 0;
}

.flash {
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.flash.success {
    background: var(--accent-soft);
    color: var(--brand-teal);
}

.flash.error {
    background: #f7e8e5;
    color: #8a2f22;
}

code {
    white-space: pre-wrap;
}

.muted {
    color: var(--muted);
}

.check-row {
    align-items: center;
    display: flex;
    flex-direction: row;
}

.check-row input {
    width: auto;
}

.link-button {
    background: transparent;
    color: var(--brand-teal);
    padding: 0;
}

.link-button:hover {
    background: transparent;
    color: var(--accent-strong);
}

.portal-ops {
    background: #f5f8f8;
}

.portal-ops .content {
    max-width: 1320px;
}

.portal-ops .page-heading {
    align-items: end;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.portal-ops .page-heading h1 {
    font-size: 34px;
    margin-bottom: 0;
}

.portal-ops .panel {
    background: #ffffff;
    border-color: var(--line);
    box-shadow: none;
    padding: 24px;
}

.portal-ops .panel h2 {
    font-size: 20px;
}

.portal-ops .panel-title-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    padding-bottom: 12px;
}

.portal-ops .table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.portal-ops table th {
    background: var(--surface-soft);
}

.portal-ops table td,
.portal-ops table th {
    padding: 13px 14px;
}

.portal-ops .record-list {
    border: 1px solid var(--line);
    border-radius: 8px;
    gap: 0;
    overflow: hidden;
}

.portal-ops .record-row {
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 14px 16px;
}

.portal-ops .record-row:last-child {
    border-bottom: 0;
}

.portal-ops .record-row:hover {
    background: rgba(112, 168, 174, 0.08);
}

.entity-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    overflow: hidden;
}

.entity-table__head,
.entity-table__row {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(70px, 0.7fr) minmax(110px, 1fr) minmax(150px, 1.4fr) minmax(70px, 0.6fr) minmax(130px, 1fr) minmax(150px, 1.2fr) minmax(80px, 0.7fr);
    min-width: 0;
    padding: 13px 16px;
}

.entity-table__head {
    background: var(--surface-soft);
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.entity-table__row {
    background: #ffffff;
    border-top: 1px solid var(--line);
}

.entity-table__row > span,
.entity-table__head > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.entity-table__row:hover {
    background: rgba(112, 168, 174, 0.08);
}

@media (max-width: 980px) {
    .entity-table__head {
        display: none;
    }

    .entity-table__row {
        align-items: start;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
}

.portal-ops .record-main strong {
    font-size: 16px;
}

.portal-ops .record-actions {
    justify-content: flex-start;
}

.portal-ops .actions {
    align-items: center;
}

.portal-ops .stack {
    gap: 14px;
}

.portal-ops input,
.portal-ops select,
.portal-ops textarea {
    background: #ffffff;
}

.success-panel {
    margin-bottom: 18px;
}

.settings-meta {
    margin-top: 18px;
}

.full-width-stack {
    display: grid;
    gap: 18px;
}

.qr-code {
    border: 1px solid var(--line);
    border-radius: 6px;
    height: 180px;
    width: 180px;
}

@media (max-width: 820px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 18px;
    }

    nav {
        justify-content: flex-start;
    }

    .nav-group-menu {
        position: static;
    }

    .hero,
    .portal-grid,
    .cards,
    .ops-grid {
        grid-template-columns: 1fr;
    }

    .hero h1,
    .page-heading h1,
    .panel h1 {
        font-size: 34px;
    }
}
