/* Base layout */
body {
    font-family: "Space Grotesk", system-ui, -apple-system, Segoe UI, sans-serif;
    margin: 0;
    color: #142031;
}

[hidden] {
    display: none !important;
}

.is-hidden {
    display: none !important;
}

.page-shell {
    width: min(1400px, 100%);
    margin: 0 auto;
}

/* Header */
.header {
    background: #f5f5f5;
    padding: 24px;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header h1 {
    margin: 0;
}

.header-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "title account"
        "search link";
    align-items: start;
    column-gap: 20px;
    row-gap: 10px;
}

.app-title {
    grid-area: title;
    margin: 0;
    font-size: 1.5rem;
    white-space: nowrap;
}

.title-block {
    grid-area: title;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-description {
    margin: 0;
    max-width: 62ch;
    color: #475467;
    font-size: 0.95rem;
    line-height: 1.4;
}

.public-home-cta {
    margin: 0;
    color: #475467;
    font-size: 0.92rem;
    line-height: 1.4;
}

.public-home-link {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
}

.public-home-link:hover {
    text-decoration: underline;
}

.session-controls {
    display: contents;
}

.session-account-row {
    grid-area: account;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.current-user {
    font-weight: 600;
    color: #243447;
    white-space: nowrap;
}

.session-btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    background: #243447;
    color: #fff;
    cursor: pointer;
}

.session-link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    grid-area: link;
    justify-self: end;
    width: 100%;
    max-width: 560px;
    text-align: right;
    color: #243447;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background: #eef2f7;
    border: 1px solid #d2d9e3;
    border-radius: 6px;
    min-height: 42px;
    padding: 0 10px;
    line-height: 1;
}

.session-link::before {
    content: "\1F517";
    flex: 0 0 auto;
    line-height: 1;
}

.session-link:hover {
    text-decoration: underline;
}

.session-controls .search-container {
    grid-area: search;
    width: min(460px, 100%);
    max-width: 460px;
    justify-self: start;
}

.landing-auth-link {
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
}

.landing-auth-link:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .header-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "account"
            "search"
            "link";
        row-gap: 12px;
    }

    .session-controls .search-container {
        width: 100%;
        max-width: none;
    }

    .session-account-row {
        justify-self: start;
    }

    .session-link {
        justify-self: stretch;
        justify-content: flex-start;
        text-align: left;
    }
}

/* Search */
.search-container {
    position: relative;
    max-width: 400px;
}

.search-input {
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.search-results[hidden] {
    display: none;
}

.search-result {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-result:hover {
    background: #f9f9f9;
}

.search-result-image {
    width: 80px;
    height: 30px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
    background: #ddd;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}
