:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #070d18;
    color: #e2e8f0;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    background: radial-gradient(circle at 12% 8%, rgba(14, 165, 233, 0.16), transparent 26rem), radial-gradient(circle at 88% 18%, rgba(99, 102, 241, 0.13), transparent 30rem), #070d18;
}

button, select, textarea { font: inherit; }
h1, h2, p { margin-top: 0; }

h1 {
    color: #f8fafc;
    font-size: clamp(2.3rem, 5vw, 4.8rem);
    letter-spacing: -0.055em;
    line-height: 0.98;
    margin-bottom: 1rem;
    max-width: 850px;
}

h2 { color: #f8fafc; letter-spacing: -0.025em; }

.hero, .review-heading {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 3rem;
}

.hero p { color: #94a3b8; font-size: 1.08rem; line-height: 1.65; max-width: 700px; }

.eyebrow {
    color: #38bdf8;
    display: block;
    font-size: 0.73rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.queue-stat {
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    min-width: 170px;
    padding: 1.4rem;
    text-align: right;
}

.queue-stat strong, .queue-stat span { display: block; }
.queue-stat strong { color: #7dd3fc; font-size: 2.3rem; }
.queue-stat span { color: #94a3b8; font-size: 0.78rem; }

.draft-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

.draft-card, .panel, .empty-state {
    background: linear-gradient(155deg, rgba(19, 30, 49, 0.9), rgba(10, 18, 32, 0.94));
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 24px;
    box-shadow: 0 28px 70px rgba(2, 6, 23, 0.24);
}

.draft-card { display: flex; flex-direction: column; min-height: 310px; padding: 1.4rem; }
.draft-card h2 { font-size: 1.35rem; margin: 1.4rem 0 0.6rem; }
.card-topline, .panel-heading { align-items: center; display: flex; justify-content: space-between; gap: 1rem; }
.card-topline time, .source, .source-link, .approval-copy { color: #94a3b8; font-size: 0.78rem; }
.source { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.draft-card dl { border-top: 1px solid rgba(148, 163, 184, 0.12); display: grid; gap: 0.55rem; margin: auto 0 1.2rem; padding-top: 1rem; }
.draft-card dl div { display: flex; justify-content: space-between; }
.draft-card dt { color: #64748b; }
.draft-card dd { color: #cbd5e1; font-family: "SFMono-Regular", Consolas, monospace; margin: 0; }

.status { border: 1px solid currentColor; border-radius: 999px; display: inline-flex; font-size: 0.7rem; font-weight: 700; padding: 0.35rem 0.62rem; text-transform: uppercase; }
.status-pendingreview { color: #fbbf24; background: rgba(251, 191, 36, 0.08); }
.status-pushinprogress { color: #38bdf8; background: rgba(56, 189, 248, 0.08); }
.status-pushfailed { color: #fb7185; background: rgba(251, 113, 133, 0.08); }
.status-stored { color: #4ade80; background: rgba(74, 222, 128, 0.08); }

.button {
    align-items: center;
    border-radius: 13px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 44px;
    padding: 0.7rem 1rem;
    text-decoration: none;
    transition: transform 140ms ease, opacity 140ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.42; }
.button.primary { background: linear-gradient(135deg, #0ea5e9, #4f46e5); border: 0; color: white; }
.button.secondary { background: rgba(148, 163, 184, 0.08); border: 1px solid rgba(148, 163, 184, 0.22); color: #e2e8f0; }
.button.full { width: 100%; }

.review-heading h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
.back-link, .source-link { display: inline-block; margin-bottom: 2rem; text-decoration: none; }
.back-link { color: #94a3b8; }
.source-link { color: #7dd3fc; margin-bottom: 0; }
.review-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(290px, 380px); }
.panel { padding: 1.5rem; }
.preview-panel { min-height: 520px; }

.view-switcher {
    background: rgba(8, 15, 27, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 13px;
    display: flex;
    padding: 0.2rem;
}

.view-tab {
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    min-height: 36px;
    padding: 0.45rem 0.75rem;
}

.view-tab.selected { background: rgba(56, 189, 248, 0.12); color: #e0f2fe; }

.markdown-rendered,
.markdown-editor {
    background: #050a12;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    line-height: 1.7;
    margin: 1.5rem 0 0;
    max-height: 680px;
    overflow: auto;
    padding: 1.35rem;
}

.markdown-rendered { color: #cbd5e1; overflow-wrap: anywhere; }
.markdown-rendered h1 { font-size: 2.1rem; letter-spacing: -0.035em; line-height: 1.12; }
.markdown-rendered h2 { border-bottom: 1px solid rgba(148, 163, 184, 0.16); font-size: 1.45rem; margin-top: 2.2rem; padding-bottom: 0.5rem; }
.markdown-rendered h3 { color: #e2e8f0; margin-top: 1.7rem; }
.markdown-rendered a { color: #7dd3fc; }
.markdown-rendered blockquote { border-left: 3px solid #38bdf8; color: #94a3b8; margin-left: 0; padding-left: 1rem; }
.markdown-rendered code { background: rgba(148, 163, 184, 0.12); border-radius: 5px; padding: 0.15rem 0.35rem; }
.markdown-rendered pre { background: #020617; border-radius: 10px; overflow: auto; padding: 1rem; }
.markdown-rendered pre code { background: transparent; padding: 0; }
.markdown-rendered table { border-collapse: collapse; display: block; overflow-x: auto; width: 100%; }
.markdown-rendered th, .markdown-rendered td { border: 1px solid rgba(148, 163, 184, 0.2); padding: 0.55rem 0.7rem; text-align: left; }
.markdown-rendered th { background: rgba(148, 163, 184, 0.09); color: #f8fafc; }

.markdown-editor label { color: #cbd5e1; display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 0.65rem; }
.markdown-editor textarea {
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 11px;
    color: #dbeafe;
    font-family: "SFMono-Regular", Consolas, monospace;
    line-height: 1.6;
    min-height: 480px;
    padding: 1rem;
    resize: vertical;
    width: 100%;
}
.markdown-editor textarea:focus { border-color: #38bdf8; outline: 2px solid rgba(56, 189, 248, 0.18); }
.markdown-editor textarea[readonly] { color: #94a3b8; }
.editor-footer { align-items: center; color: #94a3b8; display: flex; font-size: 0.78rem; gap: 1rem; justify-content: space-between; margin-top: 0.8rem; }
.editor-actions { display: flex; gap: 0.6rem; }

.preview-placeholder, .empty-state, .stored-result {
    align-items: center;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
    min-height: 330px;
    text-align: center;
}

.preview-placeholder strong, .empty-state strong, .stored-result strong { color: #e2e8f0; }
.commit-panel label { color: #cbd5e1; display: block; font-size: 0.82rem; font-weight: 700; margin: 2rem 0 0.55rem; }

.commit-panel select {
    background: #0b1423;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 12px;
    color: #f8fafc;
    min-height: 46px;
    padding: 0 0.8rem;
    width: 100%;
}

.approval-copy { line-height: 1.55; margin: 1rem 0; }
.stored-result { min-height: 300px; }

.provider-picker {
    display: grid;
    gap: 0.65rem;
    margin: 1.25rem 0;
}

.provider-card {
    background: rgba(8, 15, 27, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 15px;
    color: #e2e8f0;
    cursor: pointer;
    padding: 0.9rem 1rem;
    text-align: left;
}

.provider-card:hover,
.provider-card.selected {
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.provider-card.selected {
    background: rgba(14, 165, 233, 0.09);
}

.provider-card strong,
.provider-card span {
    display: block;
}

.provider-card span,
.provider-action p,
.provider-note {
    color: #94a3b8;
    font-size: 0.8rem;
    line-height: 1.5;
}

.provider-card span { margin-top: 0.2rem; }
.provider-action { border-top: 1px solid rgba(148, 163, 184, 0.12); padding-top: 1rem; }
.provider-note { border-top: 1px solid rgba(148, 163, 184, 0.12); margin: 1.25rem 0 0; padding-top: 1rem; }

.stored-result .check {
    align-items: center;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.35);
    border-radius: 50%;
    color: #4ade80;
    display: flex;
    font-size: 1.6rem;
    height: 58px;
    justify-content: center;
    width: 58px;
}

.stored-result code { color: #94a3b8; overflow-wrap: anywhere; }
.alert { border-radius: 14px; line-height: 1.5; margin: 1rem 0; padding: 0.9rem 1rem; }
.alert.error { background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(251, 113, 133, 0.3); color: #fecdd3; }
.alert.success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(74, 222, 128, 0.3); color: #bbf7d0; }

@media (max-width: 850px) {
    .hero, .review-heading { align-items: flex-start; flex-direction: column; }
    .queue-stat { text-align: left; }
    .review-layout { grid-template-columns: 1fr; }
    .panel-heading, .editor-footer { align-items: stretch; flex-direction: column; }
    .view-switcher, .editor-actions { width: 100%; }
    .view-tab, .editor-actions .button { flex: 1; }
}

h1:focus { outline: none; }
