:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #6b7280;
  --line: #dde2e7;
  --blue: #173f6b;
  --blue-hover: #0e3157;
  --soft-blue: #edf3f9;
  --success: #166534;
  --success-bg: #ecfdf3;
  --error: #b42318;
  --error-bg: #fef3f2;
  --radius: 18px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, textarea { font: inherit; }
.topbar {
  height: 72px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
}
.topbar strong { display: block; font-size: 18px; }
.eyebrow { font-size: 12px; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .06em; }
.app-shell { max-width: 1180px; margin: 28px auto; padding: 0 20px 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(18, 33, 50, .06); padding: 26px; }
.section-heading h1, .section-heading h2 { margin: 0; letter-spacing: -.02em; }
.section-heading h1 { font-size: 28px; }
.section-heading h2 { font-size: 22px; }
.section-heading p { color: var(--muted); margin: 7px 0 22px; line-height: 1.45; }
.section-heading.compact p { margin-bottom: 16px; }
.stack { display: grid; gap: 18px; }
label > span, legend { display: block; font-weight: 650; font-size: 14px; margin-bottom: 7px; }
small { display: block; color: var(--muted); margin-top: 7px; line-height: 1.35; }
input, textarea {
  width: 100%; border: 1px solid #cfd6dd; border-radius: 11px; background: #fff; color: var(--text); padding: 12px 13px;
  outline: none; transition: border .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 105px; line-height: 1.45; }
input:focus, textarea:focus { border-color: #6d91b7; box-shadow: 0 0 0 3px rgba(23,63,107,.1); }
fieldset { border: 0; padding: 0; margin: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: #f0f2f4; border-radius: 12px; padding: 4px; }
.choice { cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: block; text-align: center; padding: 10px 12px; border-radius: 9px; margin: 0; font-weight: 650; color: #59616c; }
.choice input:checked + span { background: white; color: var(--blue); box-shadow: 0 1px 5px rgba(0,0,0,.1); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; border-radius: 11px; border: 1px solid transparent; padding: 0 16px; text-decoration: none; cursor: pointer; font-weight: 650; transition: .15s ease; }
.btn.primary { background: var(--blue); color: white; }
.btn.primary:hover { background: var(--blue-hover); }
.btn.secondary { background: var(--soft-blue); color: var(--blue); border-color: #d5e0ea; }
.btn.ghost { background: white; color: var(--text); border-color: var(--line); }
.btn.small { min-height: 36px; padding: 0 13px; }
.btn.full { width: 100%; }
.alert { border-radius: 11px; padding: 11px 13px; margin-bottom: 16px; font-size: 14px; }
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.error { background: var(--error-bg); color: var(--error); }
.preview-frame { background: #eef0f2; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; place-items: center; }
.preview-frame img { max-width: 100%; max-height: 680px; display: block; object-fit: contain; box-shadow: 0 5px 20px rgba(0,0,0,.12); }
.actions { display: flex; margin-top: 14px; }
.actions .btn { flex: 1; }
.email-box { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.email-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.empty-state { min-height: 470px; display: grid; align-content: center; justify-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty-state strong { color: var(--text); margin-top: 12px; }
.empty-state p { max-width: 310px; line-height: 1.45; }
.empty-icon { width: 62px; height: 82px; border: 2px solid #b9c4cf; border-radius: 8px; display: grid; place-items: center; font-weight: 750; color: var(--blue); background: white; box-shadow: 4px 4px 0 #e3e8ec; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: 0 16px 50px rgba(18,33,50,.09); }
.login-card h1 { margin: 14px 0 4px; }
.login-card .muted { color: var(--muted); margin: 0 0 24px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; background: var(--blue); color: white; font-weight: 800; letter-spacing: -.04em; }
@media (max-width: 800px) {
  .topbar { padding: 0 16px; }
  .app-shell { grid-template-columns: 1fr; margin-top: 16px; padding: 0 12px 28px; gap: 14px; }
  .panel { padding: 18px; border-radius: 15px; }
  .section-heading h1 { font-size: 25px; }
  .preview-frame img { max-height: none; width: 100%; }
  .empty-state { min-height: 260px; }
}
@media (max-width: 480px) {
  .email-row { grid-template-columns: 1fr; }
  .email-row .btn { width: 100%; }
}
