:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17223b;
    background: #f3f6fb;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: #f3f6fb;
    color: #17223b;
}

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

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.auth-card {
    width: min(100% - 2rem, 80rem);
    margin: clamp(1rem, 4vh, 3rem) auto;
    padding: clamp(1.25rem, 3.5vw, 2.25rem);
    border: 1px solid #e1e7f0;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 1.5rem 4rem #25375912;
}

.auth-card-narrow {
    width: min(100% - 2rem, 36rem);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid #e9eef7;
}

.brand {
    display: flex;
    align-items: center;
    gap: .85rem;
}

.brand img {
    display: block;
    flex: 0 0 auto;
    width: min(100%, 14rem);
    height: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .65rem;
}

.command-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem .8rem;
    border: 1px solid #d7e0ef;
    border-radius: .75rem;
    background: #f8faff;
    color: #4f6294;
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.command-trigger-btn:hover {
    border-color: #a8bce2;
    background: #f0f5ff;
}

.command-trigger-btn svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kbd-pill {
    display: inline-flex;
    align-items: center;
    padding: .12rem .42rem;
    border: 1px solid #d5dfef;
    border-radius: .4rem;
    background: #fff;
    color: #4f6294;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .7rem;
    border: 1px solid #e1e8f4;
    border-radius: 999px;
    background: #f8faff;
}

.user-badge-avatar {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    object-fit: cover;
}

.user-badge-icon {
    width: 1.25rem;
    height: 1.25rem;
    stroke: #4f6294;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.user-badge-name {
    font-size: .88rem;
    font-weight: 600;
    color: #17223b;
}

.scope-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .18rem .58rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.scope-chip.shared {
    color: #1e4294;
    background: #e8effd;
    border: 1px solid #c9dafc;
}

.scope-chip.personal {
    color: #4f2c85;
    background: #f2ebfe;
    border: 1px solid #dbc9fa;
}

.scope-chip.neutral {
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #dce3ed;
}

.scope-chip.warning {
    color: #854d0e;
    background: #fef9c3;
    border: 1px solid #fde047;
}

.svg-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #dce4f2;
    border-radius: .65rem;
    background: #fff;
    color: #394967;
    cursor: pointer;
    transition: all .15s ease;
}

.svg-icon-button:hover {
    border-color: #b4c4e4;
    background: #f4f7fd;
    color: #17223b;
}

.svg-icon-button.active-pin {
    color: #244eaa;
    border-color: #b8ccf7;
    background: #edf3ff;
}

.svg-icon-button.sign-out:hover {
    color: #a33b43;
    border-color: #efb9be;
    background: #fff5f5;
}

.svg-icon-button svg {
    width: 1.1rem;
    height: 1.1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(13.5rem, 15.5rem) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    padding: 1rem;
    border: 1px solid #e3e9f2;
    border-radius: 1rem;
    background: #f8faff;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.sidebar-group-title {
    margin: 0 0 .45rem .35rem;
    color: #4f6294;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .28rem;
}

.nav-item-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    width: 100%;
    padding: .58rem .72rem;
    border: 1px solid transparent;
    border-radius: .7rem;
    background: transparent;
    color: #394967;
    font-size: .88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all .14s ease;
}

.nav-item-btn:hover {
    background: #eef3fc;
    color: #17223b;
}

.nav-item-btn.active {
    background: #fff;
    border-color: #d6e0f2;
    color: #244eaa;
    box-shadow: 0 .25rem .75rem #244eaa0f;
}

.nav-item-leading {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
}

.nav-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-count {
    font-size: .73rem;
    font-weight: 700;
    color: #5f6d87;
    background: #e9effa;
    padding: .1rem .45rem;
    border-radius: 999px;
}

.nav-item-btn.active .nav-count {
    background: #e3ecff;
    color: #244eaa;
}

.identity-card-mini {
    padding: .8rem;
    border: 1px solid #e1e8f4;
    border-radius: .8rem;
    background: #fff;
    font-size: .8rem;
    color: #5f6d87;
}

.identity-card-mini strong {
    display: block;
    color: #17223b;
    margin-bottom: .25rem;
    font-size: .82rem;
}

.workspace {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.workspace-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.workspace-title h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    letter-spacing: -.03em;
}

.eyebrow {
    margin: 0 0 .3rem;
    color: #4f6294;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.section-caption {
    margin: .3rem 0 0;
    color: #5f6d87;
    font-size: .92rem;
}

.workspace-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .55rem;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap svg {
    position: absolute;
    left: .75rem;
    width: 1rem;
    height: 1rem;
    stroke: #62708a;
    fill: none;
    stroke-width: 1.85;
    pointer-events: none;
}

.search-input {
    min-width: 15rem;
    padding: .52rem .8rem .52rem 2.25rem;
    border: 1px solid #d6deeb;
    border-radius: .7rem;
    background: #f8faff;
    color: #17223b;
    font-size: .88rem;
}

.search-input:focus {
    outline: none;
    border-color: #244eaa;
    background: #fff;
    box-shadow: 0 0 0 3px #244eaa1c;
}

.view-toggle-group {
    display: inline-flex;
    padding: .2rem;
    border: 1px solid #dce4f2;
    border-radius: .7rem;
    background: #f8faff;
}

.view-toggle-btn {
    padding: .35rem .6rem;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: #5f6d87;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
}

.view-toggle-btn.active {
    background: #fff;
    color: #244eaa;
    box-shadow: 0 1px 3px rgba(23, 34, 59, 0.08);
}

/* Quick Dock for Pinned / Recent Apps */
.quick-dock {
    padding: 1rem 1.15rem;
    border: 1px solid #dde6f5;
    border-radius: 1rem;
    background: linear-gradient(180deg, #f8faff 0%, #f3f7ff 100%);
}

.quick-dock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .8rem;
}

.quick-dock-title {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #4f6294;
}

.quick-dock-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
    gap: .7rem;
}

.dock-pill-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    padding: .65rem .8rem;
    border: 1px solid #dce5f4;
    border-radius: .8rem;
    background: #fff;
    color: #17223b;
    text-decoration: none;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.dock-pill-card:hover {
    transform: translateY(-1px);
    border-color: #9cb4e6;
    box-shadow: 0 .45rem 1.1rem #244eaa12;
}

.dock-pill-leading {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.dock-pill-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dock-pill-name {
    font-size: .88rem;
    font-weight: 700;
    color: #17223b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dock-pill-sub {
    font-size: .74rem;
    color: #5f6d87;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category Section & App Launch Cards */
.category-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: .35rem;
    border-bottom: 1px solid #edf1f8;
}

.category-header h2 {
    margin: 0;
    font-size: .95rem;
    font-weight: 800;
    color: #24395f;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: .95rem;
}

.apps-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    gap: .7rem;
}

.portal-app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: .9rem;
    padding: 1.05rem 1.15rem;
    border: 1px solid #e1e8f3;
    border-radius: 1rem;
    background: #fff;
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.portal-app-card-preview {
    position: relative;
    display: block;
    margin: -1.05rem -1.15rem .15rem;
    height: 8.75rem;
    background: #f1f5fc;
    border-bottom: 1px solid #e4ebf5;
    overflow: hidden;
    text-decoration: none;
}

.apps-grid.compact .portal-app-card-preview {
    display: none;
}

.portal-app-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform .25s ease;
}

.portal-app-card:hover .portal-app-card-preview img {
    transform: scale(1.025);
}

.portal-app-card-preview-badge {
    position: absolute;
    bottom: .5rem;
    right: .6rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: rgba(23, 34, 59, 0.72);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.image-editor-box {
    margin-top: .5rem;
    padding: .85rem;
    border: 1px dashed #c8d6ee;
    border-radius: .8rem;
    background: #f8faff;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.image-editor-preview {
    width: 100%;
    max-height: 10.5rem;
    border-radius: .6rem;
    border: 1px solid #dce5f3;
    overflow: hidden;
    background: #fff;
}

.image-editor-preview img {
    width: 100%;
    height: 10.5rem;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.apps-grid.compact .portal-app-card {
    padding: .8rem .95rem;
    gap: .6rem;
}

.portal-app-card:hover {
    transform: translateY(-2px);
    border-color: #adc2ec;
    box-shadow: 0 .75rem 1.8rem #244eaa12;
}

.portal-app-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.portal-app-main-link {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex: 1 1 auto;
}

.item-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.65rem;
    height: 2.65rem;
    flex: 0 0 auto;
    border-radius: .75rem;
    border: 1px solid #d8e3f8;
    background: #eef4ff;
    color: #244eaa;
}

.item-glyph.tone-indigo {
    background: #f0edff;
    border-color: #dad2fc;
    color: #4338ca;
}

.item-glyph.tone-emerald {
    background: #ecfdf5;
    border-color: #c6f6df;
    color: #047857;
}

.item-glyph.tone-amber {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}

.item-glyph.tone-rose {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.item-glyph.tone-slate {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.item-glyph svg {
    width: 1.3rem;
    height: 1.3rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-card-meta {
    display: flex;
    flex-direction: column;
    gap: .22rem;
    min-width: 0;
}

.app-card-title-row {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.app-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #17223b;
}

.app-card-subtitle {
    font-size: .84rem;
    color: #5f6d87;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apps-grid.compact .app-card-subtitle {
    -webkit-line-clamp: 1;
}

.portal-app-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding-top: .65rem;
    border-top: 1px solid #f0f4fa;
}

.app-tags-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    min-width: 0;
}

.tag-badge {
    font-size: .7rem;
    font-weight: 600;
    color: #4f6294;
    background: #f3f6fc;
    border: 1px solid #e2e9f5;
    padding: .1rem .45rem;
    border-radius: .4rem;
}

.launch-link-btn {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    padding: .36rem .7rem;
    border-radius: .55rem;
    background: #eef3ff;
    color: #244eaa;
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .14s ease, color .14s ease;
}

.launch-link-btn:hover {
    background: #244eaa;
    color: #fff;
}

.launch-link-btn svg {
    width: .92rem;
    height: .92rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Command Palette & Modal Dialogs */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 900;
}

.dialog-card {
    width: min(100%, 38rem);
    max-height: calc(100vh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    display: flex;
    flex-direction: column;
    border: 1px solid #dce4f2;
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 1.75rem 4.5rem rgba(15, 23, 42, 0.22);
    overflow: hidden;
    margin: auto;
}

.command-palette-input-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid #e8eef7;
    background: #f8faff;
}

.command-palette-input-bar svg {
    width: 1.2rem;
    height: 1.2rem;
    stroke: #4f6294;
    fill: none;
    stroke-width: 1.9;
}

.command-palette-input {
    flex: 1 1 auto;
    border: 0;
    background: transparent;
    color: #17223b;
    font-size: .98rem;
    outline: none;
}

.command-palette-list {
    max-height: 22rem;
    overflow-y: auto;
    padding: .5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.command-palette-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: .65rem .8rem;
    border-radius: .75rem;
    text-decoration: none;
    color: #17223b;
    border: 1px solid transparent;
}

.command-palette-item:hover,
.command-palette-item.selected {
    background: #f0f5ff;
    border-color: #c8dafc;
}

.command-palette-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1rem;
    background: #f8faff;
    border-top: 1px solid #e8eef7;
    font-size: .75rem;
    color: #5f6d87;
}

.dialog-body {
    padding: 1.35rem 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
}

.dialog-footer-sticky {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .55rem;
    padding: .9rem 1.5rem;
    background: #f8faff;
    border-top: 1px solid #e8eef7;
    flex: 0 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
    margin-top: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.form-field.full-width {
    grid-column: 1 / -1;
}

.form-field label {
    font-size: .8rem;
    font-weight: 700;
    color: #24395f;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: .55rem .75rem;
    border: 1px solid #d6deeb;
    border-radius: .6rem;
    background: #fff;
    color: #17223b;
    font-size: .88rem;
}

.button {
    min-height: 2.6rem;
    padding: .55rem 1rem;
    border: 0;
    border-radius: .65rem;
    cursor: pointer;
    font-weight: 700;
    font-size: .88rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.button.primary {
    color: #fff;
    background: #244eaa;
}

.button.primary:hover {
    background: #1c3f8c;
}

.button.secondary {
    color: #24395f;
    border: 1px solid #d6deeb;
    background: #fff;
}

.button.secondary:hover {
    background: #f4f7fd;
}

.notice {
    margin: 1rem 0;
    padding: 1rem 1.15rem;
    border: 1px solid transparent;
    border-radius: .85rem;
    line-height: 1.5;
}

.notice.warning {
    color: #744b08;
    border-color: #f2d99b;
    background: #fff9e9;
}

.notice.neutral, .status {
    color: #394967;
    border-color: #dce5f3;
    background: #f5f8fd;
}

.status {
    padding: 1rem;
    border-radius: .8rem;
}

.toolbar, .card-actions, .dialog-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
}
