/**
 * Softcom Portal — launcher (Nexus tokens)
 */
body.nexus-shell {
    --bg: #0a0a0c;
    --bg-card: #121216;
    --bg-elevated: #1a1a20;
    --border: #24242c;
    --accent: #9d4edd;
    --orange: #ff9100;
    --text: #f8f9fa;
    --muted: #6c757d;
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 50% at 0% 0%, rgba(157, 78, 221, 0.08), transparent 50%),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(255, 145, 0, 0.05), transparent 50%);
}
body.nexus-shell::before {
    content: '';
    position: fixed;
    width: 150%;
    height: 150%;
    background-image:
        linear-gradient(rgba(157, 78, 221, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(157, 78, 221, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg);
    top: -20%;
    left: -25%;
    z-index: 0;
    pointer-events: none;
}
.portal-shell {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px clamp(16px, 4vw, 36px) 64px;
}
.portal-top {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: -28px calc(-1 * clamp(16px, 4vw, 36px)) 28px;
    padding: 14px clamp(16px, 4vw, 36px);
    background: rgba(10, 10, 12, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(36, 36, 44, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}
.portal-top-inner {
    display: flex;
    align-items: center;
    gap: 16px 20px;
    max-width: 1100px;
    margin: 0 auto;
}
.portal-brand-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.portal-nav {
    display: flex;
    flex: 1;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(18, 18, 22, 0.72);
    border: 1px solid rgba(36, 36, 44, 0.9);
}
.portal-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.portal-nav-link {
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 14px;
    white-space: nowrap;
}
.portal-nav-link:hover {
    color: var(--text);
    background: rgba(157, 78, 221, 0.12);
}
.portal-nav-link.is-active {
    color: #f3e8ff;
    border-color: rgba(157, 78, 221, 0.35);
    background: rgba(157, 78, 221, 0.22);
    box-shadow: inset 0 0 0 1px rgba(199, 125, 255, 0.08);
}
.portal-top-context {
    flex: 1;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.portal-empty {
    margin-top: 28px;
    color: var(--muted);
}
.portal-flash {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.28);
    color: #86efac;
    font-size: 0.88rem;
    max-width: 42rem;
}
.portal-flash--error {
    background: rgba(255, 145, 0, 0.1);
    border-color: rgba(255, 145, 0, 0.28);
    color: #ffd8a8;
}
.access-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 8px 0 16px;
}
.access-filter {
    flex: 1;
    min-width: 200px;
    padding: 0.7rem 1rem;
    background: rgba(10, 10, 12, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
}
.access-filter:focus {
    outline: none;
    border-color: var(--accent);
}
.access-marked {
    flex: 0 1 280px;
    min-width: 200px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236c757d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2rem;
}
.access-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.access-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    margin: 0;
}
.access-colhead {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
}
.access-table thead .access-colhead {
    text-transform: none;
    letter-spacing: 0;
}
.access-colhead-hint {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.access-colhead input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    margin: 0;
    cursor: pointer;
}
.access-empty {
    margin: 12px 0 0;
    color: #ffd8a8;
    font-size: 0.88rem;
}
.access-save {
    padding: 0.7rem 1.25rem;
    background: linear-gradient(135deg, var(--accent), #7b2cbf);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.access-save:hover {
    filter: brightness(1.08);
}
.access-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(18, 18, 22, 0.88);
    max-height: min(70vh, 720px);
}
.access-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.access-table th,
.access-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.access-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #1a1a20;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}
.access-table tbody th {
    font-weight: 600;
}
.access-table tbody tr:hover th,
.access-table tbody tr:hover td {
    background: rgba(157, 78, 221, 0.06);
}
.access-table td {
    text-align: center;
}
.access-name {
    display: block;
}
.access-setor {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}
.access-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.access-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}
.portal-logo {
    display: block;
    width: auto;
    height: 58px;
    max-width: min(260px, 54vw);
}
.portal-kicker {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}
.portal-brand h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}
.portal-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: rgba(18, 18, 22, 0.88);
    border: 1px solid var(--border);
}
.portal-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #f3e8ff;
    background: linear-gradient(145deg, rgba(157, 78, 221, 0.55), rgba(123, 44, 191, 0.85));
    border: 1px solid rgba(199, 125, 255, 0.35);
}
.portal-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
    font-size: 0.84rem;
    line-height: 1.25;
}
.portal-user-meta strong {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.portal-user-meta span {
    color: var(--muted);
    font-size: 0.74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.portal-user-extra {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.portal-badge {
    display: inline-block;
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffd8a8;
    background: rgba(255, 145, 0, 0.12);
    border: 1px solid rgba(255, 145, 0, 0.35);
}
.portal-logout {
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    white-space: nowrap;
}
.portal-logout:hover {
    color: var(--text);
    border-color: rgba(157, 78, 221, 0.45);
    background: rgba(157, 78, 221, 0.1);
}
.portal-intro {
    margin: 8px 0 8px;
    max-width: 640px;
}
.portal-intro p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.5;
}
.portal-health {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem !important;
}
.status-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    background-color: #00ff66;
    border-radius: 50%;
    box-shadow: 0 0 8px #00ff66;
}
.status-dot--down,
body.login-nexus .status-dot--down {
    background-color: var(--orange);
    box-shadow: 0 0 8px var(--orange);
}
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.portal-category {
    margin-top: 24px;
}
.portal-category:first-of-type {
    margin-top: 16px;
}
.portal-category-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.portal-category-head h2 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.portal-category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(157, 78, 221, 0.12);
    border: 1px solid rgba(157, 78, 221, 0.22);
}
.portal-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 16px 18px 14px;
    min-height: 140px;
    background: rgba(18, 18, 22, 0.88);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.portal-card:hover {
    transform: translateY(-2px);
    border-color: rgba(157, 78, 221, 0.55);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.36),
        0 0 20px rgba(157, 78, 221, 0.1);
}
.portal-card h2,
.portal-card h3 {
    margin: 0 0 6px;
    font-size: 1.02rem;
    line-height: 1.25;
}
.portal-card p {
    margin: 0;
    flex: 1;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.4;
}
.portal-card-desc {
    flex: 1;
    margin-bottom: 0;
    color: var(--muted);
}
.portal-card-url {
    display: inline-block;
    max-width: 100%;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.22);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.portal-card-go {
    margin-top: auto;
    padding-top: 10px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}
.portal-category--api .portal-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.portal-category--api .portal-card {
    min-height: 0;
    padding: 12px 14px;
    border-radius: 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.portal-category--api .portal-card:hover {
    transform: translateY(-1px);
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.28),
        0 0 14px rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.45);
}
.portal-category--api .portal-card h3 {
    margin: 0 0 4px;
    font-size: 0.88rem;
}
.portal-category--api .portal-card-desc {
    font-size: 0.74rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.portal-category--api .portal-card-url {
    margin-top: 6px;
    font-size: 0.68rem;
    padding: 2px 7px;
}
.portal-category--api .portal-card-go {
    margin-top: auto;
    padding-top: 8px;
    margin-left: 0;
    font-size: 0.68rem;
}
.portal-card-status {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(157, 78, 221, 0.12);
    color: #c77dff;
    border: 1px solid rgba(157, 78, 221, 0.25);
}
.portal-card-status--identity_source {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.28);
}
.portal-note {
    margin-top: 40px;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(18, 18, 22, 0.65);
}
.portal-note h2 {
    margin: 0 0 12px;
    font-size: 1rem;
}
.portal-note ol {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--muted);
    line-height: 1.55;
}
.portal-note li + li {
    margin-top: 6px;
}
.portal-note-admin {
    margin: 16px 0 0;
    font-size: 0.88rem;
    color: #ffd8a8;
}
.portal-note code {
    font-size: 0.85em;
    color: #c77dff;
}
.catalog-pagehead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin: 28px 0 20px;
}
.catalog-pagehead h2 {
    margin: 0 0 6px;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.catalog-pagehead p {
    margin: 0;
    max-width: 36rem;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.92rem;
}
.catalog-flash {
    max-width: none;
}
.catalog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    line-height: 1;
}
.catalog-btn--primary {
    background: linear-gradient(135deg, var(--accent), #7b2cbf);
    color: #fff;
    border-color: transparent;
}
.catalog-btn--primary:hover {
    filter: brightness(1.08);
}
.catalog-btn--primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: none;
}
.catalog-btn--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.catalog-btn--ghost:hover {
    border-color: rgba(157, 78, 221, 0.55);
    background: rgba(157, 78, 221, 0.1);
}
.catalog-btn--danger {
    background: transparent;
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.28);
}
.catalog-btn--danger:hover {
    background: rgba(127, 29, 29, 0.35);
    border-color: rgba(248, 113, 113, 0.45);
}
.catalog-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 28px;
}
.catalog-form {
    margin: 0;
    padding: 22px 24px 20px;
    border: 1px solid rgba(157, 78, 221, 0.28);
    border-radius: 14px;
    background: rgba(18, 18, 22, 0.92);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.catalog-form-head h3 {
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 600;
}
.catalog-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.catalog-field--full {
    grid-column: 1 / -1;
}
.catalog-field label {
    display: block;
    margin: 0 0 6px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.catalog-field input,
.catalog-field select,
.catalog-advanced input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.72rem 0.9rem;
    background: rgba(10, 10, 12, 0.65);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
}
.catalog-field select {
    cursor: pointer;
}
.catalog-field input:focus,
.catalog-field select:focus,
.catalog-advanced input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(157, 78, 221, 0.18);
}
.catalog-advanced {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.catalog-advanced summary {
    cursor: pointer;
    font-weight: 600;
    color: #cbd5e1;
}
.catalog-advanced p {
    margin: 8px 0 10px;
    line-height: 1.45;
}
.catalog-id-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.catalog-id-note code {
    color: #c77dff;
    font-size: 0.82rem;
}
.catalog-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.catalog-preview {
    padding: 4px 2px 0;
}
.catalog-preview-kicker {
    margin: 0 0 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.catalog-preview-card {
    pointer-events: none;
    min-height: 180px;
}
.catalog-preview-url {
    margin: 10px 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    word-break: break-all;
}
.catalog-list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
}
.catalog-list-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.catalog-list-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.catalog-item {
    display: flex;
    flex-direction: column;
    min-height: 188px;
    padding: 18px 18px 14px;
    background: rgba(18, 18, 22, 0.88);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
.catalog-item.is-editing {
    border-color: rgba(157, 78, 221, 0.7);
    box-shadow: 0 0 0 1px rgba(157, 78, 221, 0.35), 0 12px 28px rgba(0, 0, 0, 0.3);
}
.catalog-item-body {
    flex: 1;
}
.catalog-item-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.catalog-item-title h4 {
    margin: 0;
    flex: 1 1 100%;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}
.catalog-chip {
    flex-shrink: 0;
    margin-top: 2px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #c4b5fd;
    background: rgba(157, 78, 221, 0.12);
    border: 1px solid rgba(157, 78, 221, 0.28);
}
.catalog-chip--category {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
}
.catalog-item-desc {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}
.catalog-item-url {
    margin: 0;
    font-size: 0.78rem;
    color: #94a3b8;
    word-break: break-all;
}
.catalog-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.catalog-delete {
    display: inline;
    margin: 0;
}
@media (max-width: 860px) {
    .catalog-editor,
    .catalog-fields {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 900px) {
    .portal-nav {
        order: 3;
        flex: 1 1 100%;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .portal-nav::-webkit-scrollbar {
        display: none;
    }
    .portal-top-inner {
        flex-wrap: wrap;
    }
    .portal-user-meta strong,
    .portal-user-meta span {
        max-width: 140px;
    }
}
@media (max-width: 560px) {
    .portal-user-card .portal-badge {
        display: none;
    }
    .portal-user-meta span {
        display: none;
    }
    .portal-logo {
        height: 48px;
        max-width: min(220px, 62vw);
    }
}
@media (max-width: 720px) {
    .portal-user-meta {
        align-items: flex-start;
    }
}
