/* ── MarkdownView ─────────────────────────────────────────────────────── */
.md-view {
    line-height: 1.65;
}
.md-view h1, .md-view h2, .md-view h3,
.md-view h4, .md-view h5, .md-view h6 {
    color: var(--md-heading-color, #C9A227);
    margin: 1.2em 0 0.4em;
    line-height: 1.25;
}
.md-view h1 { font-size: 1.75em; }
.md-view h2 { font-size: 1.4em; }
.md-view h3 { font-size: 1.2em; }
.md-view h4, .md-view h5, .md-view h6 { font-size: 1.05em; }
.md-view p { margin: 0 0 0.8em; }
.md-view a {
    color: var(--md-link-color, #335AFF);
    text-decoration: underline;
}
.md-view a:hover { opacity: 0.8; }
.md-view ul, .md-view ol {
    padding-left: 1.4em;
    margin-bottom: 0.8em;
}
.md-view li { margin-bottom: 0.2em; }
.md-view blockquote {
    border-left: 3px solid var(--md-heading-color, #C9A227);
    margin: 0.6em 0;
    padding: 0.4em 1em;
    opacity: 0.85;
}
.md-view pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 0.9em 1.1em;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.88em;
    margin-bottom: 0.8em;
}
.md-view code {
    background: rgba(0,0,0,0.07);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    font-size: 0.88em;
}
.md-view pre code {
    background: transparent;
    padding: 0;
    font-size: inherit;
}
.md-view hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.15);
    margin: 1em 0;
}
.md-view table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 0.8em;
    font-size: 0.9em;
}
.md-view th {
    background: rgba(201,162,39,0.12);
    color: var(--md-heading-color, #C9A227);
    font-weight: 600;
    padding: 0.5em 0.8em;
    text-align: left;
    border-bottom: 2px solid var(--md-heading-color, #C9A227);
}
.md-view td {
    padding: 0.45em 0.8em;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.md-view tr:nth-child(even) td {
    background: rgba(0,0,0,0.025);
}

/* ── MarkdownEditor ───────────────────────────────────────────────────── */
.md-editor {
    display: flex;
    flex-direction: column;
}
.md-editor__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 4px 8px;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.1);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    gap: 8px;
}
.md-editor__labels {
    display: flex;
    gap: 0;
    flex: 1;
}
.md-editor__label {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 4px;
}
.md-editor__label:last-child {
    padding-left: 12px;
    border-left: 1px solid rgba(0,0,0,0.1);
}
.md-editor__actions {
    display: flex;
    gap: 4px;
}
.md-editor__btn {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--md-link-color, #335AFF);
    line-height: 1.6;
    transition: background 0.15s;
}
.md-editor__btn:hover { background: rgba(51,90,255,0.06); }
.md-editor__btn--italic { font-style: italic; }
.md-editor__body {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: row;
}
.md-editor__pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.md-editor__divider {
    width: 1px;
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.md-editor__pane--preview {
    padding: 12px;
    overflow-y: auto;
}
/* Stale dot on preview label while debounce is pending */
.md-editor[data-stale] .md-editor__label:last-child::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #C9A227;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0.8;
}
.md-editor__textarea {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    padding: 12px;
    font-size: 14px;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    line-height: 1.6;
    background: transparent;
    color: inherit;
}
@media (max-width: 600px) {
    .md-editor__body { flex-direction: column; }
    .md-editor__divider { width: auto; height: 1px; }
    .md-editor__labels { display: none; }
}
