:root {
    --bg-workspace: #e2e8f0;
    --sheet-white: #ffffff;
    --ink-dark: #0f172a;
    --primary-blue: #2563eb;
    --border-grey: #cbd5e1;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    /* 100dvh fixes the mobile browser URL bar hiding the bottom of the app */
    height: 100dvh; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
    background-color: var(--bg-workspace);
    overflow: hidden; 
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-grey);
    height: 56px;
    flex-shrink: 0;
    box-sizing: border-box;
    z-index: 50;
}

.logo {
    font-weight: 800;
    color: var(--ink-dark);
}

.btn-secondary {
    background: #f1f5f9;
    border: 1px solid var(--border-grey);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-save {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.canvas-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    /* Extra padding ensures the bottom of the document isn't hidden behind the drawer */
    padding-bottom: 100px; 
}

.document-page-sheet {
    background: var(--sheet-white);
    width: 100%;
    max-width: 760px;
    min-height: 800px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 32px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border: 1px solid #94a3b8;
}

.page-header-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.page-content-flow {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.content-block-wrapper {
    width: 100%;
}

.doc-heading-primary {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink-dark);
    margin: 0;
    outline: none;
}

.doc-body-paragraph {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #334155;
    margin: 0;
    outline: none;
}

.table-container-responsive {
    width: 100%;
    overflow-x: auto;
}

.doc-vector-graphic-box {
    width: 100%;
    background: #f8fafc;
    border: 1px dashed var(--border-grey);
    border-radius: 6px;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

/* * CRITICAL FIX: The Prompt Drawer
 * Forces the drawer to stay visible above mobile keyboards and safe areas
 */
.prompt-drawer {
    background: #ffffff;
    border-top: 1px solid var(--border-grey);
    padding: 12px 16px;
    /* env() variables protect the UI from iPhone home indicator bars */
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    width: 100%;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-grey);
    border-radius: 24px;
    outline: none;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.btn-generate {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
}
