:root {
    font-family: Inter, Segoe UI, Arial, sans-serif;
    color: #e5e7eb;
    background: #0f172a;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #0f172a;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.admin-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 32rem),
        #0f172a;
}

.admin-topbar {
    min-height: 72px;
    display: flex;
    align-items: flex-start;
    gap: 22px;
    padding: 16px 28px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 290px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    background: #1d4ed8;
    color: #ffffff;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
}

.brand-subtitle,
.identity-subtitle,
.muted {
    color: #94a3b8;
}

.brand-subtitle,
.identity-subtitle {
    margin-top: 2px;
    font-size: 12px;
}

.admin-nav {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    flex-wrap: wrap;
}

.admin-nav-group {
    position: relative;
}

.admin-nav-group-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.46);
    color: #cbd5e1;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.admin-nav-group-toggle::after {
    content: "▾";
    margin-left: 8px;
    color: #94a3b8;
    font-size: 11px;
}

.admin-nav-group.open .admin-nav-group-toggle,
.admin-nav-group.active .admin-nav-group-toggle,
.admin-nav-group-toggle:hover,
.admin-nav-group-toggle:focus-visible {
    background: rgba(148, 163, 184, 0.14);
    color: #ffffff;
}

.admin-nav-group.open .admin-nav-group-toggle::after {
    transform: rotate(180deg);
}

.admin-nav-items {
    position: absolute;
    z-index: 20;
    min-width: 230px;
    display: grid;
    gap: 4px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

.admin-nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #cbd5e1;
    font-size: 14px;
}

.admin-nav a.active,
.admin-nav a:hover {
    background: rgba(148, 163, 184, 0.14);
    color: #ffffff;
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

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

.workflow-card {
    display: block;
    min-height: 150px;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(30, 41, 59, 0.58);
    color: inherit;
    text-decoration: none;
}

.workflow-card:hover {
    border-color: rgba(96, 165, 250, 0.48);
    background: rgba(30, 64, 175, 0.28);
}

.workflow-card h2 {
    margin: 0 0 10px;
    font-size: 16px;
}

.workflow-card p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.5;
}

.workflow-card-action {
    display: inline-flex;
    margin-top: 16px;
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 700;
}

.identity-block {
    max-width: 280px;
    text-align: right;
}

.identity-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
}

.admin-main {
    padding: 32px;
}

.page-panel {
    max-width: 1100px;
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.72);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.wide-panel {
    max-width: 1360px;
}

.warning-panel {
    border-color: rgba(251, 191, 36, 0.36);
}

.page-panel h1 {
    margin: 0 0 12px;
    font-size: 32px;
}

.page-panel h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.page-panel h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.page-panel p {
    color: #cbd5e1;
    line-height: 1.6;
}

.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.82);
    color: #e5e7eb;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: rgba(51, 65, 85, 0.9);
}

.button.primary {
    border-color: rgba(96, 165, 250, 0.55);
    background: #1d4ed8;
    color: #ffffff;
}

.checkpoint-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 28px 0;
}

.checkpoint-card,
.role-card {
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(30, 41, 59, 0.7);
}

.checkpoint-card h2 {
    margin: 0 0 10px;
    font-size: 15px;
}

.checkpoint-card p,
.role-card p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    word-break: break-word;
}

.subsection {
    margin-top: 28px;
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
    gap: 12px 18px;
    margin: 20px 0 0;
}

.detail-list dt {
    color: #94a3b8;
}

.detail-list dd {
    margin: 0;
    color: #e5e7eb;
    word-break: break-word;
}

.monospace {
    font-family: Consolas, Monaco, Liberation Mono, monospace;
}

.inline-alert {
    padding: 14px 16px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 12px;
    background: rgba(120, 53, 15, 0.28);
    color: #fde68a;
}

.pill-list,
.permission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 14px 0 0;
    list-style: none;
}

.pill-list li,
.permission-list li {
    padding: 7px 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.74);
    color: #cbd5e1;
    font-size: 13px;
}

.permission-list.compact {
    display: block;
}

.permission-list.compact li {
    display: block;
    width: fit-content;
    margin-top: 8px;
}

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

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-align: left;
    vertical-align: top;
    color: #cbd5e1;
    font-size: 14px;
}

.data-table th {
    color: #e5e7eb;
    font-weight: 700;
}

.status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 12px;
}

.status-banner.ready {
    border: 1px solid rgba(34, 197, 94, 0.36);
    background: rgba(20, 83, 45, 0.28);
}

.status-banner.not-ready {
    border: 1px solid rgba(251, 191, 36, 0.36);
    background: rgba(120, 53, 15, 0.28);
}

.boot-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #0f172a;
}

.boot-card {
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.84);
}

.boot-title {
    font-size: 22px;
    font-weight: 700;
}

.boot-subtitle {
    margin-top: 8px;
    color: #94a3b8;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: #7f1d1d;
    color: #ffffff;
    z-index: 1000;
}

#blazor-error-ui .reload {
    margin-left: 12px;
    color: #ffffff;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
}

@media (max-width: 1000px) {
    .admin-topbar {
        height: auto;
        flex-wrap: wrap;
        padding: 18px;
    }

    .brand-block {
        min-width: 100%;
    }

    .admin-nav {
        min-width: 100%;
    }

    .admin-nav-group {
        width: 100%;
    }

    .admin-nav-group-toggle {
        width: 100%;
        box-sizing: border-box;
        justify-content: space-between;
    }

    .admin-nav-items {
        position: static;
        width: 100%;
        box-sizing: border-box;
    }

    .identity-block {
        text-align: left;
    }

    .checkpoint-grid,
    .role-grid,
    .workflow-grid,
    .workflow-grid.compact-workflow-grid {
        grid-template-columns: 1fr;
    }

    .page-heading-row,
    .status-banner {
        display: block;
    }

    .page-heading-row .button {
        margin-top: 12px;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1000px) {
    .form-grid.two-column {
        grid-template-columns: 1fr;
    }
}

.loading-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}

.spinner {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border: 3px solid rgba(148, 163, 184, 0.32);
    border-top-color: #e5e7eb;
    border-radius: 999px;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.role-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.text-area {
    min-height: 130px;
    resize: vertical;
}

.audit-table details summary {
    cursor: pointer;
    color: #e5e7eb;
}

.audit-details {
    max-width: 560px;
    max-height: 320px;
    overflow: auto;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.88);
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-word;
}

.product-tip-body {
    white-space: pre-wrap;
    word-break: break-word;
}


.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.directory-result-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.directory-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    gap: 14px;
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.42);
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
}

.directory-result:hover,
.directory-result.selected {
    border-color: rgba(96, 165, 250, 0.55);
    background: rgba(30, 64, 175, 0.3);
}

.directory-result strong,
.directory-result span span {
    display: block;
}

.directory-result span span {
    margin-top: 4px;
    color: #94a3b8;
    font-size: 13px;
}

.compact-detail-list {
    grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
}

@media (max-width: 1000px) {
    .search-row,
    .directory-result {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    padding: 18px;
    margin-top: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(30, 41, 59, 0.42);
}

.detail-card ul,
.detail-card ol {
    color: #cbd5e1;
    line-height: 1.6;
}

.training-card {
    margin-top: 20px;
}

.nested-card {
    padding: 16px;
    margin-top: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.42);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.78);
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.status-pill.active {
    border-color: rgba(34, 197, 94, 0.44);
    background: rgba(20, 83, 45, 0.32);
    color: #bbf7d0;
}

.status-pill.info {
    border-color: rgba(96, 165, 250, 0.44);
    background: rgba(30, 64, 175, 0.32);
    color: #bfdbfe;
}

.status-pill.disabled {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(51, 65, 85, 0.42);
    color: #cbd5e1;
}

.status-pill.error,
.status-pill.critical {
    border-color: rgba(248, 113, 113, 0.48);
    background: rgba(127, 29, 29, 0.34);
    color: #fecaca;
}

.inline-note {
    padding: 14px 16px;
    margin-top: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.42);
    color: #cbd5e1;
}

.filter-panel {
    padding: 16px;
    margin: 18px 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.42);
}

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

.form-grid.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-column {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: #94a3b8;
    font-size: 13px;
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.88);
    color: #e5e7eb;
}

.filter-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin-top: 16px;
    color: #cbd5e1;
}

.link-stack {
    display: grid;
    gap: 6px;
}

.link-stack a {
    color: #bfdbfe;
}

.button.small {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.button-row.no-margin,
.no-margin {
    margin-top: 0;
}

.compact-details,
.compact-id {
    font-size: 12px;
    word-break: break-word;
}

.compact-subsection {
    margin-top: 18px;
}

@media (max-width: 1000px) {
    .form-grid.three-column {
        grid-template-columns: 1fr;
    }
}

.product-tip-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
    gap: 28px;
    align-items: start;
}

.read-workbench {
    margin-top: 12px;
}

.product-tip-workbench > aside {
    position: sticky;
    top: 18px;
}

.product-tip-editor-sections {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.editor-section {
    min-width: 0;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.42);
}

.editor-section legend {
    padding: 0 8px;
    color: #e5e7eb;
    font-size: 16px;
    font-weight: 700;
}

.editor-field {
    display: block;
    margin-top: 14px;
}

.editor-section > .editor-field:first-of-type {
    margin-top: 0;
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.45;
}

.product-tip-body-input {
    min-height: 150px;
    resize: vertical;
}

.application-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    color: #e5e7eb;
}

.application-checks label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.field-errors,
.validation-summary ul {
    margin: 8px 0 0;
    padding-left: 20px;
    color: #fecaca;
    font-size: 13px;
}

.validation-summary {
    padding: 14px 16px;
    margin: 16px 0;
    border: 1px solid rgba(248, 113, 113, 0.48);
    border-radius: 12px;
    background: rgba(127, 29, 29, 0.28);
    color: #fee2e2;
}

.environment-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    margin: 12px 0 20px;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 12px;
    background: rgba(30, 64, 175, 0.16);
}

.environment-context > div span {
    display: block;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 13px;
}

.production-context {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(127, 29, 29, 0.2);
}

.production-warning {
    padding: 14px 16px;
    margin: 14px 0;
    border: 2px solid rgba(248, 113, 113, 0.58);
    border-radius: 12px;
    background: rgba(127, 29, 29, 0.34);
    color: #fee2e2;
}

.success-alert {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(20, 83, 45, 0.28);
    color: #bbf7d0;
}

.product-tip-preview {
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.72);
}

.preview-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.preview-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.preview-frame {
    position: relative;
    min-height: 300px;
    padding: 18px;
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
}

.univexx-preview {
    background: linear-gradient(145deg, rgba(30, 64, 175, 0.3), rgba(15, 23, 42, 0.94));
}

.photopalooza-preview {
    background: linear-gradient(145deg, rgba(126, 34, 206, 0.3), rgba(15, 23, 42, 0.94));
}

.preview-context {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #cbd5e1;
    font-size: 12px;
}

.preview-empty-workspace {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 28px 10px 20px;
    opacity: 0.34;
}

.preview-empty-workspace span {
    height: 48px;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    border-radius: 8px;
}

.preview-tip-card {
    position: relative;
    padding: 18px;
    border: 1px solid rgba(147, 197, 253, 0.38);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.preview-tip-card h4 {
    margin: 0 0 10px;
    color: #f8fafc;
}

.preview-tip-card .product-tip-body {
    color: #cbd5e1;
    line-height: 1.55;
}

.preview-action {
    margin-top: 14px;
    opacity: 0.82;
}

.preview-context-list {
    margin-top: 16px;
}

.product-tip-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.button.caution {
    border-color: rgba(251, 191, 36, 0.58);
    background: rgba(146, 64, 14, 0.48);
    color: #fef3c7;
}

.button.terminal {
    border-color: rgba(248, 113, 113, 0.58);
    background: rgba(127, 29, 29, 0.48);
    color: #fee2e2;
}

.button:focus-visible,
.form-input:focus-visible,
.application-checks input:focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.62);
    outline-offset: 2px;
}

.editor-submit-row {
    align-items: center;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.product-tip-dialog {
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 22px;
    border: 1px solid rgba(96, 165, 250, 0.42);
    border-radius: 16px;
    background: #0f172a;
    color: #e5e7eb;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
}

.product-tip-dialog::backdrop {
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(2px);
}

.production-dialog {
    border-width: 2px;
    border-color: rgba(248, 113, 113, 0.62);
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.dialog-heading h2 {
    margin: 0 0 8px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.operation-explanation {
    padding: 14px 16px;
    margin-top: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    color: #cbd5e1;
}

.conflict-panel {
    padding: 16px;
    margin: 18px 0;
    border: 1px solid rgba(251, 191, 36, 0.5);
    border-radius: 12px;
    background: rgba(120, 53, 15, 0.28);
    color: #fef3c7;
}

.unsaved-banner {
    position: fixed;
    z-index: 1100;
    right: 20px;
    bottom: 20px;
    display: grid;
    gap: 8px;
    width: min(520px, calc(100vw - 40px));
    padding: 16px;
    border: 1px solid rgba(251, 191, 36, 0.58);
    border-radius: 14px;
    background: #1e293b;
    color: #f8fafc;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
}

@media (max-width: 1100px) {
    .product-tip-workbench {
        grid-template-columns: 1fr;
    }

    .product-tip-workbench > aside {
        position: static;
    }
}

@media (max-width: 700px) {
    .environment-context,
    .preview-heading-row,
    .dialog-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid.two-column,
    .form-grid.three-column {
        grid-template-columns: 1fr;
    }

    .product-tip-actions {
        justify-content: flex-start;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }
}
