:root {
    --ink: #162033;
    --muted: #647089;
    --line: #dfe5ec;
    --surface: #ffffff;
    --canvas: #f3f6f8;
    --primary: #0e7c66;
    --primary-dark: #095f50;
    --primary-soft: #e8f6f2;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --warning: #9a6700;
    --warning-soft: #fff8df;
    --success: #117a52;
    --success-soft: #eaf8f1;
    --shadow: 0 20px 60px rgba(24, 38, 59, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); font-size: 16px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.topbar { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.topbar-inner { max-width: 1240px; min-height: 68px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.brand-row { display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; color: white; background: linear-gradient(145deg, #11a581, #08624f); box-shadow: 0 7px 20px rgba(14,124,102,.22); font-size: 14px; letter-spacing: .04em; }

.workspace { max-width: 1240px; margin: 0 auto; padding: 44px 24px 72px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.intro h1 { margin: 2px 0 0; font-size: clamp(30px, 5vw, 44px); line-height: 1.05; letter-spacing: -.045em; }
.eyebrow { margin: 0; color: var(--primary); font-size: 13px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.domain-chip { display: flex; align-items: center; gap: 9px; border: 1px solid #cfe6df; background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 9px 14px; font-weight: 700; white-space: nowrap; }
.domain-chip span { width: 8px; height: 8px; border-radius: 50%; background: #16a373; box-shadow: 0 0 0 4px rgba(22,163,115,.12); }

.compose-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); gap: 22px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 28px; }
.section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 25px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.step { flex: 0 0 auto; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: var(--primary-dark); background: var(--primary-soft); font-weight: 850; }

.form-stack, .compose-panel, .recipients-panel { display: flex; flex-direction: column; gap: 19px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: flex; flex-direction: column; gap: 7px; font-weight: 700; font-size: 14px; color: #27334a; }
input, textarea { width: 100%; border: 1px solid #cbd4df; border-radius: 12px; color: var(--ink); background: #fbfcfd; padding: 12px 14px; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
input { min-height: 46px; }
textarea { resize: vertical; min-height: 126px; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(14,124,102,.11); }
.field-hint { align-self: flex-end; color: var(--muted); font-size: 12px; font-weight: 550; }
.recipient-label textarea { min-height: 272px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.recipient-summary { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; padding: 13px 15px; border-radius: 13px; background: #f5f7fa; border: 1px solid #e4e9ef; }
.recipient-summary strong { color: var(--primary); font-size: 25px; line-height: 1; }
.recipient-summary span { font-weight: 700; font-size: 14px; }
.recipient-summary small { grid-column: 2; color: var(--muted); }
.check-row { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--muted); font-weight: 550; line-height: 1.45; }
.check-row input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; accent-color: var(--primary); }

.button { border: 0; border-radius: 12px; min-height: 44px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; transition: transform .16s, background .16s, opacity .16s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { color: white; background: var(--primary); box-shadow: 0 9px 22px rgba(14,124,102,.18); }
.button-primary:hover { background: var(--primary-dark); }
.button-quiet { background: #eef2f5; color: #334058; }
.button-send { min-height: 58px; flex-direction: column; }
.button-send small { font-size: 11px; font-weight: 600; opacity: .82; }

.alert { margin: 0 0 20px; border: 1px solid; border-radius: 14px; padding: 13px 16px; font-weight: 650; }
.alert-error { color: var(--danger); background: var(--danger-soft); border-color: #f3c7c2; }
.alert-warning { color: var(--warning); background: var(--warning-soft); border-color: #eadc9b; }
.alert-success { color: var(--success); background: var(--success-soft); border-color: #b9e4ce; }
.failure-box { margin: -7px 0 22px; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px 16px; }
.failure-box summary { cursor: pointer; font-weight: 750; }
.failure-box ul { margin: 12px 0 0; padding: 0; list-style: none; }
.failure-box li { display: grid; gap: 2px; border-top: 1px solid var(--line); padding: 9px 0; }
.failure-box li span { color: var(--muted); font-size: 13px; }

.login-shell, .setup-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #dcf3ed 0, transparent 34%), var(--canvas); }
.login-card, .setup-card { width: min(100%, 430px); background: white; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 34px; }
.login-card .brand-row { margin-bottom: 32px; }
.login-card h1, .setup-card h1 { margin: 0; font-size: 31px; letter-spacing: -.04em; }
.muted, .setup-card p { color: var(--muted); margin: 8px 0 25px; }

@media (max-width: 880px) {
    .compose-grid { grid-template-columns: 1fr; }
    .recipients-panel { order: 2; }
}

@media (max-width: 620px) {
    .topbar-inner { padding: 0 16px; }
    .workspace { padding: 29px 16px 52px; }
    .intro { align-items: flex-start; flex-direction: column; }
    .intro h1 { font-size: 34px; }
    .panel { padding: 21px 17px; border-radius: 18px; }
    .two-columns { grid-template-columns: 1fr; }
    .login-card, .setup-card { padding: 27px 21px; }
}
