/* SMTP Harbor — Mailganer-themed light UI.
   Palette + PT Sans font echo the Mailganer cabinet (colors_v2.css). */
:root {
  --bg-base: #f6f7f8;
  --panel: #ffffff;
  --border: #e6eaee;
  --border-strong: #d5dbe1;
  --text: #475568;
  --text-strong: #2b3744;
  --muted: #64748b;
  --nav-bg: #233445;
  --nav-bg-2: #34495e;
  --nav-link: #94a3b8;
  --primary: #2980b9;
  --primary-dark: #1f6391;
  --accent: #3a87ad;
  --accent-dark: #2d6886;
  --link: #065790;
  --success: #27ae60;
  --article-green: #78a300;
  --danger: #e74c3c;
  --warning: #f1c40f;
  --warning-bg: #fcf8e3;
  --brand: #225794;
  --code-bg: #233445;
  --code-text: #cfd8e3;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(36, 52, 69, .06), 0 1px 3px rgba(36, 52, 69, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: 'PT Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  font-size: 15px;
}

/* header (light bar with colored logo, like the Mailganer cabinet) */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.5rem; background: #fff;
  border-bottom: 3px solid var(--primary); box-shadow: var(--shadow);
}
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; }
.brand img { height: 24px; display: block; }
.brand .sep { color: var(--border-strong); }
.brand .app-name { color: var(--text-strong); font-weight: 700; font-size: 1.02rem; }
.tagline { color: var(--muted); font-size: .82rem; margin-left: auto; }
.topnav { display: flex; gap: .25rem; margin-left: 1rem; }
.topnav a {
  color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 700;
  padding: .3rem .7rem; border-radius: 999px;
}
.topnav a:hover { background: #f1f5f9; color: var(--text-strong); }
.topnav a.active { background: var(--primary); color: #fff; }

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

/* panels / cards */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
h1 { font-size: 1.45rem; margin: 0 0 .4rem; color: var(--text-strong); }
h2 { font-size: 1.12rem; color: var(--text-strong); margin-top: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; }
a { color: var(--link); }
a:hover { color: #04253d; }

code {
  background: #eef2f5; color: var(--accent-dark); padding: .1rem .4rem; border-radius: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .85rem;
}

/* forms / buttons */
.generate-form { display: flex; flex-direction: column; gap: .5rem; max-width: 440px; }
label { font-weight: 700; color: var(--text-strong); font-size: .9rem; }
select, button, input[type=text], input[type=password] {
  font-size: 1rem; padding: .55rem .75rem; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
}
select:focus, input:focus { outline: 3px solid #d8e8f8; border-color: #0783d9; }
.btn-primary {
  background: var(--primary); color: #fff; border: 1px solid var(--primary-dark);
  cursor: pointer; font-weight: 700;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  display: inline-block; padding: .45rem .85rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius); color: var(--link); text-decoration: none; margin-right: .5rem;
  background: #fff;
}
.btn-secondary:hover { background: #f1f5f9; }

/* honeypot — visually hidden but present in DOM */
.hp-field {
  position: absolute !important; left: -9999px !important; top: -9999px !important;
  width: 1px; height: 1px; opacity: 0; overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
.params th, .behaviors th, .behaviors td { text-align: left; padding: .4rem .5rem; }
.params th { width: 230px; color: var(--muted); font-weight: 400; }
.behaviors th { color: var(--muted); border-bottom: 1px solid var(--border); }
.behaviors td { border-top: 1px solid var(--border); vertical-align: top; }

/* dialog / body console (brand-navy terminal) */
.dialog, .body {
  margin: 0; padding: .85rem; background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); overflow-x: auto; max-width: 100%;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .82rem;
}
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog .dir-C { color: #7fd99a; display: block; }
.dialog .dir-S { color: #7fb6ff; display: block; }

.outcome { font-size: .78rem; }
.outcome-accepted { color: var(--success); }
.outcome-permanent_failure, .outcome-connection_error, .outcome-connection_dropped { color: var(--danger); }
.outcome-temporary_failure { color: #b9770e; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }

/* mailbox */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pill { background: #eef2f5; border: 1px solid var(--border); color: var(--accent-dark); padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; }
.params-details summary { cursor: pointer; color: var(--link); margin: .3rem 0; }
.counter { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-left: .3rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
.inbox th { text-align: left; color: var(--muted); font-weight: 400; padding: .4rem .5rem; font-size: .8rem; border-bottom: 2px solid var(--border); }
.inbox-row { cursor: pointer; }
.inbox-row td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
.inbox-row:hover { background: #f8fafc; }
.t-subj { color: var(--text-strong); font-weight: 700; } .t-from, .t-to { color: var(--muted); }
.tls-badge { font-size: .72rem; padding: .1rem .45rem; border-radius: 4px; border: 1px solid var(--border-strong); }
.tls-starttls, .tls-implicit { color: var(--success); border-color: #bfe3cd; background: #f1faf4; }
.tls-none { color: #b9770e; border-color: #f0e2b6; background: var(--warning-bg); }
.crumbs a { color: var(--link); text-decoration: none; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.msg-meta span { min-width: 0; overflow-wrap: anywhere; }
.msg-meta code, .params code { word-break: break-all; }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tab { background: #fff; color: var(--muted); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .5rem .8rem; cursor: pointer; font-size: .85rem; }
.tab:hover { background: #f1f5f9; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary-dark); }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* simplified diagnostics steps */
.steps { list-style: none; padding: 0; margin: 0; }
.step { display: grid; grid-template-columns: 24px 190px 1fr; gap: .6rem; align-items: start; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.step-icon::before { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; font-size: .75rem; font-weight: 700; }
.step-pass .step-icon::before { content: '✓'; background: #e6f6ec; color: var(--success); }
.step-fail .step-icon::before { content: '✗'; background: #fdeceb; color: var(--danger); }
.step-warn .step-icon::before { content: '!'; background: var(--warning-bg); color: #b9770e; }
.step-info .step-icon::before { content: 'i'; background: #eaf2f8; color: var(--accent); }
.step-label { font-weight: 700; color: var(--text-strong); }
.step-detail { color: var(--muted); }

/* html preview */
.html-preview { width: 100%; min-height: 480px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; }

/* checks */
.checks-head { margin-bottom: .6rem; }
.checks { list-style: none; padding: 0; margin: 0; }
.check { display: flex; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
/* Flex children default to min-width:auto and refuse to shrink below their
   longest word — long URLs/headers then escape the card. */
.check-body { flex: 1 1 auto; min-width: 0; }
.check-name, .check-sum { overflow-wrap: anywhere; }
.check-icon { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.check-pass .check-icon { background: #e6f6ec; color: var(--success); }
.check-fail .check-icon { background: #fdeceb; color: var(--danger); }
.check-warn .check-icon { background: var(--warning-bg); color: #b9770e; }
.check-info .check-icon, .check-skip .check-icon { background: #eaf2f8; color: var(--accent); }
.check-name { font-weight: 700; color: var(--text-strong); }
.check-sum { color: var(--muted); font-size: .88rem; }
.rec { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; color: var(--accent-dark); background: #eef2f5; padding: .15rem .4rem; border-radius: 4px; margin-top: .25rem; word-break: break-all; }

/* bounce-port */
.bounce-addrs td { font-size: .88rem; }
.copy-btn {
  border: 1px solid var(--border-strong); background: #fff; color: var(--link);
  border-radius: 4px; padding: 0 .35rem; margin-left: .3rem; cursor: pointer; font-size: .8rem;
}
.copy-btn:hover { background: #f1f5f9; }
.dsn-badge { font-size: .72rem; padding: .1rem .45rem; border-radius: 4px; border: 1px solid var(--border-strong); }
.dsn-sent { color: var(--success); border-color: #bfe3cd; background: #f1faf4; }
.dsn-pending, .dsn-retrying { color: var(--accent-dark); border-color: #cfe0ec; background: #eaf2f8; }
.dsn-failed { color: var(--danger); border-color: #f2c6c2; background: #fdeceb; }
.dsn-skipped { color: #b9770e; border-color: #f0e2b6; background: var(--warning-bg); }
.dsn-none { color: var(--muted); }
.dsn-error { color: var(--danger); }

/* spam check */
.notice { padding: .6rem .9rem; border-radius: var(--radius); font-size: .9rem; margin: .6rem 0; }
.notice-info { background: #eaf2f8; border: 1px solid #cfe0ec; color: var(--accent-dark); }
.notice-warn { background: var(--warning-bg); border: 1px solid #f0e2b6; color: #8a6d3b; }
.score-badge { font-size: 1.15rem; font-weight: 700; padding: .2rem .8rem; border-radius: 999px; }
.score-good { background: #e6f6ec; color: var(--success); border: 1px solid #bfe3cd; }
.score-mid { background: var(--warning-bg); color: #b9770e; border: 1px solid #f0e2b6; }
.score-bad { background: #fdeceb; color: var(--danger); border: 1px solid #f2c6c2; }
.score-bar { height: 8px; background: #eef2f5; border-radius: 999px; overflow: hidden; margin: .6rem 0 1rem; }
.score-fill { height: 100%; background: linear-gradient(90deg, var(--danger), var(--warning), var(--success)); }
.ai-comment { background: #f8fafc; border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.ai-comment .ai-head { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .3rem; }
.ai-comment p { margin: 0; color: var(--text-strong); }
.spam-checks .check { padding: .8rem 0; }
.check-detail summary { cursor: pointer; color: var(--link); font-size: .85rem; margin-top: .35rem; }
.detail-block { margin: .7rem 0; }
.detail-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .3rem; }
/* Wrap long tokens (DKIM keys, URLs); horizontal scrollbar as a fallback so
   content can never escape the card. */
pre.how { margin: 0; padding: .7rem .85rem; background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  max-width: 100%; overflow-x: auto; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; }
.check-detail, .detail-block { min-width: 0; max-width: 100%; }
.detail-block > table { display: block; overflow-x: auto; }
.fix-list { margin: 0; padding-left: 1.1rem; }
.fix-list li { margin: .25rem 0; font-size: .9rem; overflow-wrap: anywhere; }
.symbols { table-layout: fixed; }
.symbols th { text-align: left; color: var(--muted); font-weight: 400; font-size: .78rem; padding: .25rem .4rem; border-bottom: 1px solid var(--border); }
.symbols th:nth-child(1) { width: 3.6rem; }
.symbols th:nth-child(2) { width: 34%; }
.symbols td { padding: .25rem .4rem; border-bottom: 1px solid var(--border); font-size: .82rem; vertical-align: top; overflow-wrap: anywhere; }
.symbols code { word-break: break-all; }
pre.body.source { max-height: 560px; overflow-y: auto; }
.sym-bad td:first-child { color: var(--danger); font-weight: 700; }
.sym-good td:first-child { color: var(--success); font-weight: 700; }

/* admin */
.admin-bar { background: var(--warning-bg); border: 1px solid #f0e2b6; color: #8a6d3b; padding: .5rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .85rem; }
.admin-table th { background: #fafbfc; }
.behavior-tag { font-size: .72rem; padding: .1rem .45rem; border-radius: 4px; background: #eef2f5; color: var(--accent-dark); }
/* Wide admin tables scroll inside the card instead of stretching the page. */
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll table { min-width: 720px; }
#admin-tabs .counter { margin-left: .35rem; }

/* domain risk */
.result-badge, .decision-badge { font-size: .75rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.result-ok { background: #e6f6ec; color: var(--success); border-color: #bfe3cd; }
.result-not_ok { background: #fdeceb; color: var(--danger); border-color: #f2c6c2; }
.result-unknown { background: var(--warning-bg); color: #8a6d3b; border-color: #f0e2b6; }
.decision-allow { background: #e6f6ec; color: var(--success); border-color: #bfe3cd; }
.decision-limited { background: var(--warning-bg); color: #b9770e; border-color: #f0e2b6; }
.decision-deny { background: #fdeceb; color: var(--danger); border-color: #f2c6c2; }
.timing-badge { font-size: .72rem; font-weight: 400; color: var(--muted); background: #eef2f5; padding: .05rem .4rem; border-radius: 4px; margin-left: .4rem; }
.fix-inline { margin-top: .25rem; color: var(--accent-dark); font-size: .85rem; }
.verif-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .5rem .9rem; }
.verif-item { display: flex; align-items: center; gap: .5rem; font-size: .9rem; min-width: 0; }
.verif-icon { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.v-ok { background: #e6f6ec; color: var(--success); }
.v-no { background: #fdeceb; color: var(--danger); }
.check-toggles { display: flex; flex-direction: column; gap: .1rem; max-width: 620px; }
.toggle-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .2rem; border-bottom: 1px solid var(--border); font-weight: 400; }
.toggle-row input { width: 16px; height: 16px; }
.toggle-name { font-weight: 700; color: var(--text-strong); }
.toggle-key { margin-left: auto; }
.toggle-locked { opacity: .7; }
.check-toggles button { margin-top: .9rem; align-self: flex-start; }

/* public domain check + bulk form */
.domain-form input[type=text] { font-family: "SF Mono", Menlo, Consolas, monospace; }
.verdict { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--border); }
.verdict-mark { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; }
.verdict-title { font-size: 1.15rem; font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.verdict-text { color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.verdict-ok { background: #f1faf4; border-color: #bfe3cd; }
.verdict-ok .verdict-mark { background: #e6f6ec; color: var(--success); }
.verdict-bad { background: #fdf3f2; border-color: #f2c6c2; }
.verdict-bad .verdict-mark { background: #fdeceb; color: var(--danger); }
.verdict-invalid { background: var(--warning-bg); border-color: #f0e2b6; }
.verdict-invalid .verdict-mark { background: #fbf1cf; color: #b9770e; }
.bulk-form { display: flex; flex-direction: column; gap: .45rem; max-width: 720px; }
.bulk-form textarea {
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; padding: .6rem .75rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius); resize: vertical; width: 100%;
}
.bulk-form textarea:focus { outline: 3px solid #d8e8f8; border-color: #0783d9; }
.bulk-form button { margin-top: .7rem; align-self: flex-start; }
.reason-cell code { font-size: .72rem; display: inline-block; margin: .05rem .15rem .05rem 0; }

/* filter bar + destructive clear */
.filter-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin: .2rem 0 1rem; padding: .6rem .75rem; background: #fafbfc;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.filter-bar label { font-size: .82rem; color: var(--muted); font-weight: 400; }
.filter-bar select, .filter-bar input[type=search] { font-size: .85rem; padding: .3rem .5rem; }
.filter-bar input[type=search] {
  border: 1px solid var(--border-strong); border-radius: var(--radius); min-width: 200px;
}
.filter-bar .btn-secondary { padding: .3rem .7rem; font-size: .85rem; cursor: pointer; }
.clear-form { display: inline-flex; align-items: center; gap: .35rem; }
.clear-form select { font-size: .8rem; padding: .28rem .45rem; }
.btn-danger {
  background: #fff; color: var(--danger); border: 1px solid #f2c6c2;
  border-radius: var(--radius); padding: .32rem .75rem; font-size: .85rem;
  cursor: pointer; font-weight: 700;
}
.btn-danger:hover { background: #fdeceb; }
/* rows that need attention are tinted, so they read even without sorting */
.inbox-row.row-bad td { background: #fdf6f5; }
.inbox-row.row-warn td { background: #fdfaf1; }
.inbox-row.row-bad:hover td { background: #fbeceb; }
.inbox-row.row-warn:hover td { background: #faf3e2; }

/* pagination */
.pager { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; flex-wrap: wrap; }
.pager-btn {
  padding: .35rem .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--link); text-decoration: none; background: #fff; font-size: .85rem;
}
.pager-btn:hover { background: #f1f5f9; }
.pager-btn.disabled { opacity: .4; pointer-events: none; }
.pager-info { color: var(--muted); font-size: .85rem; }
.head-actions { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
/* tabs are links now, so they need the anchor reset */
#admin-tabs .tab { text-decoration: none; display: inline-flex; align-items: center; }
#admin-tabs .tab.active .counter { background: #fff; color: var(--primary); }

/* duration colouring is applied inline by JS; keep the base monospace look */
.dur { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: .82rem; white-space: nowrap; }

/* settings dialog */
.settings-dialog {
  border: none; border-radius: var(--radius); padding: 0; max-width: 720px; width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(36, 52, 69, .25); color: var(--text);
}
.settings-dialog::backdrop { background: rgba(36, 52, 69, .45); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff;
}
.dialog-head h2 { margin: 0; }
.dialog-close { border: none; background: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); padding: .2rem .4rem; }
.dialog-close:hover { color: var(--text-strong); }
.dialog-body { padding: 1rem 1.25rem; max-height: min(65vh, 620px); overflow-y: auto; }
.dialog-foot {
  display: flex; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: #fff; flex-wrap: wrap;
}
.dialog-foot .btn-secondary { border: 1px solid var(--border-strong); cursor: pointer; font-size: .95rem; }
.settings-section { margin-bottom: 1.4rem; }
.settings-section h3 { font-size: .95rem; color: var(--text-strong); margin: 0 0 .4rem; }
.param-row { margin-bottom: .8rem; }
.param-row label { display: block; font-size: .88rem; margin-bottom: .2rem; }
.param-row input[type=text], .param-row input[type=number] {
  width: 100%; max-width: 380px; font-size: .9rem; padding: .4rem .6rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.param-row .hint { margin: .2rem 0 0; }
.doh-group { margin-bottom: 1rem; }
.doh-group-head {
  font-size: .8rem; font-weight: 700; color: var(--accent-dark); background: #eef2f5;
  padding: .25rem .5rem; border-radius: 4px; margin-bottom: .3rem;
}
.doh-table th:first-child, .doh-table td:first-child { width: 28px; }
.doh-table td { vertical-align: middle; }
.doh-url { font-size: .68rem; word-break: break-all; }
.override-tag {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: var(--accent-dark);
  background: #eaf2f8; border: 1px solid #cfe0ec; border-radius: 999px; padding: 0 .4rem; margin-left: .4rem;
}
