/* Zarbazan. Light theme only. Tokens live on :root so the whole UI can be retuned in one place. */

/* Zarbazan. Colour lives in tokens so light and dark themes stay in step.
   Light is the default. Dark follows the system setting unless the user picks a theme. */
:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-muted: #f7f8fb;
  --surface-hover: #eef2f8;
  --text: #1d2129;
  --text-muted: #5b6270;
  --text-faint: #8a909c;
  --line: #e2e6ee;
  --line-strong: #cfd5e0;
  --accent: #1d4ed8;
  --accent-hover: #1a43bd;
  --accent-soft: #e9efff;
  --accent-soft-hover: #dce6ff;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5300;
  --warn-soft: #fff4dc;
  --ok: #17663a;
  --ok-soft: #e6f4ec;
  --ok-dot: #1e8e3e;
  --unread: #fbfcff;
  --star: #e8a600;
  --chrome: #2b3240;
  --chrome-ink: #ffffff;
  --chrome-muted: #d5dbe6;
  --chrome-hover: rgba(255, 255, 255, 0.12);
  --hover: rgba(29, 33, 41, 0.07);
  --hover-strong: rgba(29, 33, 41, 0.08);
  --hover-subtle: rgba(29, 33, 41, 0.06);
  --input-bg: #fbfcfe;
  --overlay: rgba(16, 24, 40, 0.35);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, 0.14), 0 1px 3px rgba(16, 24, 40, 0.08);
  --radius: 6px;
  --radius-lg: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rail: 232px;
  --topbar: 112px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-muted: #1c222b;
  --surface-hover: #242b36;
  --text: #e6e9ef;
  --text-muted: #a4acba;
  --text-faint: #7d8594;
  --line: #2a313c;
  --line-strong: #3a4352;
  --accent: #6d9bff;
  --accent-hover: #8fb2ff;
  --accent-soft: #1d2b4a;
  --accent-soft-hover: #243659;
  --accent-ink: #0b1220;
  --danger: #ff8a80;
  --danger-soft: #3a1e1c;
  --warn: #f5c066;
  --warn-soft: #3a2d12;
  --ok: #7fd49c;
  --ok-soft: #173223;
  --ok-dot: #3fb36b;
  --unread: #1a2130;
  --star: #f5c066;
  --chrome: #222a36;
  --chrome-ink: #e6e9ef;
  --chrome-muted: #aab3c2;
  --chrome-hover: rgba(255, 255, 255, 0.08);
  --hover: rgba(230, 233, 239, 0.08);
  --hover-strong: rgba(230, 233, 239, 0.1);
  --hover-subtle: rgba(230, 233, 239, 0.07);
  --input-bg: #12171f;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  }

  :root:not([data-theme="light"]) .brand-mark {
    filter: invert(1);
    mix-blend-mode: screen;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-muted: #1c222b;
  --surface-hover: #242b36;
  --text: #e6e9ef;
  --text-muted: #a4acba;
  --text-faint: #7d8594;
  --line: #2a313c;
  --line-strong: #3a4352;
  --accent: #6d9bff;
  --accent-hover: #8fb2ff;
  --accent-soft: #1d2b4a;
  --accent-soft-hover: #243659;
  --accent-ink: #0b1220;
  --danger: #ff8a80;
  --danger-soft: #3a1e1c;
  --warn: #f5c066;
  --warn-soft: #3a2d12;
  --ok: #7fd49c;
  --ok-soft: #173223;
  --ok-dot: #3fb36b;
  --unread: #1a2130;
  --star: #f5c066;
  --chrome: #222a36;
  --chrome-ink: #e6e9ef;
  --chrome-muted: #aab3c2;
  --chrome-hover: rgba(255, 255, 255, 0.08);
  --hover: rgba(230, 233, 239, 0.08);
  --hover-strong: rgba(230, 233, 239, 0.1);
  --hover-subtle: rgba(230, 233, 239, 0.07);
  --input-bg: #12171f;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .brand-mark {
  filter: invert(1);
  mix-blend-mode: screen;
}

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

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
}

/* ---------- Buttons and fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-weight: 500;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-muted);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn--danger {
  color: var(--danger);
}

.btn--small {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field > span,
.label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.textarea {
  height: auto;
  min-height: 90px;
  padding: 10px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hint {
  color: var(--text-faint);
  font-size: 12px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin: 8px 0 0;
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

.notice--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.notice--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill--ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

.pill--warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.pill--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

/* ---------- Login ---------- */

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 32px 28px;
  box-shadow: var(--shadow-1);
}

.login__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: block;
  width: 52px;
  height: 52px;
  flex: none;
  border: 0;
  border-radius: 0;
  background: none;
}

.login__brand .brand-mark {
  width: 120px;
  height: 120px;
}

.login__card h1 {
  font-size: 20px;
  margin-bottom: 4px;
}

.login__card p {
  color: var(--text-muted);
  margin: 0 0 22px;
}

.login__card .btn {
  width: 100%;
  justify-content: center;
  height: 38px;
  margin-top: 6px;
}

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

.shell {
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  grid-template-rows: var(--topbar) 1fr;
  grid-template-areas:
    "top top"
    "rail main";
}

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px 0 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--rail);
  height: 100%;
}

.topbar__brand .brand-mark {
  width: 96px;
  height: 96px;
}

.search {
  flex: 1;
  max-width: 640px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid transparent;
}

.search:focus-within {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}

.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
}

.search svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex: none;
}

.topbar__spacer {
  flex: 1;
}

.product-select {
  height: 34px;
  min-width: 170px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.rail {
  grid-area: rail;
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}

.rail__compose {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 20px 0 16px;
  margin: 0 0 12px 4px;
  border: 0;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-1);
}

.rail__compose:hover {
  background: var(--accent-soft-hover);
}

.rail__compose svg {
  width: 20px;
  height: 20px;
}

.rail__section {
  margin: 16px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 0 18px 18px 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.nav:hover {
  background: var(--surface-muted);
}

.nav[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--text-muted);
}

.nav[aria-current="page"] svg {
  color: var(--accent);
}

.nav__count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  margin: 0 8px 8px 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border: 1px solid var(--line);
  border-top: 0;
  overflow: hidden;
}

.main__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.main__head h1 {
  font-size: 16px;
}

.main__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  height: 100%;
  min-height: 240px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

.empty strong {
  color: var(--text);
  font-size: 15px;
}

/* ---------- Mail list ---------- */

.thread-row {
  display: grid;
  grid-template-columns: 36px 24px 200px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13.5px;
}

.thread-row:hover {
  box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line), var(--shadow-1);
  position: relative;
  z-index: 1;
}

.thread-row--unread {
  font-weight: 600;
  background: var(--unread);
}

.thread-row__star {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  border-radius: 50%;
}

.thread-row__star svg {
  width: 16px;
  height: 16px;
}

.thread-row__star[aria-pressed="true"] {
  color: var(--star);
}

.thread-row__star[aria-pressed="true"] svg {
  fill: currentColor;
}

.thread-row__from,
.thread-row__subject,
.thread-row__date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-row__subject {
  font-weight: inherit;
}

.thread-row__snippet {
  color: var(--text-muted);
  font-weight: 400;
}

.thread-row__count {
  margin-left: 6px;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}

.thread-row__date {
  text-align: right;
  color: var(--text-muted);
  font-size: 12px;
}

.thread-row--unread .thread-row__date {
  color: var(--text);
}

.thread-row__check {
  width: 15px;
  height: 15px;
  margin: 0 auto;
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12.5px;
}

.list-toolbar__meta {
  margin-left: auto;
}

/* ---------- Thread view ---------- */

.thread {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 28px 40px;
}

.thread__top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.thread__title {
  font-size: 20px;
  line-height: 1.3;
  margin: 6px 0 18px;
  font-weight: 500;
}

.message {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  background: var(--surface);
}

.message__head {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px 6px;
}

.message__who {
  line-height: 1.35;
}

.message__who strong {
  font-weight: 600;
}

.message__who span {
  color: var(--text-muted);
  font-size: 12.5px;
}

.message__meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.message__body {
  padding: 4px 16px 16px 64px;
}

.message__body iframe {
  width: 100%;
  border: 0;
  min-height: 80px;
  display: block;
  background: #fff;
}

.message__text {
  white-space: pre-wrap;
  margin: 0;
  font: inherit;
  color: var(--text);
}

.message__actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px 64px;
}

.message--out .avatar {
  background: var(--surface-muted);
  color: var(--text-muted);
}

/* ---------- Compose ---------- */

.compose {
  position: fixed;
  right: 24px;
  bottom: 0;
  width: 560px;
  max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  box-shadow: var(--shadow-2);
  z-index: 20;
}

.compose > * {
  flex: none;
}

.compose__body {
  flex: 1 1 0;
  min-height: 0;
}

.compose__checks {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.compose--min {
  height: auto;
}

.compose--min .compose__fields,
.compose--min .compose__toolbar,
.compose--min .compose__middle,
.compose--min .compose__vars,
.compose--min .compose__foot {
  display: none;
}

.compose__head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 6px 0 14px;
  background: var(--chrome);
  color: var(--chrome-ink);
  border-radius: 10px 10px 0 0;
  font-weight: 600;
  font-size: 13.5px;
}

.compose__head .icon-btn {
  color: var(--chrome-muted);
  width: 30px;
  height: 30px;
}

.compose__head .icon-btn:hover {
  background: var(--chrome-hover);
  color: var(--chrome-ink);
}

.compose__head .spacer {
  flex: 1;
}

.compose > .compose__middle {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
}

.compose--preview {
  width: min(960px, calc(100vw - 32px));
}

.compose__preview {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface-muted);
}

.compose__preview-head {
  padding: 10px 14px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.compose__preview-subject {
  padding: 6px 14px 10px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.compose__preview-frame {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.compose__middle > .compose__body {
  flex: 1 1 0;
  min-width: 0;
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.compose__fields {
  display: grid;
  border-bottom: 1px solid var(--line);
}

.compose__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.compose__row:last-child {
  border-bottom: 0;
}

.compose__row > span {
  width: 56px;
  color: var(--text-muted);
  font-size: 13px;
}

.compose__row select {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.compose__row input {
  flex: 1;
  border: 0;
  outline: none;
  height: 38px;
  background: transparent;
  min-width: 0;
}

.compose__row--subject input {
  font-weight: 500;
}

.compose__suggest {
  position: absolute;
  top: 100%;
  left: 60px;
  right: 14px;
  z-index: 5;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  max-height: 220px;
  overflow-y: auto;
}

.compose__suggest button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}

.compose__suggest button:hover,
.compose__suggest button[aria-selected="true"] {
  background: var(--accent-soft);
}

.compose__suggest small {
  color: var(--text-muted);
}

.compose__toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.compose__toolbar select {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 0 6px;
  font-size: 13px;
  margin-right: 4px;
}

.tool {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.tool:hover {
  background: var(--hover-strong);
}

.tool[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.tool svg {
  width: 16px;
  height: 16px;
}

.tool__swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.tool-sep {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--line-strong);
}

.compose__body {
  display: flex;
  flex-direction: column;
  position: relative;
}

.rte {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 14px 16px;
  outline: none;
  font-size: 14px;
  line-height: 1.55;
  font-family: Arial, Helvetica, sans-serif;
}

.rte:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
}

.rte blockquote {
  margin: 10px 0 10px 4px;
  padding-left: 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--text-muted);
}

.rte img {
  max-width: 100%;
  height: auto;
}

.rte hr {
  border: 0;
  border-top: 1px solid var(--line-strong);
  margin: 12px 0;
}

.rte h2 {
  font-size: 20px;
  margin: 12px 0 6px;
}

.compose__source--plain {
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface);
}

.compose__source {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  background: var(--input-bg);
}

.compose__vars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.compose__vars label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.compose__vars input {
  height: 28px;
  width: 150px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

.compose__foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
}

.compose__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose__actions .spacer {
  flex: 1;
}

.check {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}

.check__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check__head button {
  margin-left: auto;
}

.check ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
}

.check li + li {
  margin-top: 4px;
}

.check code {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--hover-subtle);
  padding: 1px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.segmented button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text-muted);
}

.segmented button + button {
  border-left: 1px solid var(--line-strong);
}

.segmented button:hover {
  background: var(--surface-muted);
}

.segmented button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.check__override {
  display: grid;
  gap: 6px;
}

.check__ack {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check--block {
  background: var(--danger-soft);
  border-color: transparent;
}

.check--warn {
  background: var(--warn-soft);
  border-color: transparent;
}

.check--pass {
  background: var(--ok-soft);
  border-color: transparent;
}

/* ---------- Tables and admin ---------- */

.content {
  padding: 24px 28px 40px;
  max-width: 1080px;
}

.content__head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.content__head h1 {
  font-size: 22px;
}

.content__head p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.content__head .btn {
  margin-left: auto;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
}

tr:last-child td {
  border-bottom: 0;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.muted {
  color: var(--text-muted);
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px;
  margin-bottom: 18px;
}

.card h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.card > p.muted {
  margin: 0 0 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 14px;
  align-items: end;
}

.form-grid .btn {
  margin-bottom: 14px;
}

.dns-table code {
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
}

.select--inline {
  height: 30px;
  width: auto;
  min-width: 190px;
  font-size: 13px;
}

.input--inline {
  height: 30px;
  width: 200px;
  font-size: 13px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--text-faint);
  vertical-align: middle;
}

.status-dot--ok {
  background: var(--ok-dot);
}

.status-dot--bad {
  background: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--chrome);
  color: var(--chrome-ink);
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
  z-index: 40;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 24px;
}

.dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 22px 22px 18px;
}

.dialog h2 {
  font-size: 17px;
  margin-bottom: 14px;
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.preview-frame {
  width: 100%;
  height: min(70vh, 640px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  :root {
    --rail: 64px;
  }

  .compose__middle {
    flex-direction: column;
  }


  .compose__preview {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  :root {
    --topbar: 72px;
  }

  .topbar__brand .brand-mark {
    width: 56px;
    height: 56px;
  }

  .topbar__brand span:last-child,
  .rail__label,
  .rail__section,
  .user-chip span {
    display: none;
  }

  .nav {
    justify-content: center;
    padding: 0;
    border-radius: 10px;
  }

  .rail__compose {
    padding: 0;
    justify-content: center;
  }

  .rail__compose span {
    display: none;
  }

  .thread-row {
    grid-template-columns: 24px 1fr 70px;
  }

  .thread-row__check,
  .thread-row__snippet {
    display: none;
  }

  .thread-row__star {
    display: none;
  }

  .compose {
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
  }

  .message__body {
    padding-left: 16px;
  }
}
