/* The SLEG Email demo console. Same look as the SLEG Ads demo: slate palette, flat cards, 1px borders. */
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: #f5f7fb; color: #172033; font-size: 14px; }
h2 { font-size: 22px; margin: 0 0 6px; }
h3 { font-size: 15px; margin: 0 0 10px; }
a { color: #2563eb; }

header { height: 64px; background: #0f172a; color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; gap: 16px; }
header .brand { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
header .brand .mark { width: 30px; height: 30px; border-radius: 7px; background: #1e293b; display: grid; place-items: center; font-size: 13px; }
header .sub { font-size: 13px; color: #94a3b8; margin-top: 2px; }
.top-nav { display: flex; gap: 4px; }
.top-nav-button { background: transparent; color: #94a3b8; border: 0; padding: 9px 14px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.top-nav-button.active { background: #1e293b; color: white; }
.header-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #94a3b8; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e2e8f0; color: #334155; white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.status-pill.live { background: #dcfce7; color: #166534; }
.status-pill.preview { background: #fef3c7; color: #92400e; }
.status-pill.bad { background: #fee2e2; color: #991b1b; }
.status-pill.info { background: #dbeafe; color: #1e40af; }

.shell { max-width: 1440px; margin: 0 auto; padding: 22px; }
.stepper { background: white; border-radius: 12px; border: 1px solid #e5e7eb; padding: 18px 22px; display: flex; align-items: center; margin-bottom: 20px; overflow-x: auto; }
.step-item { display: flex; align-items: center; gap: 10px; cursor: pointer; white-space: nowrap; color: #64748b; font-weight: 600; background: none; border: 0; padding: 0; font-size: 14px; }
.step-circle { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; color: #475569; font-size: 13px; font-weight: 700; flex: none; }
.step-item.active { color: #0f172a; }
.step-item.active .step-circle { background: #0f172a; color: white; }
.step-item.complete .step-circle { background: #16a34a; color: white; }
.step-line { flex: 1; min-width: 28px; height: 2px; background: #e2e8f0; margin: 0 14px; }
.step-line.complete { background: #16a34a; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
.panel { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px; }
.summary { position: sticky; top: 20px; height: fit-content; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; }
.summary-label { color: #64748b; text-transform: uppercase; font-size: 11px; letter-spacing: .05em; padding-top: 2px; }
.summary-value { font-weight: 600; text-align: right; word-break: break-word; }
.divider { height: 1px; background: #e5e7eb; margin: 10px 0; }

.lead { color: #64748b; margin: 0 0 20px; font-size: 15px; line-height: 1.5; }
.small { font-size: 12px; color: #64748b; }
.hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.muted { color: #64748b; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: 2fr 1fr 1fr 110px; gap: 10px; align-items: end; }
.span-2 { grid-column: span 2; }

label { display: block; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 14px; background: white; color: #172033; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: #2563eb; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
details.advanced { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; background: #fafbfc; margin-top: 14px; }
details.advanced summary { cursor: pointer; font-weight: 600; font-size: 13px; color: #334155; }
details.advanced[open] summary { margin-bottom: 12px; }

button { border-radius: 8px; border: 1px solid #cbd5e1; padding: 10px 14px; font-size: 14px; background: white; color: #172033; cursor: pointer; font-family: inherit; }
button:hover { background: #f8fafc; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: #0f172a; color: white; border-color: #0f172a; }
button.primary:hover { background: #1e293b; }
button.success { background: #15803d; color: white; border-color: #15803d; }
button.success:hover { background: #166534; }
button.link { border: 0; background: none; color: #2563eb; padding: 4px 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; border-top: 1px solid #e5e7eb; margin-top: 22px; padding-top: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.providers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.provider { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; background: #fafbfc; text-align: left; }
.provider strong { display: block; font-size: 14px; }
.provider span { font-size: 12px; color: #64748b; }
.provider.selected { background: #f8fafc; border: 2px solid #0f172a; padding: 11px; }

.field-card, .check, .metric, .step-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; background: #fafbfc; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check .icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; background: #e2e8f0; color: #475569; }
.check.ok .icon { background: #16a34a; color: white; }
.check.bad .icon { background: #dc2626; color: white; }
.check .title { font-weight: 600; }

.step-card { margin-bottom: 14px; background: white; }
.step-card .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.angle { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .06em; }
.merge { font-family: ui-monospace, monospace; font-size: 12px; background: #e2e8f0; border-radius: 6px; padding: 1px 6px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: #172033; margin: 12px 0 0; cursor: pointer; }
.check-row input { width: auto; margin-top: 3px; }
.check-row:has(input:disabled) { color: #94a3b8; cursor: default; }
.warn-text { color: #92400e; margin: 4px 0 0 24px; }
.metric-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 24px; font-weight: 700; margin-top: 4px; }

.banner { border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.5; border: 1px solid; }
.safe-banner { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.success-banner { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.warn-banner { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.error-banner { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 8px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: 13px; vertical-align: top; }
th { color: #64748b; font-weight: 600; }
td .sub { color: #94a3b8; font-size: 12px; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: #94a3b8; padding: 26px 8px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e2e8f0; color: #334155; }
.tag.green { background: #dcfce7; color: #166534; }
.tag.blue { background: #dbeafe; color: #1e40af; }
.tag.amber { background: #fef3c7; color: #92400e; }
.tag.red { background: #fee2e2; color: #991b1b; }

.auto-card { background: #f0fdf4; border-color: #bbf7d0; margin-bottom: 4px; }
.auto-card.running { background: #ecfdf5; border: 2px solid #16a34a; padding: 13px; }
.log { background: #0b1220; color: #cbd5e1; border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, monospace; font-size: 12px; height: 170px; overflow-y: auto; margin-top: 18px; white-space: pre-wrap; }
.log .t { color: #64748b; }
.section-gap { margin-top: 26px; }
.hidden { display: none !important; }

.toast { position: fixed; bottom: 22px; right: 22px; background: #0f172a; color: white; padding: 12px 16px; border-radius: 10px; font-size: 13px; max-width: 420px; box-shadow: 0 8px 24px rgba(15,23,42,.18); z-index: 10; }
.toast.error { background: #991b1b; }

.sub-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #334155; margin: 20px 0 10px; }
.concepts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.concept { text-align: left; background: white; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.concept.selected { border: 2px solid #0f172a; padding: 13px; }
.concept .headline { font-weight: 800; text-transform: uppercase; line-height: 1.15; }
.concept .headline span { color: #b45309; }
.ad-edit { display: grid; grid-template-columns: minmax(0, 1fr) 640px; gap: 20px; align-items: start; }
.ad-preview { width: 100%; height: 1000px; border: 1px solid #e5e7eb; border-radius: 10px; background: #EEF0F3; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 8px; border: 1px solid #cbd5e1; padding: 0; }
.swatch.selected { outline: 3px solid #0f172a; outline-offset: 2px; }
.placement { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.placement select { width: auto; padding: 6px 10px; }

@media (max-width: 1300px) {
  .ad-edit { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .providers { grid-template-columns: 1fr 1fr; }
  header .sub { display: none; }
}
@media (max-width: 640px) {
  .shell { padding: 14px; }
  .grid-2, .grid-3, .grid-4, .checks, .concepts { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 18px; }
  header { padding: 10px 16px; height: auto; flex-wrap: wrap; row-gap: 8px; }
  header .brand { font-size: 17px; }
  .top-nav { order: 3; width: 100%; }
}

.oauth-box { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid #e5e7eb; }
.oauth-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.oauth-msg { font-size: 13px; color: #b91c1c; margin-top: 8px; min-height: 18px; }
#fallbackTitle { margin: 0 0 4px; }
