:root {
    --ink: #183024;
    --ink-soft: #51695d;
    --paper: #f8f4ea;
    --surface: rgba(255, 252, 245, 0.9);
    --line: rgba(24, 48, 36, 0.12);
    --accent: #d96c2d;
    --accent-deep: #a84b17;
    --good: #2f7d4b;
    --warn: #c97915;
    --bad: #b44848;
    --shadow: 0 22px 45px rgba(24, 48, 36, 0.10);
}

* { box-sizing: border-box; }

body,
body *,
input,
button,
select,
textarea,
option,
code,
pre,
.mono,
svg text,
svg tspan {
    font-family: "Segoe UI", sans-serif !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(217, 108, 45, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(47, 125, 75, 0.14), transparent 30%),
        linear-gradient(180deg, #efe7d6 0%, #f7f4ec 32%, #fdfbf7 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(24, 48, 36, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 48, 36, 0.025) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 85%);
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 48px;
    position: relative;
}

.hero, .panel {
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 28px;
    color: #f7f4ec;
    background: linear-gradient(135deg, rgba(24, 48, 36, 0.95), rgba(39, 78, 61, 0.94));
}

.eyebrow {
    margin-bottom: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.74rem;
    opacity: 0.78;
}

h1, h2, h3 {
    margin: 0;
    font-family: "Segoe UI", sans-serif;
    line-height: 1.08;
}

h1 { font-size: clamp(2rem, 4vw, 3.2rem); max-width: 12ch; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.1rem; }

.hero p, .panel-head p, .muted {
    line-height: 1.5;
    color: var(--ink-soft);
}

.hero p { color: rgba(247, 244, 236, 0.86); max-width: 62ch; margin-top: 14px; }

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.hero-chips span, .badge {
    display: inline-flex;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero-chips span {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.layout {
    display: grid;
    grid-template-columns: 1.04fr 0.96fr;
    gap: 18px;
    margin-top: 18px;
}

.panel {
    background: var(--surface);
    border: 1px solid rgba(24, 48, 36, 0.08);
    padding: 22px;
    backdrop-filter: blur(10px);
}

.stack, .list { display: grid; gap: 14px; }
.subsection { display: grid; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; }
.panel-head p { margin: 6px 0 0; }

label {
    display: grid;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

input, textarea, button {
    font: inherit;
}

input, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
}

textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus {
    outline: 2px solid rgba(217, 108, 45, 0.2);
    border-color: rgba(217, 108, 45, 0.5);
}

button {
    cursor: pointer;
    padding: 12px 18px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    box-shadow: 0 14px 28px rgba(168, 75, 23, 0.24);
}

.secondary {
    color: var(--ink);
    background: rgba(24, 48, 36, 0.08);
    border: 1px solid rgba(24, 48, 36, 0.12);
}

.banner, .card, .metric, .empty, .prompt {
    border-radius: 18px;
}

.banner {
    padding: 14px 16px;
    background: rgba(24, 48, 36, 0.06);
}

.banner.good, .badge.completed, .badge.mapped, .badge.applied, .badge.info, .badge.ok {
    background: rgba(47, 125, 75, 0.14);
    color: var(--good);
}

.banner.warn, .badge.pending_user_input, .badge.processing, .badge.warning, .badge.completed_with_errors {
    background: rgba(201, 121, 21, 0.16);
    color: var(--warn);
}

.banner.bad, .badge.failed, .badge.error {
    background: rgba(180, 72, 72, 0.16);
    color: var(--bad);
}

.summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.metric, .card, .prompt {
    padding: 14px;
    border: 1px solid rgba(24, 48, 36, 0.08);
    background: rgba(255, 255, 255, 0.78);
}

.metric .label {
    font-size: 0.78rem;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric .value {
    margin-top: 8px;
    font-size: 1.8rem;
    font-weight: 700;
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.card small, .prompt small { display: block; line-height: 1.45; color: var(--ink-soft); }
.history-item { cursor: pointer; }
.history-item:hover { border-color: rgba(217, 108, 45, 0.28); background: rgba(217, 108, 45, 0.05); }
.empty {
    padding: 18px;
    border: 1px dashed rgba(24, 48, 36, 0.18);
    background: rgba(255, 255, 255, 0.45);
    color: var(--ink-soft);
}

.mono, code {
    font-family: "Segoe UI", sans-serif;
    word-break: break-word;
}

@media (max-width: 960px) {
    .layout, .summary { grid-template-columns: 1fr; }
    .page { width: min(100% - 20px, 1180px); }
    .hero, .panel { padding: 18px; }
}
