:root {
    --portal-bg: #f4f7fb;
    --portal-surface: rgba(255, 255, 255, 0.9);
    --portal-surface-strong: #ffffff;
    --portal-border: rgba(15, 23, 42, 0.08);
    --portal-shadow: 0 22px 50px rgba(15, 23, 42, 0.09);
    --portal-accent: #185adb;
    --portal-accent-soft: rgba(24, 90, 219, 0.14);
    --portal-warm: #e29f42;
    --portal-text-muted: #607086;
    --portal-code-bg: rgba(15, 23, 42, 0.06);
    --portal-font: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", sans-serif;
}

[data-bs-theme="dark"] {
    --portal-bg: #0b1220;
    --portal-surface: rgba(17, 24, 39, 0.88);
    --portal-surface-strong: #101827;
    --portal-border: rgba(148, 163, 184, 0.14);
    --portal-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --portal-accent: #7bb2ff;
    --portal-accent-soft: rgba(123, 178, 255, 0.18);
    --portal-warm: #f4b860;
    --portal-text-muted: #96a7bc;
    --portal-code-bg: rgba(148, 163, 184, 0.12);
}

html,
body {
    min-height: 100%;
}

body {
    font-family: var(--portal-font);
    background:
        radial-gradient(circle at top left, rgba(24, 90, 219, 0.08), transparent 32%),
        radial-gradient(circle at bottom right, rgba(226, 159, 66, 0.09), transparent 28%),
        var(--portal-bg);
    color: var(--bs-body-color);
}

.portal-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.portal-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(16px);
    opacity: 0.7;
}

.portal-orb-a {
    width: 20rem;
    height: 20rem;
    background: rgba(24, 90, 219, 0.12);
    top: -4rem;
    right: -5rem;
}

.portal-orb-b {
    width: 18rem;
    height: 18rem;
    background: rgba(226, 159, 66, 0.12);
    left: -4rem;
    bottom: 2rem;
}

.portal-navbar {
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.72);
    border-bottom: 1px solid var(--portal-border);
}

[data-bs-theme="dark"] .portal-navbar {
    background: rgba(11, 18, 32, 0.8);
}

.portal-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 1.25rem;
    box-shadow: var(--portal-shadow);
    padding: 1.5rem;
}

.portal-auth-card {
    padding: 2rem;
}

.portal-sticky-card {
    top: 5.5rem;
}

.portal-card code,
.preview-path,
.preview-file-row {
    background: var(--portal-code-bg);
    border-radius: 0.9rem;
}

.preview-path {
    display: block;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 1rem;
    word-break: break-word;
}

.preview-file-row {
    padding: 0.9rem 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--portal-border);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.28);
}

[data-bs-theme="dark"] .empty-state {
    background: rgba(15, 23, 42, 0.28);
}

.progress-thin {
    height: 0.6rem;
    border-radius: 999px;
}

.progress,
.progress-bar {
    border-radius: 999px;
}

.portal-progress-panel {
    background: var(--portal-accent-soft);
    border: 1px solid rgba(24, 90, 219, 0.15);
    border-radius: 1rem;
    padding: 1rem;
}

.portal-subpanel {
    background: rgba(255, 255, 255, 0.26);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1rem;
}

[data-bs-theme="dark"] .portal-subpanel {
    background: rgba(15, 23, 42, 0.32);
}

.portal-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.65rem;
    max-height: 18rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.portal-check-grid-compact {
    max-height: 16rem;
}

.portal-check,
.portal-radio-card {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.9rem;
    background: var(--portal-surface);
    padding: 0.75rem 0.85rem;
}

.portal-check-inline {
    align-items: center;
}

.portal-radio-card {
    height: 100%;
    align-items: center;
    cursor: pointer;
}

.portal-toggle {
    display: grid;
    gap: 0.45rem;
}

.portal-geo-panel {
    margin-top: 1rem;
}

.portal-token-box {
    position: relative;
}

.portal-token-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    min-height: 3.15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.95rem;
    background: var(--bs-body-bg);
    padding: 0.45rem 0.55rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.portal-token-control:focus-within,
.portal-token-box.is-open .portal-token-control {
    border-color: rgba(24, 90, 219, 0.58);
    box-shadow: 0 0 0 0.2rem rgba(24, 90, 219, 0.16);
}

.portal-token-box.is-invalid .portal-token-control {
    border-color: var(--bs-form-invalid-border-color);
}

.portal-token-list {
    display: contents;
}

.portal-token {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    border: 1px solid var(--portal-border);
    border-radius: 999px;
    background: var(--portal-accent-soft);
    color: inherit;
    padding: 0.32rem 0.4rem 0.32rem 0.7rem;
    line-height: 1.2;
}

.portal-token-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.12);
    color: inherit;
    font-size: 1rem;
    line-height: 1;
}

.portal-token-remove:hover,
.portal-token-remove:focus {
    background: rgba(15, 23, 42, 0.2);
    outline: none;
}

[data-bs-theme="dark"] .portal-token-remove {
    background: rgba(148, 163, 184, 0.18);
}

.portal-token-input {
    flex: 1 1 12rem;
    min-width: 8rem;
    border: 0;
    outline: none;
    background: transparent;
    color: inherit;
    padding: 0.35rem;
}

.portal-token-menu {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    z-index: 35;
    max-height: 16rem;
    overflow-y: auto;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: var(--portal-surface-strong);
    box-shadow: var(--portal-shadow);
    padding: 0.45rem;
}

.portal-token-option {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0.75rem;
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 0.7rem 0.8rem;
}

.portal-token-option:hover,
.portal-token-option:focus,
.portal-token-option.is-active {
    background: var(--portal-accent-soft);
    outline: none;
}

.portal-token-option.is-selected {
    opacity: 0.55;
}

.portal-token-empty {
    color: var(--portal-text-muted);
    padding: 0.75rem 0.85rem;
}

.tracking-wide {
    letter-spacing: 0.14em;
}

.min-vh-75 {
    min-height: 75vh;
}

.table > :not(caption) > * > * {
    background: transparent;
}

.list-group-item {
    background: transparent;
    border-color: var(--portal-border);
}

.form-control,
.form-select {
    border-radius: 0.95rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

.form-control[type="file"] {
    padding: 0.35rem 0.45rem;
    overflow: hidden;
}

.form-control[type="file"]::file-selector-button {
    margin: -0.35rem 0.9rem -0.35rem -0.45rem;
    padding: 0.8rem 1rem;
    border: 0;
    border-right: 1px solid var(--portal-border);
    background: transparent;
    color: inherit;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.form-control[type="file"]:hover::file-selector-button,
.form-control[type="file"]:focus-within::file-selector-button {
    background: var(--portal-accent-soft);
}

.portal-combobox {
    position: relative;
}

.portal-combobox-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 18rem;
    overflow-y: auto;
    background: var(--portal-surface-strong);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    box-shadow: var(--portal-shadow);
    padding: 0.45rem;
}

.portal-combobox-option,
.portal-combobox-empty {
    border-radius: 0.8rem;
    padding: 0.8rem 0.9rem;
}

.portal-combobox-option {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    gap: 0.75rem;
}

.portal-combobox-option:hover,
.portal-combobox-option:focus,
.portal-combobox-option.is-active {
    background: var(--portal-accent-soft);
    outline: none;
}

.portal-combobox-option-name {
    flex: 1;
    min-width: 0;
}

.portal-combobox-option-code {
    color: var(--portal-text-muted);
    font-size: 0.92rem;
    white-space: nowrap;
}

.portal-combobox-empty {
    color: var(--portal-text-muted);
}

.btn {
    border-radius: 0.9rem;
}

.navbar-brand {
    letter-spacing: 0.01em;
}

.portal-session-value {
    color: var(--portal-text-muted);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 0.9rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.text-body-secondary,
.form-text,
.small {
    color: var(--portal-text-muted) !important;
}

@media (max-width: 991.98px) {
    .portal-card {
        padding: 1.25rem;
    }
}
