/* ═══════════════════════════════════════════════════════════════════════════
   AGENTIR min.css — LAYOUT ONLY
   All colors/borders/backgrounds removed — theme.css governs visuals.
   Only structural rules (flex, grid, sizing, positioning, responsive) remain.
   ═══════════════════════════════════════════════════════════════════════════ */

#mic-btn,
.action-btn,
.nav-link {
    cursor: pointer;
    transition: 0.2s;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: calc(100% - 260px);
}

main.workspace-container,
section.chat-pane {
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

*,
.system-footer,
.wiki-modal-content,
::after,
::before,
header {
    box-sizing: border-box;
}

section.chat-pane {
    display: flex;
    height: 100%;
}

main.workspace-container {
    display: flex;
    flex: 1;
}

.app-body,
header {
    width: 100%;
    position: relative;
}

.sidebar-overlay,
.wiki-modal {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

*,
::after,
::before {
    margin: 0;
    padding: 0;
}

body,
pre,
ul {
    margin: 0;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: 50px;
    flex-shrink: 0;
    z-index: 1001;
    border-bottom: 1px solid var(--border);
    background: var(--header);
}

.logo-wrap img {
    display: none;
}

#chat-messages,
#sidebar,
.app-body,
.chat-input-row,
.chat-pane,
.workspace-container,
nav {
    display: flex;
    box-sizing: border-box;
}

.app-body {
    flex: 1;
    height: calc(100dvh - 50px - 35px);
    overflow: hidden;
}

#sidebar, nav {
    width: 260px;
    min-width: 260px;
    flex-direction: column;
    /* padding removed — handled by .app-sidebar in theme.css */
    gap: 0;
    height: 100%;
    flex-shrink: 0;
    transition: transform 0.3s;
    z-index: 105;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
}

.chat-pane,
.workspace-container {
    flex: 1;
    position: relative;
    height: 100%;
    overflow: hidden;
    min-height: 0;
}

.workspace-container {
    width: calc(100% - 260px);
    flex-direction: column;
}

.nav-links {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 2px;
    font-family: var(--font-mono);
    padding: 2px 0;
}

.chat-pane {
    flex-direction: column;
    align-items: center;
    min-height: 0;
}

#chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 28px;
    flex-direction: column;
    gap: 16px;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch;
}

.msg-ai,
.msg-user {
    word-break: break-word;
    font-size: 0.875rem;
    border-radius: 2px;
    flex-shrink: 0;
    font-family: var(--font-body);
}

.msg-user {
    align-self: flex-end;
    padding: 10px 16px;
    max-width: 75%;
    line-height: 1.6;
}

.msg-ai {
    align-self: flex-start;
    padding: 16px 20px;
    width: 100%;
    line-height: 1.75;
    white-space: normal;
}

.msg-ai.thinking {
    opacity: 0.5;
}

.chat-input-row {
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--sidebar);
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 16px;
    padding: 10px 14px;
    outline: 0;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
}

#chat-send {
    padding: 8px 16px;
    cursor: pointer;
    transition: 0.15s;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

#chat-send:hover {
    background: var(--accent);
    color: var(--bg);
}

#chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wiki-modal {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.wiki-modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 900px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
}

.msg-ai,
.msg-ai pre {
    overflow-x: auto;
    max-width: 100%;
}

.wiki-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px dashed var(--border);
    background: var(--sidebar);
    flex-wrap: wrap;
    gap: 10px;
}

.wiki-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: var(--font-prose);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.system-footer {
    height: 35px;
    width: 100%;
    border-top: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--sidebar);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .app-body {
        height: calc(100dvh - 50px - 35px);
    }
    
    #sidebar,
    nav {
        position: fixed;
        top: 50px;
        left: 0;
        height: calc(100dvh - 50px);
        transform: translateX(-100%);
        z-index: 105;
        width: 260px;
        min-width: 260px;
    }
    
    #sidebar.open,
    nav.open {
        transform: translateX(0);
    }
    
    .workspace-container {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .chat-pane {
        height: 100%;
        position: relative;
    }
    
    #chat-messages {
        padding: 16px 16px 24px;
    }
    
    .chat-input-row {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        margin: 0;
        max-width: 100%;
        z-index: 110;
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        flex-shrink: 0;
    }
    
    header {
        padding: 0 1rem;
        height: 50px;
    }
    
    #subBtn {
        padding: 4px 8px !important;
        font-size: 0.6rem !important;
    }
}

@media print {
    #wiki-canvas,
    #wiki-canvas *,
    .msg-ai,
    .wiki-modal-body *,
    body {
        color: #000 !important;
    }
    body * {
        visibility: hidden;
    }
    .wiki-modal-body,
    .wiki-modal-body * {
        visibility: visible;
    }
    .wiki-modal-body {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    #sidebar,
    #subBtn,
    .chat-input-row,
    .sidebar-overlay,
    .system-footer,
    .wiki-modal-header,
    header,
    nav {
        display: none !important;
    }
    .wiki-modal {
        position: static !important;
        background: 0 0 !important;
        display: block !important;
        padding: 0 !important;
    }
    .wiki-modal-content {
        border: none !important;
        height: auto !important;
    }
}

.msg-ai h1,
.msg-ai h2,
.msg-ai h3 {
    font-family: var(--font-mono);
    color: var(--accent);
    margin: 12px 0 6px;
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.msg-ai strong,
.msg-ai th {
    color: var(--accent);
    font-weight: 700;
}

.msg-ai em {
    font-style: italic;
}

.msg-ai code {
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}

.msg-ai pre {
    background: #000;
    color: var(--accent);
    padding: 12px 16px;
    border-radius: 4px;
    margin: 8px 0;
    border: 1px solid var(--border);
    word-break: break-all;
}

.msg-ai pre code {
    background: transparent;
    padding: 0;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    color: var(--accent);
}

.msg-ai ol,
.msg-ai ul {
    padding-left: 20px;
    margin: 6px 0;
}

.msg-ai li {
    margin-bottom: 4px;
    line-height: 1.75;
}

.msg-ai p {
    margin-bottom: 8px;
}

.msg-ai blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
}

.msg-ai table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 0.8rem;
}

.msg-ai td,
.msg-ai th {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}

.msg-ai th {
    background: rgba(var(--accent-rgb), 0.1);
}
