/* App shell in the style of the team's Route Local admin app: white top bar (brand, menu, user)
   and full-width content. Narrow screens get a drawer (html[data-nav-open]). See js/shell.js. */

:root {
    --wf-header-height: 60px;
}

.wf-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Header ---------- */

.wf-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--wf-header-height);
    padding: 0 20px;
    background: var(--wf-surface);
    border-bottom: 1px solid var(--wf-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.wf-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    color: var(--wf-text);
    text-decoration: none;
}

    .wf-brand img {
        border-radius: 8px;
    }

.wf-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.wf-brand-name {
    font-size: 1rem;
    font-weight: 700;
}

.wf-brand-tag {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wf-text-muted);
}

.wf-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--wf-text);
    background: transparent;
    border: none;
    border-radius: var(--wf-radius-sm);
    cursor: pointer;
    flex-shrink: 0;
}

    .wf-icon-btn:hover {
        background: var(--wf-surface-alt);
    }

    .wf-icon-btn:focus-visible {
        outline: none;
        box-shadow: var(--wf-focus-ring);
    }

.wf-menu-btn {
    display: none;
}

.wf-header-end {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ---------- Menu ---------- */

.wf-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.wf-nav-list {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

    .wf-nav-list > li {
        position: relative;
    }

.wf-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.875rem;
    color: var(--wf-text);
    text-decoration: none;
    white-space: nowrap;
    border-radius: var(--wf-radius-sm);
    cursor: pointer;
    user-select: none;
}

    .wf-nav-link:hover {
        background: var(--wf-surface-alt);
    }

    .wf-nav-link:focus-visible {
        outline: none;
        box-shadow: var(--wf-focus-ring);
    }

    .wf-nav-link .wf-icon {
        flex-shrink: 0;
        color: var(--wf-text-muted);
    }

    .wf-nav-link.active {
        background: var(--wf-primary-tint);
        color: var(--wf-primary-strong);
        font-weight: 600;
    }

        .wf-nav-link.active .wf-icon {
            color: var(--wf-primary-strong);
        }

.wf-nav-group > summary,
.wf-account > summary {
    list-style: none;
}

    .wf-nav-group > summary::-webkit-details-marker,
    .wf-account > summary::-webkit-details-marker {
        display: none;
    }

.wf-chevron {
    transition: transform 0.15s ease;
}

.wf-nav-group[open] > summary .wf-chevron,
.wf-account[open] > summary .wf-chevron {
    transform: rotate(180deg);
}

.wf-nav-group[open] > summary {
    background: var(--wf-surface-alt);
}

.wf-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    display: grid;
    min-width: 220px;
    padding: 6px;
    background: var(--wf-surface);
    border: 1px solid var(--wf-border);
    border-radius: var(--wf-radius);
    box-shadow: var(--wf-shadow);
}

.wf-dropdown-wide {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    column-gap: 4px;
}

/* Keep wide drop-downs (e.g. Administration) on screen. */
.wf-nav-list > li:nth-last-child(-n+2) .wf-dropdown {
    left: auto;
    right: 0;
}

.wf-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--wf-text);
    text-decoration: none;
    white-space: nowrap;
    border-radius: var(--wf-radius-sm);
}

    .wf-dropdown-item .wf-icon {
        flex: none;
        color: var(--wf-text-muted);
    }

    .wf-dropdown-item.active .wf-icon {
        color: var(--wf-primary-strong);
    }

    .wf-dropdown-item:hover {
        background: var(--wf-surface-alt);
    }

    .wf-dropdown-item:focus-visible {
        outline: none;
        box-shadow: var(--wf-focus-ring);
    }

    .wf-dropdown-item.active {
        background: var(--wf-primary-tint);
        color: var(--wf-primary-strong);
        font-weight: 600;
    }

/* ---------- Account (top right) ---------- */

.wf-account {
    position: relative;
}

.wf-account-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--wf-radius-sm);
    cursor: pointer;
}

    .wf-account-summary:hover {
        background: var(--wf-surface-alt);
    }

    .wf-account-summary:focus-visible {
        outline: none;
        box-shadow: var(--wf-focus-ring);
    }

    .wf-account-summary .wf-chevron {
        color: var(--wf-text-muted);
    }

.wf-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--wf-primary-tint);
    color: var(--wf-primary-strong);
    font-size: 0.8125rem;
    font-weight: 700;
}

.wf-account-text {
    display: flex;
    flex-direction: column;
    max-width: 200px;
    line-height: 1.25;
}

.wf-account-name {
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wf-account-company,
.wf-account-caption {
    font-size: 0.75rem;
    color: var(--wf-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wf-account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    width: 260px;
    padding: 6px;
    background: var(--wf-surface);
    border: 1px solid var(--wf-border);
    border-radius: var(--wf-radius);
    box-shadow: var(--wf-shadow);
}

.wf-account-user {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--wf-border);
}

.wf-account-menu form {
    margin: 0;
}

.wf-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.875rem;
    color: var(--wf-text);
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--wf-radius-sm);
    cursor: pointer;
}

    .wf-menu-item:hover:not(:disabled) {
        background: var(--wf-primary-tint);
    }

    .wf-menu-item:disabled {
        color: var(--wf-text-muted);
        cursor: default;
        opacity: 0.7;
    }

/* ---------- Content ---------- */

.wf-content {
    flex: 1;
    min-width: 0;
}

.wf-footer {
    padding: 14px 24px;
    font-size: 0.8125rem;
    color: var(--wf-text-muted);
    text-align: center;
}

.wf-page {
    padding: 24px;
}

.wf-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 18px;
}

    .wf-page-header h1 {
        margin: 0;
        font-size: 1.375rem;
        font-weight: 600;
    }

.wf-page-subtitle {
    margin: 2px 0 0;
    font-size: 0.875rem;
    color: var(--wf-text-muted);
}

.wf-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.wf-card {
    background: var(--wf-surface);
    border: 1px solid var(--wf-border);
    border-radius: var(--wf-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.wf-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--wf-text-muted);
}

    .wf-empty-state h2 {
        margin: 16px 0 4px;
        font-size: 1.125rem;
        font-weight: 600;
        color: var(--wf-text);
    }

    .wf-empty-state p {
        margin: 4px 0;
    }

    .wf-empty-state .wf-icon {
        color: var(--wf-primary);
    }

.wf-muted {
    color: var(--wf-text-muted);
    font-size: 0.875rem;
}

.wf-scrim {
    display: none;
}

/* ---------- Medium widths: drop the menu icons to save space ---------- */

@media (max-width: 1560px) {
    .wf-nav-link > .wf-icon:first-child {
        display: none;
    }
}

/* ---------- Narrow screens: hamburger + drawer ---------- */

@media (max-width: 1280px) {
    .wf-menu-btn {
        display: inline-flex;
    }

    .wf-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 35;
        display: block;
        width: min(300px, 85vw);
        padding: 12px;
        overflow-y: auto;
        background: var(--wf-surface);
        box-shadow: var(--wf-shadow);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    html[data-nav-open] .wf-nav {
        transform: none;
    }

    html[data-nav-open] .wf-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 32;
        background: rgba(0, 0, 0, 0.35);
    }

    .wf-nav-list {
        flex-direction: column;
        align-items: stretch;
    }

    .wf-nav-link {
        height: 42px;
    }

        .wf-nav-link > .wf-icon:first-child {
            display: inline;
        }

    .wf-nav-group .wf-chevron {
        margin-left: auto;
    }

    .wf-dropdown,
    .wf-nav-list > li:nth-last-child(-n+2) .wf-dropdown {
        position: static;
        display: block;
        min-width: 0;
        padding: 2px 0 6px 30px;
        border: none;
        box-shadow: none;
    }

    .wf-dropdown-wide {
        grid-template-columns: none;
    }
}

@media (max-width: 640px) {
    .wf-header {
        gap: 8px;
        padding: 0 10px;
    }

    .wf-brand-tag,
    .wf-account-text {
        display: none;
    }

    .wf-page {
        padding: 16px;
    }

    .wf-footer {
        padding: 14px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wf-nav,
    .wf-chevron {
        transition: none;
    }
}
