/* ============================================================
   LiveMD — Editorial Markdown Studio
   ============================================================ */

:root {
    --serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --serif-body: 'Newsreader', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- Light (Paper) Theme --- */
[data-theme="light"] {
    --bg: #f4f1ea;
    --bg-panel: #fbf9f3;
    --bg-editor: #fcfbf6;
    --text: #1d1b16;
    --text-soft: #4b463c;
    --muted: #8a8273;
    --border: #ddd6c7;
    --border-strong: #c8bfad;
    --accent: #9c3415;
    --accent-soft: rgba(156, 52, 21, 0.10);
    --shadow: 0 1px 2px rgba(40,33,20,0.06);
    --code-bg: #efebe1;
    --footer-bg: #fff4d6;
    --footer-border: #e8c547;
    --footer-accent: #d4a017;
}

/* --- Dark (Ink) Theme --- */
[data-theme="dark"] {
    --bg: #131210;
    --bg-panel: #1a1916;
    --bg-editor: #161513;
    --text: #ece6d8;
    --text-soft: #c5bfb1;
    --muted: #8a8474;
    --border: #2c2a24;
    --border-strong: #3b3830;
    --accent: #e07b53;
    --accent-soft: rgba(224, 123, 83, 0.14);
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
    --code-bg: #201e1a;
    --footer-bg: #2a2418;
    --footer-border: #8a7020;
    --footer-accent: #e8c547;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Header
   ============================================================ */
.app-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 62px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: .75rem; }

.brand-mark {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.brand-mark .brand-icon {
    display: block;
    width: 40px;
    height: 40px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
    font-family: var(--serif-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}
.brand-sub {
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

.header-actions { display: flex; align-items: center; gap: .5rem; }

.save-status {
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 .5rem;
    white-space: nowrap;
}
.save-status.dirty { color: var(--accent); }
.save-status.saving { color: var(--muted); opacity: 0.7; }

/* --- Buttons --- */
.btn {
    font-family: var(--sans);
    font-size: .82rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .85rem;
    color: var(--text-soft);
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: var(--text); background: var(--accent-soft); }
.btn i { font-size: .85rem; }
.btn-accent {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.btn-accent:hover { color: #fff; filter: brightness(1.08); background: var(--accent); border-color: var(--accent); }
.btn-icon { padding: .5rem .6rem; }
.chev { font-size: .6rem !important; opacity: .8; }

/* --- Dropdown --- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    padding: .35rem;
    z-index: 50;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.dropdown.open .dropdown-menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .7rem;
    font-family: var(--sans);
    font-size: .85rem;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
}
.dropdown-menu button:hover { background: var(--accent-soft); color: var(--accent); }
.dropdown-menu button i { width: 18px; text-align: center; color: var(--muted); }
.dropdown-menu button:hover i { color: var(--accent); }
.dropdown-menu button em {
    margin-left: auto;
    font-style: normal;
    font-size: .72rem;
    color: var(--muted);
    font-family: var(--mono);
}
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: .35rem .25rem;
}
.export-opt {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .7rem;
    font-size: .82rem;
    color: var(--text-soft);
    cursor: pointer;
    border-radius: 5px;
    user-select: none;
}
.export-opt:hover { background: var(--accent-soft); color: var(--text); }
.export-opt input { accent-color: var(--accent); }

/* ============================================================
   Toolbar
   ============================================================ */
.toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.tool-group { display: flex; gap: .25rem; }
.tool-sep { width: 1px; height: 20px; background: var(--border-strong); }
.tool-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 .5rem;
    font-family: var(--sans);
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-soft);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all .12s ease;
}
.tool-btn:hover { color: var(--accent); background: var(--accent-soft); }
.toolbar-stats {
    margin-left: auto;
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .02em;
    color: var(--muted);
    white-space: nowrap;
    padding-left: 1rem;
}

/* ============================================================
   Workspace (two panes)
   ============================================================ */
.workspace {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}
.pane {
    width: 50%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}
.editor-pane { border-right: 1px solid var(--border); }

.pane-label {
    flex: 0 0 auto;
    font-family: var(--sans);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
    padding: .7rem 2.2rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}
.pane-num {
    font-family: var(--serif-display);
    font-style: italic;
    font-size: .95rem;
    color: var(--accent);
    letter-spacing: 0;
}

/* --- Editor --- */
#editor {
    flex: 1 1 auto;
    width: 100%;
    resize: none;
    border: none;
    outline: none;
    padding: 2rem 2.2rem;
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg-editor);
    overflow-y: auto;
    tab-size: 2;
}
#editor::placeholder { color: var(--muted); font-style: italic; }

/* --- Preview --- */
.preview-pane { background: var(--bg-panel); }
#preview {
    flex: 1 1 auto;
    position: relative;
    overflow-y: auto;
    padding: 2.5rem 3rem 4rem;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    font-family: var(--serif-body);
    font-size: 1.12rem;
    line-height: 1.75;
    color: var(--text-soft);
    scroll-behavior: auto;
}

/* ============================================================
   Markdown (Editorial typography)
   ============================================================ */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    font-family: var(--serif-display);
    color: var(--text);
    line-height: 1.18;
    margin: 1.8rem 0 .8rem;
    letter-spacing: -0.01em;
}
.markdown-body h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-top: .4rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--text);
}
.markdown-body h2 { font-size: 1.85rem; font-weight: 700; }
.markdown-body h3 { font-size: 1.4rem; font-weight: 600; }
.markdown-body h4 { font-size: 1.15rem; font-weight: 600; }
.markdown-body p { margin: 0 0 1.1rem; }

.markdown-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.markdown-body blockquote {
    margin: 1.4rem 0;
    padding: .4rem 0 .4rem 1.4rem;
    border-left: 3px solid var(--accent);
    font-style: italic;
    font-size: 1.18rem;
    color: var(--text);
}
.markdown-body ul, .markdown-body ol { padding-left: 1.4rem; margin: 0 0 1.1rem; }
.markdown-body li { margin: .3rem 0; }

.markdown-body code {
    font-family: var(--mono);
    font-size: .86em;
    background: var(--code-bg);
    color: var(--accent);
    padding: .15em .4em;
    border-radius: 4px;
}
.markdown-body pre {
    background: #282c34;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 1.2rem 0;
}
.markdown-body pre code {
    background: transparent;
    color: #abb2bf;
    padding: 0;
    font-size: .85rem;
    line-height: 1.6;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    margin: 1rem 0;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-strong);
    margin: 2rem 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
    font-family: var(--sans);
    font-size: .95rem;
}
.markdown-body th, .markdown-body td {
    border: 1px solid var(--border-strong);
    padding: .55rem .8rem;
    text-align: left;
}
.markdown-body th { background: var(--code-bg); font-weight: 600; color: var(--text); }

.markdown-body .mermaid {
    text-align: center;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.2rem 0;
}
[data-theme="dark"] .markdown-body .mermaid { filter: brightness(0.95); }

/* block wrappers used for scroll-sync (transparent) */
.md-block { display: block; }
.md-block:first-child > :first-child { margin-top: 0; }

/* ============================================================
   Drop overlay
   ============================================================ */
.drop-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(20,18,14,0.82);
    backdrop-filter: blur(2px);
    z-index: 20;
}
.drop-overlay.show { display: flex; }
.drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .8rem;
    color: #fff;
    font-family: var(--serif-display);
    font-size: 1.4rem;
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 12px;
    padding: 2.5rem 3rem;
}
.drop-inner i { font-size: 2.4rem; }

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.35rem 1rem;
    background: var(--footer-bg);
    border-top: 2px solid var(--footer-border);
    font-family: var(--serif-body);
    font-size: 0.78rem;
    color: var(--text-soft);
    box-shadow: 0 -2px 12px rgba(212, 160, 23, 0.12);
}
.footer-inner {
    margin: 0;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.footer-inner strong { color: var(--footer-accent); }
.app-footer a { color: var(--accent); font-weight: 500; text-decoration: none; }
.app-footer a:hover { color: var(--footer-accent); text-decoration: underline; }
.footer-write-link::before { content: ' '; }

@media (max-width: 640px) {
    .app-footer { padding: 0.3rem 0.5rem; font-size: 0.72rem; }
}

/* Focus & accessibility */
.btn:focus-visible,
.tool-btn:focus-visible,
.export-opt:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
#editor:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .export-overlay.building .export-overlay-inner i { animation: none; }
}

/* ============================================================
   Scrollbars
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ============================================================
   Toast (copy feedback)
   ============================================================ */
.toast {
    position: fixed;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text);
    color: var(--bg-panel);
    font-family: var(--sans);
    font-size: .85rem;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
    .brand-sub { display: none; }
    .btn span { display: none; }
    .workspace { flex-direction: column; }
    .pane { width: 100%; height: 50%; }
    .editor-pane { border-right: none; border-bottom: 1px solid var(--border); }
    #preview { padding: 1.5rem; }
}

/* ============================================================
   Export preview overlay
   ============================================================ */
.export-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #f4f1ea;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.export-overlay.show { display: flex; }
.export-overlay.building .export-stage-wrap { opacity: 0.35; pointer-events: none; }
.export-overlay.building .export-overlay-inner i { animation: export-spin 0.8s linear infinite; }
@keyframes export-spin { to { transform: rotate(360deg); } }

.export-preview-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.25rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.export-overlay-inner {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-family: var(--sans);
    font-size: .9rem;
    color: var(--text);
}
.export-overlay-inner i { color: var(--accent); }
.export-preview-actions { display: flex; gap: .5rem; flex-shrink: 0; }
#export-confirm:disabled { opacity: 0.45; cursor: not-allowed; }

.export-stage-wrap {
    flex: 1 1 auto;
    overflow: auto;
    padding: 2rem 1rem 3rem;
    display: flex;
    justify-content: center;
    transition: opacity .2s ease;
}
.export-stage {
    width: 794px;
    max-width: 100%;
    padding: 48px;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    min-height: 200px;
}
.export-stage:empty::after {
    content: 'Preparing your document preview…';
    display: block;
    text-align: center;
    color: var(--muted);
    font-family: var(--serif-body);
    font-style: italic;
    padding: 4rem 2rem;
}

/* Editorial export document (PDF + print) */
.export-body {
    background: #ffffff;
    color: #1d1b16;
    font-family: var(--serif-body);
    font-size: 1.12rem;
    line-height: 1.75;
    padding: 0;
}
.export-body h1, .export-body h2, .export-body h3, .export-body h4 {
    font-family: var(--serif-display);
    color: #1d1b16;
    line-height: 1.18;
    margin: 1.8rem 0 .8rem;
}
.export-body h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-top: 0;
    padding-bottom: .5rem;
    border-bottom: 2px solid #1d1b16;
}
.export-body h2 { font-size: 1.85rem; font-weight: 700; }
.export-body h3 { font-size: 1.4rem; font-weight: 600; }
.export-body p { margin: 0 0 1.1rem; color: #4b463c; }
.export-body blockquote {
    margin: 1.4rem 0;
    padding: .4rem 0 .4rem 1.4rem;
    border-left: 3px solid #9c3415;
    font-style: italic;
    font-size: 1.18rem;
    color: #1d1b16;
}
.export-body ul, .export-body ol { padding-left: 1.4rem; margin: 0 0 1.1rem; color: #4b463c; }
.export-body li { margin: .3rem 0; }
.export-body code {
    font-family: var(--mono);
    font-size: .86em;
    background: #efebe1;
    color: #9c3415;
    padding: .15em .4em;
    border-radius: 4px;
}
.export-body pre {
    background: #282c34;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    overflow: hidden;
    margin: 1.2rem 0;
}
.export-body pre code { background: transparent; color: #abb2bf; padding: 0; }
.export-body img, .export-body .export-shot {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 6px;
}
.export-body .export-diagram-wrap {
    text-align: center;
    margin: 1.2rem 0;
    padding: .5rem;
    background: #fff;
}
.export-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
    font-family: var(--sans);
    font-size: .95rem;
}
.export-body th, .export-body td {
    border: 1px solid #c8bfad;
    padding: .55rem .8rem;
    text-align: left;
}
.export-body th { background: #efebe1; font-weight: 600; }
.export-body a { color: #9c3415; }
.export-body hr {
    border: none;
    border-top: 1px solid #c8bfad;
    margin: 2rem 0;
}
.export-body .md-block:first-child > :first-child { margin-top: 0; }

.export-pdf-page {
    width: 698px;
    background: #ffffff;
    box-sizing: border-box;
    overflow: visible;
}

.export-pdf-page > :first-child { margin-top: 0; }

/* ============================================================
   PDF export styling (legacy)
   ============================================================ */
.pdf-body {
    background: #ffffff !important;
    color: #1a1a1a !important;
    font-family: var(--serif-body);
    line-height: 1.7;
}
.pdf-body h1, .pdf-body h2, .pdf-body h3, .pdf-body h4 { color: #111 !important; font-family: var(--serif-display); }
.pdf-body p, .pdf-body li, .pdf-body td, .pdf-body th, .pdf-body blockquote { color: #1a1a1a !important; }
.pdf-body a { color: #9c3415 !important; }

/* ============================================================
   Share modal (editor)
   ============================================================ */
.share-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.share-modal.show { display: flex; }
.share-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(29, 27, 22, 0.45);
}
.share-modal-card {
    position: relative;
    width: min(480px, 100%);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
}
.share-modal-card h2 {
    font-family: var(--serif-display);
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}
.share-modal-lead { color: var(--text-soft); margin: 0 0 1rem; line-height: 1.5; }
.share-modal-rules {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--text-soft);
    font-size: 0.92rem;
}
.share-modal-rules li { margin: 0.35rem 0; }
.share-expiry-field {
    margin: 0 0 1rem;
}
.share-expiry-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.share-expiry-field input[type="date"] {
    width: 100%;
    font-family: var(--sans);
    font-size: 0.92rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}
.share-modal-warn {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
    padding: 0.75rem 0.9rem;
    background: var(--accent-soft);
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--accent);
}
.share-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.share-result { margin-top: 0; }
.share-success-msg {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.75rem;
    color: #15803d;
    font-size: 0.92rem;
    font-weight: 500;
}
.share-result label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.35rem; }
.share-url-row { display: flex; gap: 0.5rem; }
.share-url-row input {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.82rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}
.share-error {
    margin: 1rem 0 0;
    color: #b42318;
    font-size: 0.9rem;
}

/* ============================================================
   Share viewer (/s/{id})
   ============================================================ */
html.share-view,
html.share-view body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.share-page-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.share-header-bar {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.share-brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
}

.share-brand-link:hover { text-decoration: none; }

.share-cta-btn {
    text-decoration: none;
    white-space: nowrap;
}

.share-cta-btn:hover { text-decoration: none; }

.share-main {
    flex: 1 0 auto;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.share-not-found {
    text-align: center;
    padding-top: 4rem;
}

.share-not-found h1 {
    font-family: var(--serif-display);
    margin-bottom: 0.5rem;
}

.share-doc-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.share-doc-title {
    font-family: var(--serif-display);
    font-size: 1.75rem;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.share-doc-sub { margin: 0; color: var(--muted); font-size: 0.88rem; }

.share-preview {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem 2.2rem;
}

.share-page-body > .app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-shrink: 0;
    margin-top: 0;
}

.share-page-body .share-main {
    padding-bottom: 3.25rem;
}

.share-export-status {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1.1rem;
    background: var(--footer-bg);
    border: 1px solid var(--footer-border);
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--text);
    box-shadow: var(--shadow);
}
.share-export-status[hidden] { display: none !important; }
.share-export-status i { color: var(--footer-accent); }

@media (max-width: 768px) {
    .share-header-bar .header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .share-header-bar .btn span,
    .share-cta-btn span {
        display: none;
    }
    .share-cta-btn { padding: 0.55rem 0.7rem; }
    .share-preview { padding: 1.25rem 1rem; }
}

@media (max-width: 480px) {
    .share-main { padding: 1.25rem 1rem 2rem; }
}
