* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f5f7fa;
    color: #243447;
}
header {
    background: linear-gradient(135deg, #4a6fa5, #1e3c72);
    color: #fff;
    padding: 20px 0;
}
.shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
}
.brand span { color: #ffd166; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #fff; color: #1e3c72; }
.btn-outline { background: transparent; border: 1.5px solid #4a6fa5; color: #4a6fa5; }
.btn-success { background: #2a9d8f; color: #fff; }
.btn-danger { background: #dc3545; color: #fff; }
main { padding: 24px 0 40px; }
.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
    padding: 20px;
    margin-bottom: 20px;
}
h1, h2, h3 { margin: 0 0 12px; color: #1e3c72; }
.muted { color: #6b7a90; }
.info-box {
    background: #e7f3ff;
    border-left: 4px solid #4a6fa5;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #0c5460;
    font-size: 0.92rem;
}
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d7e0ea;
    border-radius: 8px;
    font: inherit;
    background: #fff;
}
.layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
}
.flex-space-between {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.flex-space-start {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}
.flex-center-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.panel-pad-14 {
    padding: 14px;
}
.toolbar-gap-10 {
    margin-bottom: 10px;
}
.input-max-320 {
    min-width: 260px;
    max-width: 320px;
}
.input-max-320-wide {
    max-width: 320px;
}
.status-mt-10 {
    margin-top: 10px;
}
.text-sm-82 {
    font-size: 0.82rem;
}
.text-sm-80 {
    font-size: 0.8rem;
}
.text-sm-600 {
    font-weight: 600;
}
.mb-10 {
    margin-bottom: 10px;
}
.mb-8 {
    margin-bottom: 8px;
}
.mt-8 {
    margin-top: 8px;
}
.line-145 {
    line-height: 1.45;
}
.preview-frame {
    border: 0;
    border-radius: 0;
    height: 420px;
}
.workflow-frame {
    border: 0;
    border-radius: 0;
    height: 460px;
}
.text-preview-tall {
    min-height: 460px;
    max-height: 460px;
}
.section-title-tight {
    margin: 0;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.section-header-start {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.version-title {
    font-weight: 700;
    color: #1e3c72;
}
.version-meta {
    font-size: 0.8rem;
}
.chip-saved {
    background: #d4edda;
    color: #155724;
}
.preview-body {
    margin: 0;
    background: #eef4fb;
}
.preview-body-no-load {
    font-family: Segoe UI, Arial, sans-serif;
    padding: 24px;
    color: #4a5b6e;
}
.preview-body-main {
    margin: 0;
    background: #eef4fb;
}
.panel {
    border: 1px solid #e8edf2;
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}
.template-list {
    display: grid;
    gap: 10px;
}
.template-item {
    border: 1px solid #dfe7ef;
    background: #fff;
    padding: 14px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
}
.template-item.active {
    border-color: #4a6fa5;
    box-shadow: 0 8px 20px rgba(74, 111, 165, 0.14);
}
.template-grid {
    display: grid;
    gap: 14px;
}
.template-textarea {
    min-height: 180px;
    font-family: Consolas, Monaco, monospace;
}
.template-preview {
    width: 100%;
    height: 420px;
    border: 1px solid #dfe7ef;
    border-radius: 12px;
    background: #fff;
}
.preview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}
.preview-card {
    border: 1px solid #dfe7ef;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.preview-card-head {
    padding: 10px 12px;
    background: #f7fbff;
    border-bottom: 1px solid #dfe7ef;
    font-size: 0.84rem;
    font-weight: 800;
    color: #1e3c72;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.text-preview {
    margin: 0;
    min-height: 420px;
    max-height: 420px;
    overflow: auto;
    padding: 14px;
    background: #0f172a;
    color: #e2e8f0;
    font: 13px/1.55 Consolas, Monaco, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}
.workflow-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.workflow-tab {
    border: 1px solid #dfe7ef;
    background: #fff;
    color: #1e3c72;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
}
.workflow-tab.active {
    background: #1e3c72;
    color: #fff;
    border-color: #1e3c72;
}
.workflow-preview-shell {
    border: 1px solid #dfe7ef;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: #1e3c72;
    font-size: 0.8rem;
    font-weight: 700;
}
.versions {
    display: grid;
    gap: 10px;
}
.version-item {
    border: 1px solid #e8edf2;
    border-radius: 12px;
    padding: 12px;
}
.status {
    font-size: 0.92rem;
}
@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; }
    .topbar { justify-content: center; }
    .preview-grid { grid-template-columns: 1fr; }
}
