/* Plan Apps — Okta-inspired app launcher */

:root {
    --okta-bg: #f5f5f6;
    --okta-surface: #ffffff;
    --okta-border: #dddfe1;
    --okta-border-light: #ebebed;
    --okta-text: #1d1d21;
    --okta-text-muted: #5e5e5e;
    --okta-text-subtle: #8c8c96;
    --okta-primary: #1662dd;
    --okta-primary-hover: #124eb3;
    --okta-sidebar: #f9f9f9;
    --okta-sidebar-active: #e8f1fc;
    --plan-blue: #009fdf;
    --plan-deep: #005b9f;
    --shadow-sm: 0 1px 2px rgba(29, 29, 33, 0.08);
    --shadow-md: 0 4px 12px rgba(29, 29, 33, 0.1);
    --shadow-card-hover: 0 8px 24px rgba(29, 29, 33, 0.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --header-height: 56px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--okta-text);
    background: var(--okta-bg);
    min-height: 100vh;
}

a {
    color: var(--okta-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 0.75rem 1rem;
    background: var(--okta-primary);
    color: #fff;
}

.skip-link:focus {
    left: 0;
}

/* Layout shell */
.portal {
    display: flex;
    min-height: 100vh;
}

/* Left sidebar — Okta style */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--okta-sidebar);
    border-right: 1px solid var(--okta-border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar__brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--okta-border-light);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
}

.sidebar__brand img {
    height: 32px;
    width: auto;
}

.sidebar__nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar__nav-label {
    padding: 0.5rem 1.25rem 0.35rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--okta-text-subtle);
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1.25rem;
    color: var(--okta-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.sidebar__link:hover {
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.sidebar__link--active {
    background: var(--okta-sidebar-active);
    border-left-color: var(--okta-primary);
    color: var(--okta-primary);
}

.sidebar__link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}

.sidebar__footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--okta-border-light);
    font-size: 0.75rem;
    color: var(--okta-text-subtle);
}

/* Main area */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top header with search */
.topbar {
    height: var(--header-height);
    background: var(--okta-surface);
    border-bottom: 1px solid var(--okta-border-light);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-wrap {
    flex: 1;
    max-width: 560px;
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--okta-text-subtle);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 1rem 0 2.5rem;
    border: 1px solid var(--okta-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--okta-text);
    background: var(--okta-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::placeholder {
    color: var(--okta-text-subtle);
}

.search-input:focus {
    outline: none;
    border-color: var(--okta-primary);
    box-shadow: 0 0 0 3px rgba(22, 98, 221, 0.15);
    background: var(--okta-surface);
}

.topbar__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--okta-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.view-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--okta-surface);
    color: var(--okta-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.view-toggle__btn:hover {
    background: var(--okta-bg);
}

.view-toggle__btn--active {
    background: var(--okta-sidebar-active);
    color: var(--okta-primary);
}

.view-toggle__btn svg {
    width: 18px;
    height: 18px;
}

/* Content */
.content {
    flex: 1;
    padding: 1.5rem 2rem 3rem;
    max-width: 1200px;
}

.welcome {
    margin-bottom: 1.75rem;
}

.welcome h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.welcome p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--okta-text-muted);
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}

.section__title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--okta-text-muted);
}

.section__collapse {
    background: none;
    border: none;
    color: var(--okta-text-subtle);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.section__collapse:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--okta-text);
}

.section__collapse svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.section--collapsed .section__collapse svg {
    transform: rotate(-90deg);
}

.section--collapsed .app-grid,
.section--collapsed .app-list {
    display: none;
}

/* App grid — Okta chiclets */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 1rem;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 0.75rem 1rem;
    background: var(--okta-surface);
    border: 1px solid var(--okta-border-light);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
    cursor: pointer;
}

.app-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--okta-border);
    transform: translateY(-2px);
    text-decoration: none;
}

.app-card:focus-visible {
    outline: 2px solid var(--okta-primary);
    outline-offset: 2px;
}

.app-card__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.app-card__icon svg {
    width: 28px;
    height: 28px;
}

.app-card__name {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--okta-text);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-card__desc {
    font-size: 0.6875rem;
    line-height: 1.4;
    color: var(--okta-text-subtle);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List view */
.app-list {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

.portal--list-view .app-grid {
    display: none;
}

.portal--list-view .app-list {
    display: flex;
}

.app-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--okta-surface);
    border: 1px solid var(--okta-border-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.app-row:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--okta-border);
    text-decoration: none;
}

.app-row__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.app-row__icon svg {
    width: 20px;
    height: 20px;
}

.app-row__body {
    flex: 1;
    min-width: 0;
}

.app-row__name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.app-row__desc {
    font-size: 0.8125rem;
    color: var(--okta-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-row__arrow {
    color: var(--okta-text-subtle);
    flex-shrink: 0;
}

.app-row__arrow svg {
    width: 18px;
    height: 18px;
}

/* Empty / no results */
.no-results {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--okta-text-muted);
}

.no-results--visible {
    display: block;
}

.no-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.no-results h2 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--okta-text);
}

.no-results p {
    margin: 0;
    font-size: 0.875rem;
}

/* Hidden by search */
[data-hidden="true"] {
    display: none !important;
}

.section[data-hidden="true"] {
    display: none;
}

/* Mobile */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--okta-border);
    border-radius: var(--radius-sm);
    background: var(--okta-surface);
    cursor: pointer;
    color: var(--okta-text);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
}

/* Under-development apps */
.app-card--dev,
.app-row--dev {
    cursor: not-allowed;
}

.app-card--dev .app-card__icon,
.app-row--dev .app-row__icon {
    opacity: 0.72;
}

/* Development notice modal */
.dev-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dev-modal[hidden] {
    display: none;
}

.dev-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(29, 29, 33, 0.45);
}

.dev-modal__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--okta-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card-hover);
    padding: 1.75rem 1.5rem 1.5rem;
    text-align: center;
}

.dev-modal__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #fff4e5;
    color: #b35c00;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dev-modal__icon svg {
    width: 24px;
    height: 24px;
}

.dev-modal__title {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--okta-text);
}

.dev-modal__message {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--okta-text-muted);
}

.dev-modal__btn {
    min-width: 120px;
    height: 40px;
    padding: 0 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--okta-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.dev-modal__btn:hover {
    background: var(--okta-primary-hover);
}

.dev-modal__btn:focus-visible {
    outline: 2px solid var(--okta-primary);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar--open {
        transform: translateX(0);
    }

    .sidebar-overlay--visible {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .content {
        padding: 1rem 1rem 2rem;
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}
