/* MailFlow — iTrackSuite theme (2026-11-10). Loaded after suite.css (itracksuite dashboard.css, unmodified).
   Same page grammar as the CRM: 16px-radius hairline panels with 20px padding, 24px rhythm, 15/500 headings,
   36px controls (28px small), hairline tables, IBM Plex Sans + Plex Mono for figures. Dark default, light via
   html[data-theme=light] (shared localStorage key "itracksuite-theme"). */
html:root { --mf-pad: 32px; }
* { box-sizing: border-box; }
body { margin: 0; font: 400 14px/20px var(--sans); background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); text-decoration: none; }
b, strong { font-weight: 500; }
h1 { font-size: 20px; line-height: 28px; font-weight: 500; margin: 0; }
h2 { font-size: 15px; line-height: 20px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 15px; line-height: 20px; font-weight: 500; margin: 20px 0 8px; }
.icon { vertical-align: -3px; flex: none; }

/* Shell (suite markup) */
.nav-menu { overflow-y: auto; flex: 1; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.nav-menu .nav-item { cursor: pointer; flex: none; }
.nav-menu, .tw, .modal-bg, pre { scrollbar-width: thin; scrollbar-color: var(--raised-2) transparent; }
.rail-label { font-size: 12px; line-height: 16px; color: var(--muted); padding: 16px 10px 4px; }
.sidebar-user a { color: var(--muted); }
.top-bar { margin: 0 0 var(--mf-pad); }
.top-bar .row { flex-wrap: nowrap; }
#main { min-height: 100vh; }
#main > :not(.top-bar) { margin-left: var(--mf-pad); margin-right: var(--mf-pad); max-width: 1376px; }
#main > :last-child { margin-bottom: 64px; }
#main > p.mut:only-child { margin-top: var(--mf-pad); }
.its-theme-btn svg, .icon-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Panels */
.card, .stat, .step, .aibox, .aibar { background: var(--card); border: 0; box-shadow: inset 0 0 0 1px var(--line); }
.card { border-radius: 16px; padding: 20px; margin-bottom: 24px; }
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 16px; margin-bottom: 24px; }
.grid > .card, .grid > .stat { margin-bottom: 0; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); }
.stat { border-radius: 12px; padding: 12px 16px; }
.stat b { display: block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -.01em; }
.stat span { color: var(--text-2); font-size: 12px; line-height: 16px; }
.step { border-radius: 12px; padding: 16px; margin: 12px 0; background: var(--raised); }
.aibar { border-radius: 12px; padding: 12px 16px; margin: 12px 0; background: var(--accent-soft); box-shadow: none; }
.aibox { border-radius: 12px; padding: 12px 16px; margin-top: 8px; background: var(--raised); }
.aibox.err { color: var(--neg); }
.aipre { white-space: pre-wrap; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); border: 0; border-radius: 8px; padding: 12px; max-height: 260px; overflow: auto; font: 13px/20px var(--sans); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: color-mix(in srgb, var(--raised) 60%, transparent); }
.tw { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
td .small, td .mut { font-size: 12px; }

/* Controls */
button, .btn { font: 500 13px/1 var(--sans); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  background: var(--btn-bg); color: var(--btn-ink); border: 0; border-radius: 8px; cursor: pointer; white-space: nowrap; box-shadow: var(--highlight);
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
button:hover, .btn:hover { background: var(--btn-hover); color: var(--btn-ink); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.sec, .btn.sec { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
button.sec:hover, .btn.sec:hover { background: var(--raised-2); color: var(--text); }
button.bad { background: transparent; color: var(--neg); box-shadow: inset 0 0 0 1px var(--line); }
button.bad:hover { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }
button.sm, .btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
button.icon-btn, button.its-theme-btn, button.mobile-menu-btn { background: none; box-shadow: none; color: var(--muted); padding: 0; width: 32px; height: 32px; }
button.icon-btn:hover, button.its-theme-btn:hover, button.mobile-menu-btn:hover { background: var(--raised); color: var(--text); }
button.mobile-menu-btn { display: none; }
input, select, textarea { font: 400 14px/20px var(--sans); width: 100%; height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
  background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
textarea { height: auto; min-height: 160px; padding: 10px 12px; font: 13px/20px var(--mono); }
input[type=checkbox], input[type=radio] { width: auto; height: auto; padding: 0; box-shadow: none; background: none; accent-color: var(--accent-fill); }
input[type=file] { height: auto; padding: 8px 12px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: none; box-shadow: var(--ring); }
html[data-theme=dark] select option, html:not([data-theme]) select option { background-color: #232325; color: #ededed; }
html[data-theme=light] select option { background-color: #fff; color: #171717; }
label { display: block; font-size: 13px; line-height: 20px; color: var(--text-2); margin: 12px 0 4px; }
label.chk { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row > * { flex: 0 1 auto; } .row .grow { flex: 1 1 200px; }
.cond { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; } .cond select, .cond input { width: auto; flex: 1 1 120px; }

/* Status: quiet tinted pills */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; line-height: 16px; font-weight: 500; background: var(--accent-soft); color: var(--accent); }
.b-active, .b-ok, .b-sent { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
.b-pending, .b-warning, .b-scheduled, .b-sending, .b-untested { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.b-bounced, .b-complained, .b-error, .b-failed, .b-uncertain { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }
.b-unsubscribed, .b-draft, .b-paused, .b-cancelled, .b-skipped { background: var(--raised); color: var(--text-2); }
.mut { color: var(--text-2); } .small { font-size: 13px; line-height: 20px; } .err { color: var(--neg); } .ok { color: var(--pos); }
.nw { white-space: nowrap; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent-fill); }

/* Notices */
.banner { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 16px; border-radius: 12px; margin-bottom: 24px; font-size: 13px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); border: 0; }
.banner b { color: var(--text); }
.banner.dry, .banner.gr-warn { background: color-mix(in srgb, var(--warn) 14%, var(--card)); color: var(--warn); box-shadow: none; border: 0; }
.banner.sink { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.banner.live { background: color-mix(in srgb, var(--pos) 14%, var(--card)); color: var(--pos); box-shadow: none; }
.banner.gr-pause { background: color-mix(in srgb, var(--neg) 14%, var(--card)); color: var(--neg); box-shadow: none; border: 0; }
.banner a { color: inherit; text-decoration: underline; }

/* Modal (MailFlow's own: .modal-bg > .modal) */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow: auto; z-index: 2000; }
html[data-theme=light] .modal-bg { background: rgba(23, 23, 23, .28); }
.modal-bg .modal { display: block; position: relative; inset: auto; z-index: auto; background: var(--card); border-radius: 16px; padding: 24px; width: 100%; max-width: 640px;
  box-shadow: var(--float), inset 0 0 0 1px var(--line); }
.modal-bg .modal.wide { max-width: 960px; }
.modal h2 { font-size: 16px; line-height: 24px; margin-bottom: 8px; }
#toast { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
#toast div { background: var(--raised-2); color: var(--text); padding: 10px 14px; border-radius: 8px; box-shadow: var(--float), inset 0 0 0 1px var(--line); max-width: 360px; font-size: 13px; }
#toast div.e { color: var(--neg); }

/* Sign in */
.login { max-width: 380px; margin: 14vh auto; }
.login.card { padding: 32px; }
.login .its-brand { margin-bottom: 20px; }
.login form { padding: 6px 0 0; }
.login button { margin-top: 16px; }

/* Code, previews */
pre, code { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--raised); color: var(--text); padding: 12px; border-radius: 8px; overflow: auto; white-space: pre-wrap; word-break: break-all; box-shadow: inset 0 0 0 1px var(--line); }
code { background: var(--raised); border-radius: 4px; padding: 1px 5px; }
iframe.prev { width: 100%; height: 420px; border: 0; box-shadow: 0 0 0 1px var(--line); border-radius: 8px; background: #fff; }
details > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }

/* Graphs: hairline axis, muted labels, token colours */
.chart { width: 100%; height: 150px; }
.chart text { fill: var(--muted); font-family: var(--mono); }
.chart line { stroke: var(--line-2); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.bar { height: 4px; background: var(--raised-2); border-radius: 2px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--text-2); border-radius: 2px; }
.spin { display: flex; gap: 10px; align-items: center; color: var(--text-2); font-size: 13px; padding: 6px 0; }
.spin i { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--accent-fill); border-radius: 50%; animation: mfspin .8s linear infinite; flex: none; }
@keyframes mfspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin i { animation: none; } }

/* Legacy inline styles from the JS, pulled onto the system */
[style*="font-weight:700"], [style*="font-weight:600"], [style*="font-weight: 600"] { font-weight: 500 !important; }
[style*="color:#111827"], [style*="color:#374151"], [style*="color: #111827"] { color: var(--text) !important; }
[style*="color:#6b7280"], [style*="color:#9ca3af"] { color: var(--text-2) !important; }
[style*="background:#fff"], [style*="background:#f9fafb"], [style*="background:#fafafa"], [style*="background:#f3f4f6"], [style*="background: #fff"] { background: var(--raised) !important; color: var(--text) !important; }
[style*="border:1px solid #"], [style*="border: 1px solid #"] { border-color: var(--line-2) !important; }

@media (max-width: 860px) {
  html:root { --mf-pad: 16px; }
  button.mobile-menu-btn { display: inline-grid; }
  .sidebar { transform: translateX(-100%); transition: transform 300ms var(--ease); } .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g2 { grid-template-columns: 1fr; }
}
