:root {
    --ink: #10231d;
    --ink-2: #1e352d;
    --muted: #6c7a74;
    --line: #dfe8e3;
    --paper: #ffffff;
    --wash: #f5f8f6;
    --green: #0f7b55;
    --green-2: #0b5f49;
    --green-soft: #e8f5ef;
    --blue: #2d72d9;
    --blue-soft: #eaf2ff;
    --amber: #d89213;
    --amber-soft: #fff4dd;
    --rose: #c83b55;
    --shadow: 0 18px 50px rgba(16, 35, 29, .12);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--wash);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 76px;
    padding: 14px clamp(16px, 3vw, 40px);
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.brand-lockup,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup small,
.planner-heading p,
.visual-caption span,
.draft-kicker,
.save-nudge span {
    color: var(--muted);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--green);
    box-shadow: 0 10px 24px rgba(15, 123, 85, .22);
}

.brand-lockup strong {
    display: block;
    font-size: 15px;
}

.brand-lockup small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}

.text-link {
    color: var(--green-2);
    font-weight: 700;
}

.outline-button,
.primary-button,
.ghost-button,
.icon-button {
    border: 0;
    border-radius: 8px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.outline-button {
    padding: 0 16px;
    color: var(--green-2);
    background: #fff;
    border: 1px solid var(--line);
}

.primary-button {
    padding: 0 18px;
    color: #fff;
    background: var(--green);
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(15, 123, 85, .22);
}

.primary-button:hover,
.outline-button:hover,
.ghost-button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.primary-button:hover {
    background: var(--green-2);
}

.primary-button.compact {
    min-height: 38px;
    padding: 0 14px;
    white-space: nowrap;
}

.ghost-button {
    padding: 0 16px;
    color: var(--ink-2);
    background: #f2f6f4;
    border: 1px solid var(--line);
}

.icon-button {
    width: 42px;
    padding: 0;
    color: var(--ink-2);
    background: #fff;
    border: 1px solid var(--line);
}

.icon-button:disabled {
    color: #9ca9a3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.instant-planner {
    display: grid;
    grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr);
    min-height: calc(100vh - 76px);
}

.planner-visual {
    position: sticky;
    top: 76px;
    height: calc(100vh - 76px);
    min-height: 640px;
    overflow: hidden;
    background: var(--ink);
}

.planner-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.planner-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(5, 18, 14, .04), rgba(5, 18, 14, .74));
}

.visual-caption {
    position: absolute;
    right: clamp(18px, 3vw, 38px);
    left: clamp(18px, 3vw, 38px);
    bottom: clamp(18px, 4vh, 42px);
    z-index: 1;
    color: #fff;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    background: rgba(9, 34, 27, .54);
    backdrop-filter: blur(10px);
}

.visual-caption span {
    display: block;
    margin-bottom: 8px;
    color: #cfddd7;
    font-size: 13px;
}

.visual-caption strong {
    display: block;
    font-size: clamp(18px, 2vw, 26px);
    line-height: 1.55;
}

.planner-workspace {
    padding: clamp(22px, 4vw, 46px);
}

.planner-heading {
    max-width: 780px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--green-2);
    font-weight: 800;
}

.planner-heading h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(30px, 5vw, 58px);
    line-height: 1.12;
}

.planner-heading p:not(.eyebrow) {
    margin: 14px 0 0;
    max-width: 660px;
    font-size: 17px;
    line-height: 1.8;
}

.planner-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, .86fr);
    gap: 18px;
    align-items: start;
}

.planner-panel,
.draft-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.planner-panel {
    padding: 18px;
}

.step-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.step-tab {
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 800;
}

.step-tab.is-active {
    color: var(--green-2);
    background: var(--green-soft);
    border-color: #b8ddcf;
}

.step-panel {
    display: none;
}

.step-panel.is-active {
    display: block;
}

.field-grid {
    display: grid;
    gap: 12px;
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
}

.field span,
.choice-group legend,
.toggle-grid legend {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 800;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    outline: none;
}

.field textarea {
    resize: vertical;
    line-height: 1.75;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 123, 85, .1);
    background: #fff;
}

.choice-group,
.toggle-grid {
    margin: 0 0 14px;
    padding: 0;
    border: 0;
}

.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice-group legend,
.toggle-grid legend {
    width: 100%;
    margin-bottom: 8px;
}

.choice-group label {
    position: relative;
}

.choice-group input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-group span {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.choice-group input:checked + span {
    color: var(--green-2);
    background: var(--green-soft);
    border-color: #b8ddcf;
    font-weight: 800;
}

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.switch-field {
    min-height: 48px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.switch-field input {
    width: 42px;
    height: 22px;
    appearance: none;
    border-radius: 999px;
    background: #cfd9d4;
    position: relative;
    cursor: pointer;
    transition: background .18s ease;
}

.switch-field input::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    right: 2px;
    transition: transform .18s ease;
}

.switch-field input:checked {
    background: var(--green);
}

.switch-field input:checked::before {
    transform: translateX(-20px);
}

.step-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 14px;
}

.step-actions.split {
    justify-content: space-between;
}

.generate-button {
    min-width: 190px;
}

.draft-panel {
    position: sticky;
    top: 96px;
    overflow: hidden;
}

.draft-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: #fbfdfc;
}

.draft-toolbar h2 {
    margin: 4px 0 0;
    font-size: 20px;
}

.draft-kicker {
    font-size: 12px;
    font-weight: 800;
}

.tool-buttons {
    display: flex;
    gap: 8px;
}

.draft-empty {
    min-height: 430px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    padding: 30px;
    text-align: center;
    color: var(--muted);
}

.draft-empty i {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    color: var(--green-2);
    background: var(--green-soft);
    border-radius: 8px;
    font-size: 30px;
}

.draft-empty p {
    max-width: 320px;
    margin: 0;
    line-height: 1.8;
}

.draft-content {
    max-height: 68vh;
    overflow: auto;
    padding: 18px;
}

.draft-summary {
    display: grid;
    gap: 8px;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #bfded1;
    border-radius: 8px;
    background: var(--green-soft);
}

.draft-summary h3 {
    margin: 0;
    font-size: 20px;
}

.draft-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.draft-meta span {
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--ink-2);
    background: #fff;
    border: 1px solid #cfebe0;
    font-size: 12px;
    font-weight: 800;
}

.draft-section {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.draft-section:last-child {
    border-bottom: 0;
}

.draft-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 9px;
    font-size: 16px;
}

.draft-section h4 i {
    color: var(--blue);
}

.draft-section ul,
.draft-section ol {
    margin: 0;
    padding-right: 20px;
    line-height: 1.9;
}

.draft-section p {
    margin: 0;
    line-height: 1.9;
}

.save-nudge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-top: 1px solid #f0d89d;
    background: var(--amber-soft);
}

.save-nudge strong,
.save-nudge span {
    display: block;
}

.save-nudge span {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.6;
}

.toast-note {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: 50;
    padding: 12px 14px;
    color: #fff;
    background: var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateY(16px);
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
}

.toast-note.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.is-invalid-field {
    border-color: var(--rose) !important;
    box-shadow: 0 0 0 3px rgba(200, 59, 85, .12) !important;
}

@media (max-width: 1180px) {
    .instant-planner,
    .planner-grid {
        grid-template-columns: 1fr;
    }

    .planner-workspace {
        order: 1;
    }

    .planner-visual,
    .draft-panel {
        position: relative;
        top: auto;
    }

    .planner-visual {
        min-height: 300px;
        height: 34vh;
        order: 2;
    }

    .draft-content {
        max-height: none;
    }
}

@media (max-width: 760px) {
    .site-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .planner-workspace {
        padding: 18px 12px 28px;
    }

    .planner-heading h1 {
        font-size: 34px;
    }

    .two-columns,
    .three-columns,
    .toggle-grid,
    .step-tabs {
        grid-template-columns: 1fr;
    }

    .step-tab {
        justify-content: flex-start;
        padding: 0 14px;
    }

    .step-actions,
    .step-actions.split,
    .save-nudge {
        flex-direction: column;
        align-items: stretch;
    }

    .primary-button,
    .ghost-button,
    .outline-button {
        width: 100%;
    }
}

@media print {
    .site-topbar,
    .planner-visual,
    .planner-heading,
    .planner-panel,
    .draft-toolbar,
    .save-nudge {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .instant-planner,
    .planner-grid {
        display: block;
    }

    .planner-workspace,
    .draft-panel,
    .draft-content {
        padding: 0;
        border: 0;
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }
}
