:root {
    --red: #E31E24;
    --red-dark: #b91519;
    --red-light: #fdecea;
    --charcoal: #2D3748;
    --charcoal-light: #4a5568;
    --bg: #f4f5f7;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #2D3748;
    --muted: #718096;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* ── Header ── */
.header {
    background: var(--charcoal);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header img {
    height: 56px;
    width: auto;
}
.header-title {
    display: flex;
    flex-direction: column;
}
.header-title span:first-child {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.1;
}
.header-title span:first-child em {
    color: var(--red);
    font-style: normal;
}
.header-title span:last-child {
    font-size: .75rem;
    color: #a0aec0;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ── Layout ── */
.page {
    max-width: 860px;
    margin: 2rem auto;
    padding: 0 1rem 4rem;
}

/* ── Cards ── */
.card {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    margin-bottom: 1.25rem;
}
.card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--charcoal);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.1em;
    background: var(--red);
    border-radius: 2px;
}

/* ── Labels & textareas ── */
label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .4rem;
}
textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .9em;
    transition: border-color .2s;
    resize: vertical;
    font-family: inherit;
}
textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(227,30,36,.1);
}
#inputText  { height: 180px; }
#outputJson {
    height: 380px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: .82em;
    background: #f9fafb;
}
#outputJson.error { color: #c53030; background: #fff5f5; border-color: #fc8181; }
#outputJson.valid { background: #f0fff4; border-color: #68d391; }

/* ── Buttons ── */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.25rem;
    font-size: .9rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, transform .1s, opacity .15s;
    font-family: inherit;
    white-space: nowrap;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--red);
    color: #fff;
    width: 100%;
    padding: .8rem;
    font-size: 1rem;
    margin-bottom: .75rem;
}
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }

.btn-warning {
    background: #fef3c7;
    color: #92400e;
    flex: 1;
}
.btn-warning:hover:not(:disabled) { background: #fcd34d; }

.btn-success {
    background: #2D3748;
    color: #fff;
    flex: 1;
}
.btn-success:hover:not(:disabled) { background: #1a202c; }




.button-group {
    display: flex;
    gap: .75rem;
    margin-bottom: .75rem;
}

/* ── Messages ── */
.validation-message {
    padding: 10px 14px;
    margin-bottom: .75rem;
    border-radius: 8px;
    font-size: .88rem;
    display: none;
}
.validation-message.success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #276749;
    display: block;
}
.validation-message.error {
    background: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
    display: block;
}


/* ── Responsive ── */
@media (max-width: 520px) {
    .header { padding: 1rem; }
    .header img { height: 42px; }
    .button-group { flex-direction: column; }
    .button-group button { width: 100%; }
    .email-row { flex-direction: column; }
    .email-row button { width: 100%; }
}
