:root {
    color-scheme: dark;
    font-family: system-ui, sans-serif;
    background: #111827;
    color: #f3f4f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.workspace {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 24px 16px;
    background: #1b2433;
    border-right: 1px solid #374151;
}

.brand {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

.subtitle {
    color: #9ca3af;
    font-size: 12px;
    margin: 8px 0 24px;
}

button,
textarea {
    font: inherit;
    border: 1px solid #374151;
    border-radius: 8px;
    background: #1f2937;
    color: #f3f4f6;
    padding: 12px;
}

button:disabled,
textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.sidebar button {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    text-align: left;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #374151;
}

#connection-status {
    color: #9ca3af;
    font-size: 13px;
}

.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
}

.logo {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: #312e81;
    color: #c7d2fe;
    font-size: 32px;
    font-weight: 700;
}

h1 {
    font-size: clamp(24px, 4vw, 36px);
    margin-bottom: 0;
}

.notice {
    max-width: 480px;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1.6;
}

.composer {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.composer label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #9ca3af;
}

.composer textarea {
    display: block;
    width: 100%;
    min-height: 90px;
    resize: vertical;
    margin-bottom: 10px;
}

@media (max-width: 640px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid #374151;
        padding: 16px;
    }


    .welcome {
        min-height: 300px;
        padding: 20px;
    }
}

/* MIMIR AI workspace shell */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark,
.avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #312e81;
    color: #c7d2fe;
    font-weight: 700;
}

.sidebar > button,
.primary-button {
    background: #4f46e5;
    border-color: #6366f1;
}

.section-label {
    padding: 12px 8px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #374151;
}

.account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 4px;
    font-size: 12px;
}

.account small {
    display: block;
    margin-top: 4px;
    color: #9ca3af;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 480px;
    margin-top: 20px;
}

.quick-actions button {
    min-height: 48px;
    overflow-wrap: anywhere;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.workspace-footer {
    color: #9ca3af;
    font-size: 11px;
    text-align: center;
    margin: 16px 0 0;
}

button:focus-visible,
textarea:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .sidebar-bottom {
        display: block;
        margin-top: 0;
    }


    .section-label {
        display: none;
    }

    .quick-actions {
        max-width: 360px;
    }

    .topbar {
        padding: 16px;
    }
}

@media (max-width: 360px) {
    .quick-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .composer {
        padding: 12px;
    }
}

/* Authorization controls */

#status {
    color: #d1d5db;
    font-size: 13px;
}

.authorization-panel {
    width: 100%;
    max-width: 480px;
    padding: 16px;
    border: 1px solid #374151;
    border-radius: 12px;
    background: #191f2c;
    text-align: left;
}

.identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 16px;
    margin: 0 0 16px;
    font-size: 13px;
}

.identity dt {
    color: #9ca3af;
}

.identity dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-actions button {
    flex: 1 1 auto;
    font-size: 13px;
}

#retry:not(:disabled) {
    background: #4f46e5;
    border-color: #6366f1;
}

#logout:not(:disabled) {
    border-color: #f87171;
}

/* Workspace navigation */
[hidden] {
    display: none !important;
}

button[data-section][aria-current="page"] {
    background: #29364d;
    border-color: #6684bc;
    color: #ffffff;
}

.workspace-section {
    flex: 1;
    min-width: 0;
    padding: 24px;
    overflow-wrap: anywhere;
}

.workspace-section h1 {
    margin-top: 0;
}

.workspace-section p {
    line-height: 1.6;
}

/* Responsive workspace navigation */

#workspace-navigation {
    min-width: 0;
}

#workspace-navigation button {
    min-height: 44px;
}

.authorization-panel {
    align-self: center;
    width: calc(100% - 32px);
    margin: 16px;
}

@media (max-width: 640px) {
    .sidebar {
        min-width: 0;
        gap: 6px;
    }

    .subtitle {
        margin: 4px 0 8px;
    }

    #workspace-navigation {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        max-width: 100%;
        overflow-x: auto;
        padding: 6px;
        scroll-padding-inline: 6px;
    }

    #workspace-navigation button {
        flex: 0 0 auto;
        width: auto;
        margin: 0;
        white-space: nowrap;
        text-align: center;
    }

    .sidebar-bottom {
        padding-top: 8px;
    }

    .account {
        padding: 4px;
    }

    .workspace-section {
        padding: 16px;
    }

    .auth-actions button {
        min-height: 44px;
    }
}

@media (max-width: 360px) {
    .identity {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .identity dd {
        margin-bottom: 6px;
    }

    .auth-actions button {
        flex: 1 1 100%;
    }
}
