/* emailteam.ai: application shell and page styles, layered over Syncfusion's Fluent 2 theme. */

:root {
    --ink: #0e1a2b;
    --ink-2: #172840;
    --ink-3: #8ea0b8;
    --paper: #f4f6f9;
    --card: #ffffff;
    --line: #e2e7ee;
    --line-strong: #cfd7e2;
    --text: #18212f;
    --muted: #5b687a;
    --primary: #0f6cbd;
    --primary-ink: #0c5aa0;
    --primary-soft: #e8f1fb;
    --accent: #ff7a45;
    --good: #0f7b3f;
    --good-soft: #e6f4ec;
    --warn: #9a5b00;
    --warn-soft: #fdf3e1;
    --bad: #b42343;
    --bad-soft: #fbe9ed;
    --live: #0f6cbd;
    --live-soft: #e8f1fb;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 1px 1px rgba(14, 26, 43, .04);
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); color: var(--text); text-wrap: balance; margin: 0; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }

.icon { flex: none; display: block; }

/* ---------- Shell ---------- */

.shell { display: flex; min-height: 100vh; }

.rail {
    width: 248px;
    flex: none;
    background: var(--ink);
    color: #dbe4f0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    padding: 4px 8px 22px;
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-3);
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #c9d4e3;
    font-weight: 500;
}
.nav-item:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.nav-item.active { background: #1d3354; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }

.rail-foot {
    margin-top: auto;
    border-top: 1px solid #22344f;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.who { display: flex; align-items: center; gap: 10px; padding: 0 8px; min-width: 0; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: #2a4468; color: #fff; display: grid; place-items: center; font-weight: 600; flex: none;
}
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9d4e3; }

.signout {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: transparent; border: 0; color: #c9d4e3; cursor: pointer;
    padding: 8px 10px; border-radius: 8px; font: inherit;
}
.signout:hover { background: var(--ink-2); color: #fff; }

.main { flex: 1; min-width: 0; }
.content { max-width: 1240px; margin: 0 auto; padding: 32px 40px 56px; }

/* ---------- Page header ---------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-sub { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ---------- Buttons (plain HTML, matched to the theme) ---------- */

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 14px; border-radius: 6px;
    border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
    font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f1f4f8; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #961c38; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 0 8px; }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Cards and grids ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 18px 22px 0; }

.stack { display: flex; flex-direction: column; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 20px; align-items: start; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 14px; }
.kpi {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 2px;
}
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-value { font-family: var(--font-display); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi.good .kpi-value { color: var(--good); }
.kpi.bad .kpi-value { color: var(--bad); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.accent { border-top: 3px solid var(--accent); }

/* ---------- Chips ---------- */

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
    background: #eef1f5; color: #3b4758;
}
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info, .chip-live { background: var(--live-soft); color: var(--live); }
.chip-live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .chip-live::before { animation: none; } }

/* ---------- Banners ---------- */

.banner {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: 8px; margin-bottom: 18px;
    border: 1px solid transparent;
}
.banner p { margin: 0; }
.banner-bad, .error { background: var(--bad-soft); color: var(--bad); border-color: #f3c7d1; }
.banner-good { background: var(--good-soft); color: var(--good); border-color: #bfe3cd; }
.banner-info, .outcome { background: var(--primary-soft); color: #0b4f8a; border-color: #c6dcf3; }
.banner-warn, .locked { background: var(--warn-soft); color: var(--warn); border-color: #f1dbb0; }
p.error, p.outcome, p.locked { padding: 12px 14px; border-radius: 8px; border: 1px solid; margin: 0 0 18px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 20px; }
.form-section h2 { margin-bottom: 4px; }
.form-section > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.fields-1 { grid-template-columns: minmax(0, 1fr); }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; }

.field input:not([type=checkbox]):not([type=hidden]),
.field select,
.field textarea,
.search input {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color .12s, box-shadow .12s;
}
.field textarea { height: auto; min-height: 220px; padding: 10px 11px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.55; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 108, 189, .18);
}
.field input:disabled, .field textarea:disabled { background: #f3f5f8; color: var(--muted); }
.field .invalid { border-color: var(--bad) !important; }
.validation-message { color: var(--bad); font-size: 12px; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.checks { display: flex; gap: 22px; flex-wrap: wrap; }

.form-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

.search { position: relative; max-width: 360px; flex: 1; }
.search .icon { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.search input { padding-left: 36px; }

/* ---------- Lists inside cards ---------- */

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .sub { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-row { display: flex; align-items: center; gap: 12px; }
.status-dot { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.status-dot.good { background: var(--good-soft); color: var(--good); }
.status-dot.bad { background: var(--bad-soft); color: var(--bad); }
.status-dot.warn { background: var(--warn-soft); color: var(--warn); }
.status-dot.idle { background: #eef1f5; color: var(--muted); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .icon { margin: 0 auto 10px; color: var(--line-strong); }

/* ---------- Syncfusion grid touches ---------- */

.e-grid { border-radius: 0 0 var(--radius) var(--radius); border: 0 !important; font-family: var(--font) !important; }
.e-grid .e-headercell { background: #f7f9fb !important; }
.e-grid .e-headertext { font-weight: 600 !important; text-transform: uppercase; font-size: 11.5px !important; letter-spacing: .05em; color: var(--muted); }
.e-grid .e-rowcell { font-size: 13.5px !important; }
.grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.grid-toolbar .filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

/* ---------- Email preview ---------- */

.preview-frame { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.preview-meta { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #f9fafc; font-size: 13px; }
.preview-meta div { display: flex; gap: 8px; }
.preview-meta span:first-child { color: var(--muted); width: 56px; flex: none; }
.preview-frame iframe { width: 100%; height: 360px; border: 0; display: block; }

/* ---------- Run monitor ---------- */

.run-top { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: center; }
.ring { position: relative; width: 200px; height: 200px; margin: 0 auto; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.ring-label strong { font-family: var(--font-display); font-size: 34px; font-weight: 600; }
.ring-label span { color: var(--muted); font-size: 12px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin-top: 16px; }
.facts div { display: flex; flex-direction: column; }
.facts span:first-child { color: var(--muted); font-size: 12px; }

/* ---------- Sign-in and unsubscribe ---------- */

.bare {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(1200px 500px at 15% -10%, #dfeaf7 0%, transparent 60%),
        radial-gradient(900px 500px at 110% 110%, #fde7dc 0%, transparent 55%),
        var(--paper);
}
.bare-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(14, 26, 43, .08);
    padding: 32px 32px 28px;
}
.bare-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 17px; margin-bottom: 26px; }
.bare-card h1 { font-size: 22px; margin-bottom: 6px; }
.bare-card .lead { color: var(--muted); margin: 0 0 22px; }
.bare-card .btn { width: 100%; justify-content: center; height: 40px; }

@media (max-width: 1000px) {
    .grid-main, .grid-2, .run-top { grid-template-columns: minmax(0, 1fr); }
    .content { padding: 24px 20px 48px; }
}
@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .rail { width: 100%; height: auto; position: static; }
    .fields, .fields-3, .facts { grid-template-columns: minmax(0, 1fr); }
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
