:root {
    color-scheme: light;
    --bg: #e8ece6;
    --bg-deep: #d9ddd5;
    --panel: rgba(250, 251, 247, 0.92);
    --panel-strong: #fffefa;
    --panel-soft: rgba(241, 243, 236, 0.86);
    --ink: #232b2a;
    --muted: #677170;
    --line: rgba(35, 43, 42, 0.1);
    --line-strong: rgba(35, 43, 42, 0.18);
    --accent: #476a66;
    --accent-strong: #32504d;
    --accent-soft: rgba(71, 106, 102, 0.12);
    --warning: #8d6132;
    --danger: #b64848;
    --success: #2e7656;
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow: 0 24px 56px rgba(73, 82, 74, 0.13);
    --shadow-soft: 0 14px 28px rgba(73, 82, 74, 0.08);
    --ease-soft: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 32%),
        linear-gradient(180deg, #eef1ea 0%, var(--bg) 46%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0, rgba(255, 255, 255, 0.15) 1px, transparent 1px, transparent 96px),
        linear-gradient(rgba(255, 255, 255, 0.12) 0, rgba(255, 255, 255, 0.12) 1px, transparent 1px, transparent 96px);
    opacity: 0.24;
}

body.app-ready .briefing-row,
body.app-ready .minutes-grid,
body.app-ready .notice {
    animation: fadeUp 520ms var(--ease-soft) both;
}

body.app-ready .minutes-grid {
    animation-delay: 70ms;
}

body.is-busy {
    cursor: progress;
}

body.is-modal-open {
    overflow: hidden;
}

.shell {
    width: min(1360px, calc(100% - 40px));
    margin: 24px auto 42px;
    position: relative;
    z-index: 1;
}

.shell > .notice {
    margin-bottom: 24px;
}

.briefing-row,
.signal-card,
.minutes-sheet,
.digest-card,
.panel,
.notice,
.modal-panel,
.result-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255, 253, 248, 0.95) 0%, rgba(244, 245, 238, 0.9) 100%);
    box-shadow: var(--shadow);
}

.briefing-row {
    padding: 34px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.75fr);
    gap: 22px;
    margin-bottom: 24px;
}

.briefing-copy,
.briefing-metrics,
.signal-rail,
.sheet-column,
.digest-rail {
    display: grid;
    gap: 20px;
}

.eyebrow,
.card-kicker,
.metric-label {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(98, 108, 107, 0.8);
}

h1,
.section-head h2,
.modal-head h2,
.result-head h3,
.signal-card h2,
.digest-card strong {
    margin: 0;
    letter-spacing: -0.05em;
}

h1 {
    font-size: 30px;
    line-height: 1.02;
}

.lead,
.section-head p,
.signal-card p,
.digest-card p,
.metric-card p,
.form-note,
.field-note,
.notice p,
.result-copy,
textarea::placeholder,
input[type="text"]::placeholder,
select,
.bullet-list {
    color: var(--muted);
}

.lead {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.74;
}

.metric-card {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-soft);
}

.metric-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
}

.metric-card strong {
    display: block;
    font-size: 1.22rem;
}

.metric-card p {
    margin: 10px 0 0;
    line-height: 1.68;
}

.notice {
    padding: 18px 22px;
    margin-bottom: 24px;
}

.notice strong {
    display: block;
    margin-bottom: 6px;
}

.notice.warning {
    color: var(--warning);
    background: linear-gradient(180deg, rgba(255, 247, 233, 0.96) 0%, rgba(247, 235, 215, 0.9) 100%);
}

.notice.success {
    color: var(--success);
    background: linear-gradient(180deg, rgba(231, 246, 239, 0.96) 0%, rgba(221, 240, 230, 0.9) 100%);
}

.notice.error {
    color: var(--danger);
    background: linear-gradient(180deg, rgba(255, 235, 235, 0.96) 0%, rgba(251, 223, 223, 0.9) 100%);
}

.hidden {
    display: none !important;
}

.minutes-grid {
    display: grid;
    grid-template-columns: minmax(250px, 0.7fr) minmax(0, 1.45fr) minmax(320px, 0.82fr);
    gap: 24px;
    align-items: start;
}

.signal-card,
.minutes-sheet,
.digest-card,
.panel {
    padding: 28px;
}

.signal-card h2,
.section-head h2 {
    font-size: clamp(1.95rem, 2.8vw, 2.55rem);
    line-height: 0.98;
}

.signal-card p,
.section-head p,
.digest-card p {
    margin: 12px 0 0;
    line-height: 1.72;
}

.signal-list {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.signal-list li {
    padding: 14px 16px;
    border: 1px solid rgba(35, 43, 42, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.56);
    line-height: 1.6;
}

.signal-card-accent {
    background: linear-gradient(180deg, rgba(71, 106, 102, 0.96) 0%, rgba(50, 80, 77, 0.94) 100%);
    color: #f7fbfa;
}

.signal-card-accent .card-kicker,
.signal-card-accent p {
    color: rgba(240, 248, 246, 0.82);
}

.minutes-sheet {
    background: linear-gradient(180deg, rgba(255, 254, 250, 0.97) 0%, rgba(243, 245, 237, 0.92) 100%);
}

.section-head {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.section-head.compact h2 {
    font-size: 1.7rem;
}

.cleaner-form {
    display: grid;
    gap: 20px;
}

.field {
    display: grid;
    gap: 10px;
}

.field > span {
    font-size: 0.94rem;
    font-weight: 800;
}

.field-note {
    font-size: 0.88rem;
    line-height: 1.5;
}

.field-lg textarea {
    min-height: 280px;
}

.control-strip,
.grid-two {
    display: grid;
    gap: 18px;
}

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

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

textarea,
input[type="text"],
select {
    width: 100%;
    min-height: 58px;
    padding: 17px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font: inherit;
    transition: border-color 160ms var(--ease-soft), box-shadow 160ms var(--ease-soft), transform 160ms var(--ease-soft), background 160ms var(--ease-soft);
}

textarea {
    resize: vertical;
    line-height: 1.66;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: rgba(71, 106, 102, 0.42);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.94),
        0 0 0 4px rgba(71, 106, 102, 0.1);
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.94);
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: transform 180ms var(--ease-soft), box-shadow 180ms var(--ease-soft), background 180ms var(--ease-soft), opacity 180ms var(--ease-soft);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#clean-button,
.copy-button {
    color: #f8fbfb;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 14px 26px rgba(50, 80, 77, 0.22);
}

.ghost-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
}

.sheet-actions {
    display: grid;
    gap: 14px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.form-note {
    margin: 0;
    font-size: 0.93rem;
    line-height: 1.62;
}

.digest-card {
    display: grid;
    gap: 8px;
    background: linear-gradient(180deg, rgba(254, 253, 249, 0.98) 0%, rgba(241, 243, 235, 0.92) 100%);
}

.digest-card strong {
    font-size: 1.74rem;
    line-height: 1.02;
}

.digest-card-muted {
    background: linear-gradient(180deg, rgba(237, 239, 232, 0.96) 0%, rgba(229, 233, 225, 0.92) 100%);
}

.ad-shell {
    display: grid;
    gap: 20px;
}

.ad-slot,
.ad-placeholder {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 250, 244, 0.8);
}

.ad-placeholder {
    padding: 12px;
}

.ad-mockup {
    position: relative;
    overflow: hidden;
    min-height: 420px;
    border-radius: 22px;
    border: 1px solid rgba(71, 106, 102, 0.12);
    background: linear-gradient(180deg, rgba(252, 253, 249, 0.94) 0%, rgba(236, 240, 232, 0.94) 100%);
}

.ad-mockup-top,
.ad-mockup-media,
.ad-mockup-lines span {
    position: absolute;
    left: 18px;
    right: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.34);
}

.ad-mockup-top {
    top: 18px;
    width: 34%;
    right: auto;
    height: 34px;
}

.ad-mockup-media {
    top: 92px;
    height: 150px;
}

.ad-mockup-lines {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 22px;
    display: grid;
    gap: 12px;
}

.ad-mockup-lines span:first-child,
.ad-mockup-lines span:last-child {
    position: static;
    height: 18px;
}

.ad-mockup-lines span:first-child {
    width: 62%;
    background: rgba(71, 106, 102, 0.16);
}

.ad-mockup-lines span:last-child {
    width: 44%;
    background: rgba(71, 106, 102, 0.11);
}

.ad-mockup-badge {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    width: 184px;
    height: 184px;
    margin: auto;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(71, 106, 102, 0.96) 0%, rgba(50, 80, 77, 0.96) 100%);
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 30;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(23, 28, 27, 0.54);
    backdrop-filter: blur(12px);
}

.modal-panel {
    position: relative;
    width: min(1080px, 100%);
    max-height: min(88vh, 980px);
    overflow: auto;
    padding: 28px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.modal-head p {
    margin: 10px 0 0;
    line-height: 1.7;
}

.result-stack {
    display: grid;
    gap: 18px;
}

.result-card {
    padding: 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 254, 251, 0.98) 0%, rgba(242, 245, 238, 0.94) 100%);
    box-shadow: var(--shadow-soft);
}

.result-card-primary {
    background: linear-gradient(180deg, rgba(246, 250, 247, 0.98) 0%, rgba(231, 240, 235, 0.94) 100%);
}

.result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.result-head h3 {
    font-size: 1.34rem;
}

.result-copy {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.72;
}

.bullet-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.copy-button.is-copied {
    background: linear-gradient(180deg, #3b8a64 0%, #2d6a4b 100%);
}

.notice.is-visible,
.result-stack.is-entering,
.modal.is-visible .modal-panel {
    animation: fadeUp 360ms var(--ease-soft) both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1160px) {
    .minutes-grid {
        grid-template-columns: 1fr;
    }

    .digest-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .ad-shell {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .briefing-row,
    .control-strip,
    .grid-two,
    .digest-rail,
    .modal-head,
    .result-head {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .briefing-row,
    .signal-card,
    .minutes-sheet,
    .digest-card,
    .panel,
    .modal-panel {
        padding: 22px;
    }

    .action-row {
        align-items: stretch;
    }

    button,
    .ghost-button,
    #clean-button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 20px, 100%);
        margin: 16px auto 24px;
    }

    .field-lg textarea {
        min-height: 220px;
    }
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 54px;
    background-image:
        linear-gradient(45deg, transparent 50%, #6f7784 50%),
        linear-gradient(135deg, #6f7784 50%, transparent 50%);
    background-position:
        calc(100% - 24px) calc(50% - 3px),
        calc(100% - 18px) calc(50% - 3px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
    cursor: pointer;
}
