/* ==========================================================================
   PostedApi backoffice (app.css)
   Application shell + components for /dashboard, /servers/*, /senders,
   /domains and the auth pages. The marketing site (style.css) is untouched.
   Palette: yellow #FFD23F, ink #20242C, blue #2E6BE6, green #1F9D57,
   red #DE4A2A, white background, hairlines #E5E5E5.
   ========================================================================== */

:root {
  --yellow: #FFD23F;
  --ink: #20242C;
  --cream: #FFFBE9;
  --green: #1F9D57;
  --red: #DE4A2A;
  --blue: #2E6BE6;

  --ink-2: #4A5160;
  --ink-3: #8A92A5;
  --line: #E5E5E5;
  --bg: #FFFFFF;
  --card: #FFFFFF;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;

  --radius: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(32, 36, 44, .06);
  --shadow-lg: 0 12px 32px rgba(32, 36, 44, .10);
  --content-w: 1040px;
  --topbar-w: 1240px;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over component display rules
   (create block, search-filtered rows, ...). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }

.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-size: .88em; }

/* --------------------------------------------------------------------------
   Top bar (yellow) — brand, main nav, emails counter, user, logout
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--yellow);
}

.topbar-inner {
  max-width: var(--topbar-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.topbar-brand { display: flex; align-items: center; flex-shrink: 0; }
.topbar-brand:hover { text-decoration: none; }
.brand-box {
  width: 30px;
  height: 30px;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(32, 36, 44, .18);
}

.topbar-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }

.topbar-link {
  color: var(--ink);
  font-weight: 700;
  font-size: .92rem;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.topbar-link:hover { background: rgba(32, 36, 44, .09); text-decoration: none; }
.topbar-link.active, .topbar-link.active:hover { background: var(--ink); color: #fff; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.emails-counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
  font-size: .88rem;
  white-space: nowrap;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  background: #fff;
  color: var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  box-shadow: 0 1px 2px rgba(32, 36, 44, .18);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Content column
   -------------------------------------------------------------------------- */

.app-content {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 40px 24px 80px;
  width: 100%;
}

.page-head { margin: 0 0 30px; }
.page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.page-sub { color: var(--ink-3); font-size: .92rem; margin: 6px 0 0; }
.section-title { font-size: 1.05rem; font-weight: 800; }

/* --------------------------------------------------------------------------
   Sender Signatures page
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.search-box { position: relative; width: 45%; min-width: 260px; }
.search-box > svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  font-family: inherit;
  font-size: .94rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 12px 40px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.search-box input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 210, 63, .5);
}
.search-box input::placeholder { color: var(--ink-3); }

.search-box-sm { width: 300px; min-width: 0; }

/* Two-column creation block (Add Domain / Add Signature) */

.create-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 26px 28px;
  margin: 0 0 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}
.create-block[hidden] { display: none; }
.create-block-single { grid-template-columns: 1fr; max-width: 560px; }
.create-title { font-size: 1rem; font-weight: 800; margin: 0 0 4px; }
.create-desc { color: var(--ink-3); font-size: .84rem; margin: 0 0 16px; }

/* Domain groups */

.domain-group { margin-bottom: 48px; }

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

.spark { width: 18px; height: 18px; flex-shrink: 0; color: #C9CDD6; }
.spark.ok { color: var(--green); }

.domain-name { font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }

.domain-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
}
.verify-badge.ok { color: var(--green); }
.verify-badge.ko { color: var(--red); }

.dns-link { font-weight: 700; font-size: .88rem; white-space: nowrap; }

.domain-divider { border: 0; border-top: 2px solid var(--ink); margin: 10px 0 2px; }

.group-empty { margin: 12px 0 0; font-size: .88rem; }

/* Signature rows */

.sig-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) minmax(130px, 1fr) minmax(130px, 1fr) auto 36px;
  gap: 14px;
  align-items: center;
  padding: 13px 2px;
  border-bottom: 1px solid #EEEEEE;
  font-size: .92rem;
}

.sig-email { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.sig-name { color: var(--ink); overflow-wrap: anywhere; }
.sig-reply { color: var(--ink); overflow-wrap: anywhere; }
.sig-placeholder { color: var(--ink-3); }

.sig-status { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sig-status form { display: inline-flex; margin: 0; }
.sig-delete { justify-self: end; margin: 0; }

.group-foot {
  padding-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.group-note { margin: 0; font-size: .86rem; color: var(--ink-2); }
.group-note a { font-weight: 700; }

.search-no-results {
  text-align: center;
  color: var(--ink-3);
  padding: 48px 0;
  font-size: .95rem;
}

/* --------------------------------------------------------------------------
   Server detail band + tabs
   -------------------------------------------------------------------------- */

.server-band { background: #fff; border-bottom: 1px solid var(--line); }

.server-band-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 20px 24px 0;
}

.server-band-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.server-band-head .dot { width: 10px; height: 10px; }
.server-band-head h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.server-band-head .sub { color: var(--ink-3); font-size: .82rem; }

.server-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.server-tab {
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .88rem;
  color: var(--ink-2);
  margin-bottom: 12px;
  white-space: nowrap;
}
.server-tab:hover { background: #F2F2F2; color: var(--ink); text-decoration: none; }
.server-tab.active, .server-tab.active:hover { background: var(--ink); color: #fff; }

/* --------------------------------------------------------------------------
   Cards, flash messages, banners
   -------------------------------------------------------------------------- */

.app-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}
.app-card + .app-card { margin-top: 24px; }
.app-card h2 { font-size: 1.02rem; font-weight: 800; margin-bottom: 4px; }
.app-card h3 { font-size: .92rem; font-weight: 800; }
.app-card .card-desc { color: var(--ink-3); font-size: .86rem; margin: 0 0 16px; }

.flash {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.flash-success { background: #E7F6EE; border-color: #BFE6CF; color: #14663B; }
.flash-error { background: #FDEAE4; border-color: #F2C4B8; color: #8A2B16; }
.flash-info { background: #E8EFFC; border-color: #C7D8F7; color: #1D4BAA; }

.api-error {
  background: #FFF6D6;
  border: 1px solid #FFE28A;
  color: #6B5600;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Servers table (dashboard)
   -------------------------------------------------------------------------- */

.servers-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

table.servers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.servers-table th {
  background: #F8F8F8;
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.servers-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #EEEEEE;
  vertical-align: middle;
}
.servers-table tbody tr:last-child td { border-bottom: 0; }
.servers-table tbody tr:hover { background: #FAFAFA; }

.servers-table .col-servers { width: 100%; }
.servers-table .col-count { width: 115px; }
.servers-table .col-deliverability { width: 190px; text-align: center; }
.servers-table .col-jump { width: 96px; text-align: right; }

.servers-table th.col-servers { display: table-cell; }
.servers-table .col-servers .dot-empty { margin-right: 8px; vertical-align: -1px; }
.dot-empty { background: transparent; box-shadow: none; }

.server-cell-name { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.server-cell-name a { font-weight: 600; overflow-wrap: anywhere; }

.deliv-good { color: var(--green); font-weight: 600; white-space: nowrap; }
.deliv-never { color: var(--ink-3); font-weight: 600; white-space: nowrap; }

.jump-links { display: inline-flex; align-items: center; gap: 4px; }
.jump-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  color: var(--ink-3);
  border-radius: 6px;
  line-height: 0;
}
.jump-link:hover { color: var(--ink); background: #F0F0F0; text-decoration: none; }

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px 14px;
}
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-value .unit { font-size: 1.05rem; font-weight: 700; color: var(--ink-3); }
.stat-label {
  margin-top: 4px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   CSS bar chart
   -------------------------------------------------------------------------- */

.chart-wrap { padding: 22px 24px 14px; }
.chart-legend {
  display: flex;
  gap: 18px;
  font-size: .78rem;
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 14px;
}
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch-sent { background: var(--blue); }
.swatch-opens { background: var(--green); }
.swatch-clicks { background: var(--yellow); border: 1px solid #E3B72E; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 190px;
  padding-top: 8px;
}
.chart-col {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 100%;
}
.chart-col .bar {
  width: 9px;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.bar-sent { background: var(--blue); }
.bar-opens { background: var(--green); }
.bar-clicks { background: var(--yellow); border: 1px solid #E3B72E; border-bottom: 0; }

.chart-x {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.chart-x span {
  flex: 1;
  font-size: .66rem;
  color: var(--ink-3);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.app-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

table.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.app-table th {
  background: #F8F8F8;
  text-align: left;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--ink-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.app-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #EEEEEE;
  vertical-align: middle;
}
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr:hover { background: #FAFAFA; }
.app-table .cell-main { font-weight: 700; color: var(--ink); }
.app-table .cell-sub { color: var(--ink-3); font-size: .8rem; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-green { background: #E7F6EE; color: var(--green); }
.badge-red { background: #FDEAE4; color: var(--red); }
.badge-grey { background: #EEF0F4; color: var(--ink-2); }
.badge-yellow { background: #FFF3C4; color: #8A6D00; }
.badge-blue { background: #E8EFFC; color: var(--blue); }
.badge-purple { background: #F0E8FC; color: #6D3AC2; }

/* Server color dots */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-blue { background: var(--blue); }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); box-shadow: inset 0 0 0 1px #E3B72E; }
.dot-red { background: var(--red); }
.dot-purple { background: #8B5CF6; }
.dot-grey { background: #9AA1B0; }
.dot-lg { width: 12px; height: 12px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--yellow); color: var(--ink); box-shadow: 0 1px 2px rgba(32,36,44,.12); }
.btn-primary:hover { background: #F2C72E; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #2559C4; }
.btn-outline-blue { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline-blue:hover { background: #EEF3FE; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-danger { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn-danger:hover { background: #FDEAE4; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #141820; }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: 7px; }
.btn-block { width: 100%; }

/* Icon-only buttons (delete trash cans) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 5px;
  margin: 0;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 6px;
  line-height: 0;
}
.icon-btn:hover { color: var(--red); background: #F6F6F6; }

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

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field textarea,
.field select {
  width: 100%;
  font-family: inherit;
  font-size: .92rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid #D8D8D8;
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46, 107, 230, .16);
}
.field .hint { font-size: .76rem; color: var(--ink-3); margin: 5px 0 0; }
.field-error { color: var(--red); font-size: .8rem; font-weight: 600; margin: 5px 0 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }

/* Filter bar (Activity tab) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.filter-bar .field { margin-bottom: 0; min-width: 170px; flex: 1; }
.filter-bar .field.status { flex: 0 0 150px; }

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 56px 28px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--cream);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.empty-state p { color: var(--ink-3); margin: 0 auto 18px; max-width: 420px; font-size: .9rem; }

/* --------------------------------------------------------------------------
   Code block (editor style, mirrors style.css pre.code)
   -------------------------------------------------------------------------- */

.code-window {
  background: var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin: 14px 0 20px;
}
.code-window-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: #2A2F3A;
  border-bottom: 1px solid #3A4150;
}
.code-dot { width: 11px; height: 11px; border-radius: 50%; }
.code-dot.r { background: #FF5F57; }
.code-dot.y { background: #FEBC2E; }
.code-dot.g { background: #28C840; }
.code-title {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: #8A92A5;
  margin-left: 8px;
  flex: 1;
}
.code-copy {
  background: none;
  border: 1px solid #3A4150;
  color: #AAB1C0;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: 4px 10px;
  cursor: pointer;
}
.code-copy:hover { color: #fff; border-color: #566078; }

pre.code {
  margin: 0;
  padding: 16px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .84rem;
  line-height: 1.75;
  color: #E8EBF2;
  background: transparent;
}
pre.code, .code-window { counter-reset: line; }
pre.code .cl { display: block; position: relative; padding-left: 3.4em; white-space: pre; min-height: 1.75em; }
pre.code .cl::before {
  counter-increment: line;
  content: counter(line);
  position: absolute;
  left: 0;
  width: 2.2em;
  padding-right: 1em;
  text-align: right;
  color: #4D5568;
  user-select: none;
}
pre.code .cl:hover { background: rgba(255, 255, 255, .035); }
pre.code .c { color: #7D8598; font-style: italic; }
pre.code .k { color: #8AB4FF; }
pre.code .s { color: #9FE6A0; }

/* Inline code */
code.inline {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--cream);
  border: 1px solid var(--line);
  padding: .12em .45em;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   Token reveal / setup
   -------------------------------------------------------------------------- */

.token-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.token-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: .88rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.token-box code.placeholder { color: var(--ink-3); letter-spacing: .1em; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: .92rem; margin: 12px 0; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.kv dd.mono { font-weight: 500; }

/* --------------------------------------------------------------------------
   Danger zone
   -------------------------------------------------------------------------- */

.danger-zone {
  border: 1px solid var(--red);
  background: #FDF3F1;
  border-radius: 8px;
  padding: 18px 20px;
  margin-top: 24px;
}
.danger-zone h2 { color: var(--red); font-size: .95rem; font-weight: 800; margin-bottom: 4px; }
.danger-zone p { color: var(--ink-2); font-size: .86rem; margin: 0 0 14px; }

/* --------------------------------------------------------------------------
   Message detail timeline
   -------------------------------------------------------------------------- */

.message-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.timeline { list-style: none; margin: 0; padding: 4px 0 0 26px; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--line);
}
.timeline li { position: relative; padding: 0 0 18px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--ink-3);
}
.timeline li.good::before { border-color: var(--green); }
.timeline li.bad::before { border-color: var(--red); }
.timeline li.info::before { border-color: var(--blue); }
.timeline .t-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.timeline .t-type { font-weight: 700; font-size: .92rem; }
.timeline .t-time { margin-left: auto; color: var(--ink-3); font-size: .78rem; }
.timeline .t-detail { color: var(--ink-2); font-size: .84rem; margin-top: 3px; }

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 0;
  font-size: .86rem;
  color: var(--ink-2);
}
.pagination .pages { display: flex; gap: 8px; }

/* --------------------------------------------------------------------------
   Auth pages (login / register) — simplified yellow topbar + centered card
   -------------------------------------------------------------------------- */

.auth-topbar { background: var(--yellow); }
.auth-topbar-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
}
.auth-topbar .brand-box { width: 30px; height: 30px; }
.auth-topbar a:hover { text-decoration: none; }

.auth-page {
  min-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 40px 20px 32px;
}
.auth-back { margin-bottom: 16px; font-size: .85rem; font-weight: 600; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 34px 34px 30px;
  width: 100%;
  max-width: 400px;
}
.auth-card h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.auth-card .lead { color: var(--ink-3); font-size: .9rem; margin: 0 0 22px; }
.auth-alt { text-align: center; font-size: .86rem; color: var(--ink-2); margin: 20px 0 0; }
.auth-foot { margin-top: 24px; font-size: .76rem; color: var(--ink-3); text-align: center; }

.form-error-list {
  color: var(--red);
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: .84rem;
  font-weight: 600;
}
.auth-error {
  background: #FDEAE4;
  border: 1px solid #F2C4B8;
  color: #8A2B16;
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 600;
  padding: 10px 14px;
  margin: 0 0 16px;
}

/* --------------------------------------------------------------------------
   Misc layout helpers
   -------------------------------------------------------------------------- */

.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.split { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.back-link { font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.back-link:hover { color: var(--ink); }
.text-right { text-align: right; }

/* DNS record values (domain detail) — long TXT/CNAME values must wrap */
.dns-value {
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 420px;
  font-size: .8rem;
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   Account page (second tab bar + two-column sections)
   -------------------------------------------------------------------------- */

.account-tabs-bar { background: #fff; border-bottom: 1px solid var(--line); }

.account-tabs-inner { max-width: var(--content-w); margin: 0 auto; padding: 0 24px; }

.account-tabs { display: flex; gap: 26px; overflow-x: auto; }

.account-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 13px 2px 11px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
}
.account-tab svg { width: 15px; height: 15px; }
.account-tab:hover { color: var(--ink); text-decoration: none; }
.account-tab.active, .account-tab.active:hover { color: var(--green); border-bottom-color: var(--green); }

.account-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; margin: 6px 0 22px; }

.account-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.account-section {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 44px;
  padding: 26px 32px;
}
.account-section + .account-section { border-top: 1px solid #EEEEEE; }
.account-section-info h3 { font-size: 1rem; font-weight: 700; margin: 0 0 6px; }
.account-desc { color: var(--ink-3); font-size: .88rem; line-height: 1.55; margin: 0; max-width: 340px; }

.repeatable-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.repeatable-row input { flex: 1; min-width: 0; }
.repeatable-remove {
  background: none;
  border: 0;
  color: var(--ink-3);
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
}
.repeatable-remove:hover { color: var(--red); background: #F6F6F6; }

.btn-add-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 0;
  margin-bottom: 14px;
  color: var(--blue);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-add-link:hover { text-decoration: underline; }

.token-reveal {
  border: 1px solid #BFE6CF;
  background: #E7F6EE;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.token-reveal-title { font-weight: 700; font-size: .9rem; color: #14663B; margin-bottom: 8px; }
.token-reveal-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.token-reveal-row code {
  flex: 1;
  min-width: 260px;
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  overflow-wrap: anywhere;
}

.account-subtitle { font-size: 1.02rem; font-weight: 800; margin: 26px 0 14px; }
.account-note { color: var(--ink-3); font-size: .82rem; margin: 14px 2px 0; }

.current-plan-name { font-size: 1.15rem; font-weight: 800; }
.current-plan-price { font-size: .95rem; font-weight: 700; color: var(--ink-2); margin-left: 10px; }
.current-plan-meta { color: var(--ink-3); font-size: .88rem; margin-top: 4px; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
.plan-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-card.current { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.plan-card-name { font-weight: 800; font-size: 1.05rem; }
.plan-card-price { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.plan-card-price span { font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.plan-card-line { color: var(--ink-3); font-size: .84rem; }
.plan-card form, .plan-card .btn { margin-top: auto; }
.plan-card form { padding-top: 12px; }

.btn-current { background: #EEF0F4; color: var(--ink-3); cursor: default; width: 100%; }
.btn-current:hover { background: #EEF0F4; }

.addon-body { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.addon-price { font-weight: 700; font-size: .92rem; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 38px;
  height: 22px;
  background: #D8D8D8;
  border-radius: 999px;
  transition: background .15s ease;
  flex-shrink: 0;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(32, 36, 44, .25);
  transition: transform .15s ease;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(31, 157, 87, .3); }
.switch-label { font-size: .86rem; font-weight: 600; color: var(--ink-2); min-width: 56px; }

.form-row-3 { grid-template-columns: 2fr 1fr 2fr; }

.payment-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: .95rem;
  font-weight: 600;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.payment-empty svg { flex-shrink: 0; }

/* TOTP setup (registration + account) and 2FA status */
.qr-box {
  width: 216px;
  margin: 6px auto 18px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  line-height: 0;
}
.qr-box svg { width: 200px; height: 200px; }

.totp-secret-label { color: var(--ink-3); font-size: .82rem; margin: 0 0 4px; text-align: center; }
.totp-secret { text-align: center; margin: 0 0 20px; }
.totp-secret code {
  font-family: var(--font-mono);
  font-size: .85rem;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  letter-spacing: .06em;
}

.totp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.totp-actions form { display: inline-flex; align-items: center; gap: 10px; margin: 0; }

/* --------------------------------------------------------------------------
   Compact mobile fallback
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 8px 14px;
  }
  .topbar-nav { order: 3; width: 100%; }
  .topbar-actions { margin-left: auto; gap: 10px; }
  .emails-counter { font-size: .8rem; }

  .app-content { padding: 28px 16px 56px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { width: 100%; }
  .create-block { grid-template-columns: 1fr; gap: 22px; padding: 20px; }
  .sig-row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .sig-status { grid-column: 1; justify-content: flex-start; }
  .sig-delete { grid-column: 2; grid-row: 1; }
  .domain-head-actions { margin-left: 0; gap: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .server-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .account-section { grid-template-columns: 1fr; gap: 16px; padding: 22px 20px; }
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.form-row-3 { grid-template-columns: 1fr; }
}
