:root {
  --ink: #17211d;
  --muted: #6e7873;
  --line: #dde3df;
  --surface: #ffffff;
  --canvas: #f4f6f4;
  --forest: #14241d;
  --forest-2: #20372d;
  --green: #2f7d5b;
  --green-bright: #b8f171;
  --blue: #4c6fff;
  --gold: #e3a63b;
  --red: #c84b4b;
  --radius: 14px;
  --shadow: 0 14px 40px rgba(21, 35, 29, .08);
  font-family: Aptos, "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { flex: 0 0 auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(1.75rem, 3vw, 2.45rem); letter-spacing: -.045em; line-height: 1.06; }
h2 { margin-bottom: .25rem; font-size: 1.22rem; letter-spacing: -.025em; }
h3 { margin-bottom: .25rem; font-size: 1rem; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: .82em; }
.muted { color: var(--muted); }
.eyebrow, .step-label { margin-bottom: .55rem; color: var(--green); font-size: .74rem; font-weight: 800; letter-spacing: .14em; }
.button { min-height: 42px; padding: .65rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: .48rem; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: .9rem; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--forest); color: white; box-shadow: 0 8px 18px rgba(20,36,29,.15); }
.button.primary:hover { background: var(--forest-2); box-shadow: 0 10px 24px rgba(20,36,29,.22); }
.button.ghost { border-color: var(--line); background: white; color: var(--ink); box-shadow: none; }
.button.small { min-height: 34px; padding: .42rem .7rem; font-size: .8rem; }
.button.full { width: 100%; }
.icon-button { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); cursor: pointer; }
.icon-button:hover { background: #f1f4f2; }
.icon-button.danger { color: var(--red); border-color: transparent; background: transparent; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px 4px 13px 13px; background: var(--green-bright); color: var(--forest); font-size: 1.42rem; font-weight: 900; box-shadow: inset 0 0 0 1px rgba(20,36,29,.1); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px 4px 11px 11px; font-size: 1.15rem; }
.alert { margin-bottom: 1rem; padding: .82rem 1rem; border: 1px solid; border-radius: 10px; font-size: .9rem; transition: opacity .3s, transform .3s; }
.alert.success { color: #195d3e; background: #e9f7ef; border-color: #b8dfc8; }
.alert.error { color: #873535; background: #fff0f0; border-color: #f0c3c3; }
.alert.leaving { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 1px rgba(0,0,0,.015); }
.panel-head { padding: 1.15rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.panel-head p { margin-bottom: .35rem; }
.panel-head h2 { margin: 0; }
.panel-head > a { color: var(--green); font-size: .82rem; font-weight: 700; }

/* setup and login */
.setup-body, .login-body { background: var(--forest); }
.setup-shell, .login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(480px, .9fr); }
.setup-intro, .login-visual { position: relative; overflow: hidden; padding: clamp(2rem, 6vw, 6rem); display: flex; flex-direction: column; justify-content: center; color: white; background: radial-gradient(circle at 25% 75%, rgba(184,241,113,.16), transparent 29%), linear-gradient(145deg, #0d1914, #1d362b); }
.setup-intro::after { content: ""; position: absolute; width: 420px; height: 420px; right: -180px; top: -110px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.02); }
.setup-intro .brand-mark { margin-bottom: 3rem; }
.setup-intro .eyebrow, .login-visual .eyebrow { color: var(--green-bright); }
.setup-intro h1 { max-width: 570px; font-size: clamp(2.5rem, 5vw, 4.6rem); }
.setup-intro > p:not(.eyebrow) { max-width: 560px; color: #b9c7c0; font-size: 1.1rem; line-height: 1.7; }
.setup-checks { margin-top: 2.5rem; display: flex; gap: 1rem; flex-wrap: wrap; color: #dce7e1; font-size: .86rem; }
.setup-checks span { padding: .6rem .8rem; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.04); }
.setup-card, .login-panel { padding: clamp(2rem, 6vw, 6rem); display: flex; flex-direction: column; justify-content: center; background: #f7f8f7; }
.setup-card > *, .login-form { width: min(100%, 580px); margin-left: auto; margin-right: auto; }
.setup-card > .success-orb { margin-left: auto; margin-right: auto; }
.setup-card h2, .login-form h2 { font-size: 1.85rem; letter-spacing: -.04em; }
.setup-card hr, .form-stack hr { width: 100%; margin: .5rem 0; border: 0; border-top: 1px solid var(--line); }
.success-orb { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 1.5rem; border-radius: 50%; background: #dff3e7; color: var(--green); font-size: 1.7rem; }
.login-visual { min-height: 100vh; justify-content: space-between; }
.login-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: .85rem; font-size: 1.15rem; }
.visual-copy { position: relative; z-index: 2; max-width: 650px; margin: auto 0; }
.visual-copy h1 { font-size: clamp(3rem, 5.2vw, 5.6rem); line-height: .98; }
.visual-copy h1 em { color: var(--green-bright); font-style: normal; }
.visual-copy > p:last-child { max-width: 520px; color: #afbeb7; font-size: 1.08rem; line-height: 1.7; }
.orbit { position: absolute; border: 1px solid rgba(184,241,113,.16); border-radius: 50%; }
.orbit-a { width: 620px; height: 620px; top: 15%; left: 42%; }
.orbit-b { width: 440px; height: 440px; top: 24%; left: 51%; box-shadow: 0 0 100px rgba(184,241,113,.06) inset; }
.activity-float { position: relative; z-index: 2; width: min(390px,100%); padding: .9rem 1rem; display: flex; align-items: center; gap: .75rem; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.08); backdrop-filter: blur(12px); }
.activity-float div { display: flex; flex-direction: column; gap: .2rem; }
.activity-float small { color: #adc0b7; }
.online-dot { width: 9px; height: 9px; margin-left: auto; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 4px rgba(184,241,113,.12); }
.login-form { padding: 2rem; }
.login-form > p.muted { margin-bottom: 2rem; }

/* forms */
.form-stack { display: flex; flex-direction: column; gap: 1rem; }
.form-stack label { position: relative; display: flex; flex-direction: column; gap: .42rem; color: #38433e; font-size: .85rem; font-weight: 700; }
.form-stack label small { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; min-height: 44px; padding: .7rem .8rem; border: 1px solid #ced6d1; border-radius: 8px; outline: 0; background: white; color: var(--ink); font-size: .9rem; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .rich-editor:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,125,91,.1); }
.field-grid { display: grid; gap: .9rem; }
.field-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.field-grid.mail-server { grid-template-columns: 1.5fr .65fr .85fr; }
.followup-row { grid-template-columns: 1.7fr .7fr; }
.input-suffix { position: absolute; right: .75rem; bottom: .8rem; color: var(--muted); font-size: .8rem; }
.field-help { margin: -.25rem 0 .25rem; color: var(--muted); font-size: .78rem; font-weight: 400; }
.form-section-title { margin: .25rem 0 -.4rem; color: var(--muted); font-size: .73rem; font-weight: 800; letter-spacing: .12em; }
.switch-row { min-height: 62px; padding: .75rem .9rem; flex-direction: row !important; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 9px; }
.switch-row span { display: flex; flex-direction: column; gap: .25rem; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { position: relative; width: 44px; height: 25px; flex: 0 0 auto; border-radius: 99px; background: #cbd3cf; transition: background .2s; }
.switch-row i::after { content: ""; position: absolute; width: 19px; height: 19px; top: 3px; left: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: transform .2s; }
.switch-row input:checked + i { background: var(--green); }
.switch-row input:checked + i::after { transform: translateX(19px); }

/* app shell */
.app-body { padding-left: 242px; }
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 242px; padding: 1.25rem .8rem .85rem; display: flex; flex-direction: column; background: var(--forest); color: #dce6e1; }
.sidebar-brand { padding: .2rem .55rem 1.5rem; display: flex; align-items: center; gap: .72rem; }
.sidebar-brand > div { display: flex; flex-direction: column; }
.sidebar-brand strong { color: white; font-size: 1.08rem; letter-spacing: -.02em; }
.sidebar-brand small { margin-top: .05rem; color: #869a90; font-size: .62rem; font-weight: 800; letter-spacing: .18em; }
.sidebar-close { display: none; margin-left: auto; background: transparent; border-color: rgba(255,255,255,.12); color: white; }
.sidebar nav { display: flex; flex-direction: column; gap: .22rem; }
.nav-link { min-height: 43px; padding: .65rem .75rem; display: flex; align-items: center; gap: .7rem; border-radius: 8px; color: #a8bab1; font-size: .88rem; font-weight: 600; transition: background .15s, color .15s; }
.nav-link:hover { color: white; background: rgba(255,255,255,.055); }
.nav-link.active { color: var(--forest); background: var(--green-bright); }
.nav-link b { min-width: 21px; height: 21px; margin-left: auto; padding: 0 .35rem; display: grid; place-items: center; border-radius: 99px; background: #e26252; color: white; font-size: .68rem; }
.nav-section { margin: 1.4rem .75rem .45rem; color: #6e8479; font-size: .63rem; font-weight: 800; letter-spacing: .14em; }
.sidebar-account { margin-top: auto; padding: .85rem .55rem .1rem; display: flex; align-items: center; gap: .65rem; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: var(--green-bright); color: var(--forest); font-size: .74rem; font-weight: 900; }
.avatar.soft { background: #e2eee8; color: var(--green); }
.sidebar-account > div:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.sidebar-account strong { color: white; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-account small { color: #82968c; font-size: .68rem; }
.sidebar-account form { margin-left: auto; }
.logout-link { border: 0; background: transparent; color: #82968c; cursor: pointer; font-size: 1.2rem; }
.app-shell { min-height: 100vh; }
.topbar { height: 66px; padding: 0 clamp(1rem,3vw,2rem); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(10px); position: sticky; z-index: 30; top: 0; }
.topbar > div:first-of-type { display: flex; flex-direction: column; }
.topbar-context { color: var(--muted); font-size: .66rem; }
.topbar strong { font-size: .9rem; }
.topbar-actions { display: flex; align-items: center; gap: .8rem; }
.sync-state { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .78rem; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: #59a674; box-shadow: 0 0 0 4px #e4f2e8; }
.mail-button { position: relative; }
.mail-button b { position: absolute; right: -5px; top: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border-radius: 99px; background: #e26252; color: white; font-size: .62rem; }
.menu-toggle { display: none; }
.content { width: min(1500px,100%); margin: 0 auto; padding: clamp(1.3rem,3vw,2.4rem); }
.welcome-row, .page-heading { margin-bottom: 1.45rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.welcome-row > div > p:last-child, .page-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: .9rem; }
.page-heading.compact { margin-bottom: 1rem; }
.count-pill { padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 99px; background: white; color: var(--muted); font-size: .8rem; }

/* dashboard */
.stat-grid { margin-bottom: 1.2rem; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; }
.stat-card { min-height: 128px; padding: 1.15rem; display: flex; align-items: center; gap: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.stat-card.feature { justify-content: space-between; background: var(--forest); color: white; border-color: var(--forest); }
.stat-card small { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .75rem; }
.stat-card strong { display: block; font-size: 1.65rem; letter-spacing: -.04em; }
.stat-card p { margin: .2rem 0 0; color: #8c9792; font-size: .7rem; }
.stat-card.feature small, .stat-card.feature p { color: #9fb1a8; }
.stat-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 11px; }
.stat-icon.sage { background: #e2f1e8; color: var(--green); }
.stat-icon.blue { background: #e6eaff; color: var(--blue); }
.stat-icon.gold { background: #fff2d9; color: #bb7c13; }
.rate-ring { --rate: 0deg; width: 66px; height: 66px; padding: 7px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green-bright) var(--rate), #32463d 0); }
.rate-ring::before { content: ""; grid-area: 1/1; width: 100%; height: 100%; border-radius: 50%; background: var(--forest); }
.rate-ring span { z-index: 1; grid-area: 1/1; font-size: .72rem; font-weight: 800; }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 1.2rem; }
.reply-list { display: flex; flex-direction: column; }
.reply-item { padding: .88rem 1.2rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; border-bottom: 1px solid #edf0ee; }
.reply-item:last-child { border-bottom: 0; }
.reply-item:hover { background: #f8faf9; }
.reply-item > div { min-width: 0; display: flex; flex-direction: column; gap: .18rem; }
.reply-item strong { font-size: .84rem; }
.reply-item span { color: var(--muted); font-size: .76rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-item time { color: #8b9590; font-size: .7rem; }
.campaign-mini-list { padding: .2rem 1.2rem; }
.campaign-mini { padding: .95rem 0; border-bottom: 1px solid #edf0ee; }
.campaign-mini:last-child { border-bottom: 0; }
.campaign-mini > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.campaign-mini strong { font-size: .82rem; }
.campaign-mini > span { display: block; margin: .5rem 0; color: var(--muted); font-size: .7rem; }
.progress { height: 5px; overflow: hidden; border-radius: 99px; background: #edf1ee; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.empty-state { min-height: 180px; padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #93a099; text-align: center; }
.empty-state.compact { min-height: 270px; }
.empty-state.large { min-height: 330px; }
.empty-state h3 { margin-top: .8rem; color: var(--ink); }
.empty-state p { max-width: 360px; margin-bottom: 1rem; color: var(--muted); font-size: .82rem; }

/* badges, tables, contacts */
.badge { width: fit-content; padding: .32rem .52rem; display: inline-flex; align-items: center; gap: .35rem; border-radius: 99px; background: #eef1ef; color: #637069; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-replied, .status-running, .status-completed, .status-contacted { background: #e4f3e9; color: #347451; }
.status-scheduled, .status-sent { background: #e9edff; color: #5069ce; }
.status-paused { background: #fff3dc; color: #a56f19; }
.status-failed, .status-bounced { background: #ffebeb; color: #b24747; }
.table-panel { overflow: hidden; }
.table-toolbar { min-height: 64px; padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.table-toolbar > span { color: var(--muted); font-size: .76rem; }
.search-form { width: min(360px,70%); position: relative; }
.search-form svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #8c9892; }
.search-form input { padding-left: 2.35rem; background: #f7f9f7; border-color: transparent; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .7rem 1rem; background: #f8faf8; color: #7b8781; text-align: left; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
td { padding: .9rem 1rem; border-top: 1px solid #edf0ee; vertical-align: middle; font-size: .82rem; }
td > strong, td > small { display: block; }
td > small { margin-top: .18rem; color: var(--muted); }
.domain-cell { min-width: 220px; display: flex; align-items: center; gap: .7rem; }
.domain-cell > div { min-width: 0; display: flex; flex-direction: column; gap: .16rem; }
.domain-cell a { max-width: 260px; color: var(--muted); font-size: .7rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.domain-favicon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: #edf1ef; color: var(--green); font-weight: 900; }
.domain-link { display: flex; align-items: center; gap: .3rem; color: var(--green); font-weight: 700; }
.excerpt-cell { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* campaigns */
.campaign-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.campaign-card { border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; }
.campaign-card-main { padding: 1.05rem 1.15rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.campaign-title { display: flex; align-items: center; gap: .75rem; }
.campaign-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--forest); color: var(--green-bright); }
.campaign-title h3 { font-size: .95rem; }
.campaign-title p { margin: 0; color: var(--muted); font-size: .72rem; }
.campaign-metrics { padding: .85rem 1.15rem; display: grid; grid-template-columns: repeat(4,1fr); background: #f7f9f7; border-block: 1px solid #edf0ee; }
.campaign-metrics > div { padding-left: .8rem; border-left: 1px solid var(--line); }
.campaign-metrics > div:first-child { padding-left: 0; border: 0; }
.campaign-metrics strong, .campaign-metrics span { display: block; }
.campaign-metrics strong { font-size: 1.05rem; }
.campaign-metrics span { margin-top: .18rem; color: var(--muted); font-size: .65rem; }
.campaign-footer { min-height: 53px; padding: .65rem 1.15rem; display: flex; align-items: center; justify-content: space-between; }
.campaign-footer > span { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .72rem; }
.contact-picker { padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.contact-picker legend { width: 100%; padding: .8rem .9rem; display: flex; justify-content: space-between; background: #f7f9f7; font-size: .8rem; font-weight: 800; }
.contact-picker legend span { color: var(--muted); font-weight: 500; }
.contact-options { max-height: 250px; overflow-y: auto; }
.contact-picker label { min-height: 52px; padding: .6rem .9rem; flex-direction: row; align-items: center; border-top: 1px solid #edf0ee; }
.contact-picker input { width: 17px; min-height: 17px; }
.contact-picker label > span:not(.badge) { display: flex; flex-direction: column; gap: .12rem; }
.contact-picker label small { font-size: .7rem; }
.contact-picker .badge { margin-left: auto; }
.select-all { background: #fbfcfb; }

/* templates */
.template-layout { display: grid; grid-template-columns: minmax(280px,.7fr) minmax(480px,1.3fr); gap: 1.1rem; align-items: start; }
.template-list { display: flex; flex-direction: column; gap: .65rem; }
.template-card { padding: 1rem; display: flex; justify-content: space-between; gap: .8rem; border: 1px solid var(--line); border-radius: 11px; background: white; transition: border-color .15s, transform .15s; }
.template-card:hover, .template-card.selected { border-color: #8eb8a3; transform: translateX(2px); }
.template-card > div { min-width: 0; }
.template-card h3 { margin: .55rem 0 .45rem; }
.template-card strong { display: block; font-size: .78rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.template-card p { margin: .35rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.template-type { padding: .25rem .45rem; border-radius: 5px; background: #e6f2eb; color: var(--green); font-size: .63rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.type-followup { background: #fff2dc; color: #aa7114; }
.type-reply { background: #e9edff; color: #4f69ce; }
.editor-panel { position: sticky; top: 84px; }
.editor-panel > form { padding: 1.15rem 1.25rem; }
.editor-toolbar { min-height: 42px; padding: .3rem; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; border: 1px solid #ced6d1; border-bottom: 0; border-radius: 8px 8px 0 0; background: #f7f9f7; }
.editor-toolbar button { min-height: 29px; padding: .3rem .48rem; border: 0; border-radius: 5px; background: transparent; color: #4b5851; cursor: pointer; font-size: .72rem; }
.editor-toolbar button:hover { background: #e8edea; }
.rich-editor { min-height: 260px; padding: .9rem; border: 1px solid #ced6d1; border-radius: 0 0 8px 8px; outline: 0; background: white; font-size: .9rem; font-weight: 400; line-height: 1.6; }

/* inbox */
.inbox-layout { min-height: calc(100vh - 175px); display: grid; grid-template-columns: minmax(280px,360px) minmax(480px,1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: white; }
.message-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - 175px); }
.message-search { position: sticky; top: 0; z-index: 2; padding: .75rem; background: white; border-bottom: 1px solid var(--line); }
.message-search svg { position: absolute; left: 1.5rem; top: 50%; transform: translateY(-50%); color: #8b9791; }
.message-search input { padding-left: 2.35rem; background: #f5f7f5; border-color: transparent; }
.message-row { padding: .85rem .75rem; display: grid; grid-template-columns: auto 1fr; gap: .65rem; border-bottom: 1px solid #edf0ee; }
.message-row:hover, .message-row.selected { background: #f1f6f3; }
.message-row.selected { box-shadow: inset 3px 0 var(--green); }
.message-row.unread { background: #f7fbf8; }
.message-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #e5ede9; color: var(--green); font-size: .68rem; font-weight: 900; }
.message-row > div:last-child { min-width: 0; }
.message-row > div > div { display: flex; justify-content: space-between; gap: .5rem; }
.message-row strong { font-size: .78rem; }
.message-row time { color: #89948e; font-size: .65rem; }
.message-row b { display: block; margin: .25rem 0; font-size: .73rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-row p { margin: 0; color: var(--muted); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-panel { min-width: 0; display: flex; flex-direction: column; }
.conversation-head { padding: 1.1rem 1.35rem; display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.conversation-head h2 { font-size: 1.12rem; }
.conversation-head span { color: var(--muted); font-size: .72rem; }
.message-body { padding: 1.4rem; }
.sender-line { display: flex; align-items: center; gap: .7rem; }
.sender-line > div { display: flex; flex-direction: column; }
.sender-line strong { font-size: .82rem; }
.sender-line small { color: var(--muted); font-size: .7rem; }
.plain-message { margin: 1.3rem 0 .5rem 3rem; color: #36423c; font-size: .9rem; line-height: 1.7; }
.reply-composer { margin: auto 1.35rem 1.35rem; border: 1px solid #cdd6d1; border-radius: 10px; overflow: hidden; }
.reply-tools { padding: .55rem .65rem; background: #f6f8f6; border-bottom: 1px solid var(--line); }
.reply-tools select { min-height: 34px; max-width: 250px; padding: .35rem .55rem; font-size: .74rem; }
.reply-subject { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-weight: 700; }
.reply-editor { min-height: 150px; border: 0; border-radius: 0; box-shadow: none !important; }
.composer-footer { padding: .55rem .65rem; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); background: #fbfcfb; }
.composer-footer span { color: var(--muted); font-size: .68rem; }

/* settings */
.settings-grid { display: grid; grid-template-columns: minmax(500px,1.25fr) minmax(300px,.75fr); gap: 1rem; align-items: start; }
.settings-grid > form { padding-bottom: 1.2rem; }
.settings-grid > form > :not(.panel-head) { margin-left: 1.2rem; margin-right: 1.2rem; }
.settings-grid > form > .panel-head { margin-bottom: .2rem; }
.secure-note { padding: .35rem .5rem; border-radius: 6px; background: #e8f4ed; color: var(--green); font-size: .66rem; font-weight: 700; }
.settings-side { display: flex; flex-direction: column; gap: 1rem; }
.cron-card { padding: 1.2rem; background: linear-gradient(145deg,#fff,#f4f8f5); }
.cron-card .stat-icon { margin-bottom: 1rem; }
.cron-card > p:not(.eyebrow) { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.copy-field { margin: 1rem 0 .75rem; padding: .45rem .5rem .45rem .7rem; display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 8px; background: white; }
.copy-field code { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.copy-field .icon-button { margin-left: auto; flex: 0 0 auto; }
.cron-card > small { color: var(--muted); font-size: .7rem; line-height: 1.5; word-break: break-all; }
.log-list { padding: .5rem 1.15rem 1rem; }
.log-list > div { padding: .65rem 0; display: flex; gap: .6rem; border-bottom: 1px solid #edf0ee; }
.log-list i { width: 7px; height: 7px; margin-top: .35rem; flex: 0 0 auto; border-radius: 50%; background: #5ba174; }
.log-list i.log-error { background: var(--red); }
.log-list i.log-warning { background: var(--gold); }
.log-list span { font-size: .74rem; line-height: 1.4; }
.log-list small { display: block; margin-top: .2rem; color: var(--muted); font-size: .65rem; }

/* modal */
.modal { position: fixed; z-index: 100; inset: 0; display: none; place-items: center; padding: 1rem; }
.modal.open { display: grid; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,18,14,.62); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(560px,100%); max-height: calc(100vh - 2rem); overflow-y: auto; border-radius: 15px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.25); animation: modal-in .2s ease; }
.modal-card.wide { width: min(780px,100%); }
.modal-head { padding: 1.1rem 1.2rem; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-card > form { padding: 1.2rem; }
.modal-open { overflow: hidden; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

@media (max-width: 1150px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .campaign-list { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-body { padding-left: 0; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; box-shadow: 12px 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-toggle { display: grid; }
  .topbar { justify-content: flex-start; gap: .8rem; }
  .topbar-actions { margin-left: auto; }
  .template-layout { grid-template-columns: 1fr; }
  .editor-panel { position: static; }
  .inbox-layout { grid-template-columns: minmax(240px,320px) 1fr; }
  .setup-shell, .login-shell { grid-template-columns: 1fr; }
  .setup-intro { min-height: 44vh; padding: 2rem; }
  .setup-intro .brand-mark { margin-bottom: 1.5rem; }
  .login-visual { min-height: 48vh; padding: 2rem; }
  .login-panel { min-height: 52vh; }
  .activity-float { display: none; }
  .visual-copy { margin: auto 0 0; }
  .visual-copy h1 { font-size: clamp(2.5rem,9vw,4rem); }
}

@media (max-width: 640px) {
  .content { padding: 1rem; }
  .sync-state { display: none; }
  .welcome-row, .page-heading { align-items: flex-start; flex-direction: column; }
  .welcome-row .button, .page-heading > .button { width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .stat-card { min-height: 105px; padding: .8rem; }
  .stat-icon { display: none; }
  .stat-card strong { font-size: 1.4rem; }
  .rate-ring { width: 55px; height: 55px; }
  .field-grid.two, .field-grid.mail-server, .followup-row { grid-template-columns: 1fr; }
  .table-toolbar { align-items: stretch; flex-direction: column; gap: .5rem; }
  .search-form { width: 100%; }
  .campaign-metrics { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .campaign-metrics > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .inbox-layout { display: block; }
  .message-list { max-height: 320px; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-head { flex-direction: column; }
  .plain-message { margin-left: 0; }
  .reply-composer { margin: .75rem; }
  .composer-footer { align-items: flex-end; gap: .5rem; }
  .composer-footer span { max-width: 45%; }
  .setup-card, .login-panel { padding: 1.3rem; }
  .setup-intro { min-height: 35vh; }
  .setup-intro h1 { font-size: 2.35rem; }
  .setup-checks { display: none; }
  .login-form { padding: .75rem 0; }
  .login-visual { min-height: 38vh; }
  .visual-copy h1 { font-size: 2.4rem; }
  .visual-copy > p:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
