/* ==========================================================================
   PostaGPT — editorial mail gateway
   A single stylesheet, no external assets, no inline styles (strict CSP).
   ========================================================================== */

:root {
  --paper: #f2eee4;
  --paper-2: #fbf9f3;
  --paper-3: #eae5d8;
  --ink: #18211c;
  --ink-soft: #34423a;
  --muted: #55605a;
  --muted-2: #5f6a63;
  --line: rgba(24, 33, 28, 0.12);
  --line-strong: rgba(24, 33, 28, 0.22);
  --forest: #1d4b39;
  --forest-deep: #113327;
  --forest-soft: #2d6650;
  --gold: #d4a03c;
  --gold-soft: #f1dfb5;
  --clay: #b4553c;
  --clay-soft: #f4ddd6;
  --sky: #3e6b8c;
  --white: #fffdf8;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 24, 0.06), 0 4px 14px rgba(20, 30, 24, 0.04);
  --shadow-md: 0 18px 50px rgba(20, 30, 24, 0.16);
  --shadow-lg: 0 30px 90px rgba(10, 20, 14, 0.32);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: "SFMono-Regular", ui-monospace, "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --sidebar-w: 272px;
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote {
  margin: 0;
}

a {
  color: var(--forest);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

button {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--gold-soft);
  color: var(--forest-deep);
}

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

.icon {
  width: 19px;
  height: 19px;
  flex: none;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -120px;
  left: 16px;
  z-index: 1000;
  padding: 10px 18px;
  background: var(--forest);
  color: var(--white);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
  transition: top 0.16s var(--ease);
}

.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

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

.small {
  font-size: 0.82rem;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Boot ---------- */

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.boot-mark {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.boot-mark span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--forest);
  animation: boot-pulse 1.1s infinite var(--ease);
}

.boot-mark span:nth-child(2) { animation-delay: 0.12s; }
.boot-mark span:nth-child(3) { animation-delay: 0.24s; }

@keyframes boot-pulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease);
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--forest);
  color: var(--white);
  border-color: var(--forest);
}
.btn-primary:hover { background: var(--forest-deep); border-color: var(--forest-deep); }

.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #2c2108;
}
.btn-gold:hover { background: #c3902d; border-color: #c3902d; }

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover { background: rgba(24, 33, 28, 0.05); }

.btn-subtle {
  color: var(--muted);
  padding: 0 10px;
}
.btn-subtle:hover { background: rgba(24, 33, 28, 0.06); color: var(--ink); }

.btn-danger {
  background: transparent;
  border-color: rgba(180, 85, 60, 0.4);
  color: var(--clay);
}
.btn-danger:hover { background: var(--clay-soft); }

.btn-danger-solid {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--white);
}
.btn-danger-solid:hover { background: #9d452f; border-color: #9d452f; }

.btn-sm {
  min-height: 31px;
  padding: 0 11px;
  font-size: 0.78rem;
}

.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.icon-btn:hover { background: rgba(24, 33, 28, 0.07); color: var(--ink); }
.icon-btn.is-on { color: var(--gold); }
.icon-btn.is-danger:hover { background: var(--clay-soft); color: var(--clay); }

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.input::placeholder,
.textarea::placeholder { color: var(--muted-2); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--forest-soft);
  box-shadow: 0 0 0 3px rgba(45, 102, 80, 0.13);
}

.textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.hint {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 2fr 0.8fr 1fr;
  gap: 12px;
  align-items: end;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.check input[type="checkbox"],
.check input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--forest);
  flex: none;
}

.check small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 2px;
}

.check-consent {
  margin-left: 25px;
  padding: 9px 11px;
  border-left: 2px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(212, 160, 60, 0.09);
}

.form-error {
  display: none;
  padding: 10px 13px;
  border: 1px solid rgba(180, 85, 60, 0.35);
  border-radius: var(--radius-sm);
  background: var(--clay-soft);
  color: #7e3522;
  font-size: 0.84rem;
}

.form-error.is-visible { display: block; }

/* ---------- Auth ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
}

.auth-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(28px, 5vw, 64px);
  background:
    radial-gradient(120% 80% at 12% 0%, rgba(212, 160, 60, 0.18), transparent 55%),
    radial-gradient(90% 70% at 100% 100%, rgba(45, 102, 80, 0.6), transparent 60%),
    var(--forest-deep);
  color: #eef1e9;
}

.auth-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 80%);
}

.auth-art > * { position: relative; z-index: 1; }

.brand-light {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--gold);
  color: var(--forest-deep);
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: -0.04em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.auth-copy { max-width: 620px; }

.auth-copy .eyebrow { color: var(--gold); }

.auth-copy h1 {
  margin: 16px 0 18px;
  font-family: var(--font-display);
  font-size: clamp(2.9rem, 5.6vw, 5rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.auth-copy h1 em {
  font-style: italic;
  color: var(--gold);
}

.auth-lede {
  max-width: 46ch;
  color: rgba(238, 241, 233, 0.72);
  font-size: 1.02rem;
  line-height: 1.65;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.auth-points li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid rgba(238, 241, 233, 0.18);
  border-radius: 999px;
  color: rgba(238, 241, 233, 0.82);
  font-size: 0.76rem;
}

.auth-points .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.auth-terminal {
  max-width: 520px;
  border: 1px solid rgba(238, 241, 233, 0.16);
  border-radius: 13px;
  background: rgba(8, 22, 15, 0.62);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 13px;
  border-bottom: 1px solid rgba(238, 241, 233, 0.1);
}

.term-bar span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(238, 241, 233, 0.22);
}

.term-bar span:first-child { background: var(--clay); }
.term-bar span:nth-child(2) { background: var(--gold); }
.term-bar span:nth-child(3) { background: var(--forest-soft); }

.term-body {
  margin: 0;
  padding: 18px;
  color: rgba(238, 241, 233, 0.76);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-x: auto;
}

.term-body b { color: var(--gold); font-weight: 500; }
.term-body i { color: #9bc7b2; font-style: normal; }

.auth-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: clamp(28px, 6vw, 88px);
  background:
    radial-gradient(80% 50% at 100% 0%, rgba(212, 160, 60, 0.12), transparent 60%),
    var(--paper);
}

.auth-card {
  width: min(100%, 390px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-card .brand-dark {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.brand-dark .brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--forest); color: var(--gold); }

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-top: -8px;
}

.auth-card .btn { min-height: 45px; }

.auth-foot {
  width: min(100%, 390px);
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
  text-align: center;
}

.auth-foot .mono { color: var(--ink-soft); }

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px 18px;
  background:
    radial-gradient(90% 40% at 0% 0%, rgba(212, 160, 60, 0.13), transparent 60%),
    linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: rgba(255, 253, 248, 0.82);
  overflow: hidden;
  z-index: 30;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.26rem;
  letter-spacing: -0.015em;
}

.sidebar .brand .brand-mark {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--forest-deep);
  font-size: 0.82rem;
}

.brand small {
  display: block;
  margin-top: 1px;
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 253, 248, 0.42);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 253, 248, 0.66);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.nav-btn .icon { width: 18px; height: 18px; opacity: 0.8; }

.nav-btn:hover {
  background: rgba(255, 253, 248, 0.07);
  color: var(--white);
}

.nav-btn.is-active {
  background: rgba(255, 253, 248, 0.11);
  color: var(--white);
}

.nav-btn.is-active .icon { color: var(--gold); opacity: 1; }

.nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #2c2108;
  font-size: 0.64rem;
  font-weight: 700;
  text-align: center;
}

.side-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  color: rgba(255, 253, 248, 0.38);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.side-heading button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 253, 248, 0.5);
}

.side-heading button:hover { background: rgba(255, 253, 248, 0.1); color: var(--white); }

.side-accounts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.side-mailbox {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 253, 248, 0.65);
  font-size: 0.78rem;
  text-align: left;
  width: 100%;
}

.side-mailbox:hover { background: rgba(255, 253, 248, 0.07); color: var(--white); }
.side-mailbox.is-active { background: rgba(255, 253, 248, 0.1); color: var(--white); }

.mailbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

.mailbox-label { min-width: 0; flex: 1; }
.mailbox-label strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-label small { display: block; color: rgba(255, 253, 248, 0.38); font-size: 0.65rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: rgba(255, 253, 248, 0.45);
  font-size: 0.76rem;
  text-align: left;
  border-radius: 8px;
  text-decoration: none;
}

.side-add:hover { background: rgba(255, 253, 248, 0.06); color: var(--white); }

.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 253, 248, 0.11);
  display: flex;
  align-items: center;
  gap: 9px;
}

.side-foot .avatar { width: 32px; height: 32px; font-size: 0.7rem; }
.side-user { min-width: 0; flex: 1; }
.side-user strong { display: block; color: rgba(255, 253, 248, 0.88); font-size: 0.75rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.side-user small { display: block; color: rgba(255, 253, 248, 0.38); font-size: 0.62rem; }

.side-foot .icon-btn { color: rgba(255, 253, 248, 0.5); }
.side-foot .icon-btn:hover { background: rgba(255, 253, 248, 0.1); color: var(--white); }

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  border: 0;
  background: rgba(12, 22, 16, 0.45);
  backdrop-filter: blur(2px);
}

.main {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(70% 50% at 100% 0%, rgba(212, 160, 60, 0.07), transparent 55%),
    var(--paper);
}

.mobilebar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}

.mobilebar .brand-mini {
  font-family: var(--font-display);
  font-size: 1.08rem;
}

.view {
  flex: 1;
  min-height: 0;
  padding: clamp(20px, 3vw, 38px) clamp(18px, 3.4vw, 46px) 40px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 33, 28, 0.18) transparent;
}

.view-inbox {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.view-head h1 {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 2.6vw, 2.7rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.028em;
}

.view-head .sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.85rem;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Inbox ---------- */

.mail-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 26px;
}

.mail-list-panel,
.reader-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mail-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.searchbox {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 460px;
}

.searchbox .icon {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--muted);
  width: 17px;
  height: 17px;
}

.searchbox .input {
  min-height: 40px;
  padding-left: 39px;
  background: var(--paper-2);
}

.chip-row {
  display: flex;
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.5);
}

.chip {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.chip:hover { color: var(--ink); }
.chip.is-active { background: var(--forest); color: var(--white); }

.tool-select {
  min-height: 40px;
  max-width: 190px;
  padding: 8px 34px 8px 12px;
  font-size: 0.8rem;
  border-radius: 999px;
  background-color: var(--paper-2);
}

.list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.list-meta strong { color: var(--ink); font-weight: 600; }

.mail-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 33, 28, 0.16) transparent;
}

.mail-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 14px 14px 14px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.mail-row:hover { background: rgba(29, 75, 57, 0.045); }
.mail-row.is-active { background: rgba(29, 75, 57, 0.08); }
/*
 * The row itself is not a button: an interactive row cannot legally contain
 * the star button. A transparent overlay button handles mouse and keyboard,
 * while the star sits above it in the stacking order.
 */
.mail-row-hit {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.mail-row-hit:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
}
.mail-row.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--forest);
}

.mail-row.is-unread .mail-from { color: var(--ink); font-weight: 700; }
.mail-row.is-unread .mail-subject { color: var(--ink); font-weight: 600; }
.mail-row:not(.is-unread) .mail-from { font-weight: 500; color: var(--ink-soft); }

.unread-dot {
  width: 6px;
  height: 6px;
  margin-top: 15px;
  border-radius: 50%;
  background: transparent;
  flex: none;
}

.mail-row.is-unread .unread-dot { background: var(--gold); }

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--white);
  background: var(--forest-soft);
  text-transform: uppercase;
}

.avatar-lg { width: 46px; height: 46px; font-size: 0.8rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.58rem; }
.av-0 { background: #2d6650; }
.av-1 { background: #3e6b8c; }
.av-2 { background: #a2673f; }
.av-3 { background: #7a5470; }
.av-4 { background: #8a6a2f; }
.av-5 { background: #556b52; }

.mail-row-main { min-width: 0; flex: 1; }

.mail-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.mail-from {
  min-width: 0;
  flex: 1;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-time {
  color: var(--muted-2);
  font-size: 0.66rem;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.mail-subject {
  display: block;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-snippet {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  flex: none;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.star-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -3px -5px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(24, 33, 28, 0.18);
  flex: none;
  pointer-events: auto;
}

.star-btn:hover { background: rgba(24, 33, 28, 0.06); color: var(--gold); }
.star-btn.is-starred { color: var(--gold); }

.empty-list {
  padding: 46px 26px;
  text-align: center;
  color: var(--muted);
}

.empty-list .icon-lg { margin: 0 auto 12px; color: var(--muted-2); opacity: 0.7; }
.empty-list h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 400; color: var(--ink-soft); }
.empty-list p { margin-top: 5px; font-size: 0.8rem; line-height: 1.5; }

/* ---------- Reader ---------- */

.reader-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.reader-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.reader-labels {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(29, 75, 57, 0.08);
  color: var(--forest);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pill-gold { background: var(--gold-soft); color: #70520f; }
.pill-clay { background: var(--clay-soft); color: #8a3b26; }
.pill-muted { background: rgba(24, 33, 28, 0.06); color: var(--muted); }
.pill-sky { background: rgba(62, 107, 140, 0.13); color: var(--sky); }

.reader-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.reader-actions .btn { min-height: 32px; font-size: 0.76rem; }
.reader-actions .spacer { flex: 1; }

.sender-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.sender-meta { min-width: 0; flex: 1; }
.sender-name { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.sender-addr { color: var(--muted); font-size: 0.77rem; overflow-wrap: anywhere; }
.recipients { margin-top: 4px; color: var(--muted); font-size: 0.74rem; line-height: 1.45; overflow-wrap: anywhere; }
.reader-date { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }

.reader-body-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(24, 33, 28, 0.16) transparent;
}

.mail-frame {
  width: 100%;
  min-height: 320px;
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.mail-text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}

.image-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 9px 13px;
  border: 1px solid rgba(212, 160, 60, 0.35);
  border-radius: 9px;
  background: rgba(241, 223, 181, 0.4);
  color: #70520f;
  font-size: 0.76rem;
}

.attachments {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.attachments h4 {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-decoration: none;
}
.attachment:hover { border-color: var(--forest-soft); }
.attachment span { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment small { color: var(--muted-2); font-size: 0.68rem; }

.reader-empty {
  flex: 1;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.reader-empty .seal {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--forest);
  background: rgba(29, 75, 57, 0.04);
}

.reader-empty h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 400; color: var(--ink-soft); }
.reader-empty p { font-size: 0.82rem; max-width: 34ch; line-height: 1.55; }

.reader-headers {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.5);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.72rem;
}

.reader-headers summary { cursor: pointer; font-weight: 600; }
.reader-headers dl { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 10px 0 0; }
.reader-headers dt { color: var(--muted-2); }
.reader-headers dd { margin: 0; overflow-wrap: anywhere; }

.loading-block {
  display: grid;
  gap: 10px;
  padding: 22px;
}

.skeleton {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(24, 33, 28, 0.06), rgba(24, 33, 28, 0.11), rgba(24, 33, 28, 0.06));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton.w-40 { width: 40%; }
.skeleton.w-65 { width: 65%; }
.skeleton.w-85 { width: 85%; }
.skeleton.tall { height: 180px; }

@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ---------- Sent / scheduled / tables ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll .data-table { min-width: 560px; }

.data-table th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(29, 75, 57, 0.035); }
.data-table .cell-main { min-width: 200px; }
.data-table .cell-main strong { display: block; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.data-table .cell-main small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 2px; overflow-wrap: anywhere; }
.data-table .cell-actions { text-align: right; white-space: nowrap; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.status-dot.sent::before { background: var(--forest-soft); }
.status-dot.failed::before { background: var(--clay); }
.status-dot.pending::before { background: var(--gold); }
.status-dot.sending::before { background: var(--sky); }
.status-dot.canceled::before { background: var(--muted-2); }

.metric-inline {
  display: inline-flex;
  gap: 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.metric-inline b { color: var(--ink-soft); font-weight: 600; }

.recipient-line {
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

/* ---------- Cards shared ---------- */

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.card-title { min-width: 0; flex: 1; }
.card-title h3 { font-size: 0.94rem; font-weight: 600; overflow-wrap: anywhere; }
.card-title p { margin-top: 2px; color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.kv {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 3px 10px;
  color: var(--muted);
  font-size: 0.74rem;
}
.kv dt { color: var(--muted-2); }
.kv dd { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }

.signature-preview {
  max-height: 130px;
  overflow: hidden;
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.55;
  border-left: 2px solid var(--gold-soft);
  padding-left: 12px;
}

/* ---------- Contacts ---------- */

.contact-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.contact-cell strong { display: block; font-weight: 600; }
.contact-cell small { display: block; color: var(--muted); font-size: 0.72rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(29, 75, 57, 0.08);
  color: var(--forest);
  font-size: 0.63rem;
  font-weight: 600;
}

/* ---------- Settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}

.stat .value {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat .label {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.integration-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.integration-row:last-child { border-bottom: 0; }
.integration-row .meta { min-width: 0; flex: 1; }
.integration-row .meta strong { display: block; font-size: 0.8rem; font-weight: 600; }
.integration-row .meta code { display: block; margin-top: 3px; color: var(--muted); font-family: var(--font-mono); font-size: 0.7rem; overflow-wrap: anywhere; }

.token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.token-row:last-child { border-bottom: 0; }
.token-row .meta { min-width: 0; flex: 1; }
.token-row .meta strong { display: block; font-size: 0.82rem; font-weight: 600; }
.token-row .meta small { display: block; color: var(--muted); font-size: 0.7rem; margin-top: 2px; overflow-wrap: anywhere; }

.scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.scope-option {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.6);
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}
.secret-box code { flex: 1; min-width: 0; }

.notice {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(212, 160, 60, 0.35);
  background: rgba(241, 223, 181, 0.35);
  color: #6d500f;
  font-size: 0.78rem;
  line-height: 1.5;
}
.notice strong { color: #4d380a; }

.danger-zone {
  border-color: rgba(180, 85, 60, 0.28);
}

/* ---------- Modal ---------- */

dialog.modal {
  width: min(92vw, 560px);
  max-height: min(90vh, 900px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog.modal.modal-wide { width: min(94vw, 760px); }
dialog.modal.modal-narrow { width: min(92vw, 440px); }

dialog.modal::backdrop {
  background: rgba(13, 23, 17, 0.5);
  backdrop-filter: blur(3px);
}

.modal-shell {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 900px);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--line);
}

.modal-head .meta { flex: 1; min-width: 0; }
.modal-head h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; letter-spacing: -0.02em; }
.modal-head p { margin-top: 3px; color: var(--muted); font-size: 0.78rem; }

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scrollbar-width: thin;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: rgba(24, 33, 28, 0.025);
  flex-wrap: wrap;
}

.modal-foot .spacer { flex: 1; }

.modal-sub {
  padding-top: 5px;
  border-top: 1px solid var(--line);
  margin-top: 3px;
}

.modal-sub h3 {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.compose-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  align-self: flex-start;
}

.compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.attachment-edit-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.attachment-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  font-size: 0.76rem;
}
.attachment-edit span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.compose-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.55);
}

.compose-options .check { font-size: 0.8rem; }

.schedule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.schedule-row[hidden] { display: none; }
.schedule-row .input { max-width: 260px; }

/* ---------- Toast ---------- */

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(92vw, 380px);
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--forest-deep);
  color: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  line-height: 1.45;
  animation: toast-in 0.28s var(--ease);
  pointer-events: auto;
}

.toast .icon { color: var(--gold); margin-top: 1px; }
.toast.is-error { background: #592719; border-color: #7e3d29; }
.toast.is-error .icon { color: #f0b7a3; }
.toast.is-success .icon { color: var(--gold); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Misc ---------- */

.center-state {
  display: grid;
  place-content: center;
  gap: 12px;
  min-height: 320px;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

.center-state h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--ink);
}

.center-state p { max-width: 46ch; font-size: 0.86rem; line-height: 1.6; margin: 0 auto; }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

.inline-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fade-in 0.3s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Layout utilities (no inline styles, strict CSP) ---------- */

.prose { line-height: 1.6; }
.mt { margin-top: 12px; }
.mt-sm { margin-top: 10px; }
.mb { margin-bottom: 16px; }
.py { padding: 16px 0; }
.px { padding: 16px 20px; }
.block-hint { display: block; }
.clamp-hint { max-width: 220px; }
.field-end { justify-content: flex-end; }
.empty-action { margin-top: 14px; }

.side-empty {
  padding: 4px 10px;
  color: rgba(255, 253, 248, 0.45);
  font-size: 0.78rem;
}

.reader-loading { padding: 26px; }
.searchbox-compact { max-width: 360px; }
.check-tight { margin-top: 4px; }
.check-offset { margin-top: 24px; }

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-body { padding: 16px 20px 20px; }
.panel-body-tight { padding: 8px 20px 18px; }
.panel-body-flush { padding: 4px 20px 16px; }
.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-stack-loose { gap: 14px; }
.panel-stack-tight { gap: 10px; }

.kv-wide {
  grid-template-columns: 120px 1fr;
  font-size: 0.82rem;
}

.tracked-links { margin-top: 14px; }
.tracked-links-list { margin-top: 6px; }

.security-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  color: var(--ink-soft);
}
.security-item > .icon {
  margin-top: 2px;
  color: var(--forest-soft);
}
.security-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.security-item span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}
.steps li::marker {
  color: var(--forest-soft);
  font-weight: 700;
}
.steps .mono {
  color: var(--forest);
  overflow-wrap: anywhere;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .settings-grid { grid-template-columns: 1fr; }
  .mail-layout { grid-template-columns: minmax(280px, 350px) minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 46vh; gap: 26px; padding: 28px; }
  .auth-terminal { display: none; }
  .auth-copy h1 { font-size: clamp(2.5rem, 9vw, 3.7rem); }
  .auth-form-side { padding: 32px 22px 44px; }

  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; }

  .mobilebar { display: flex; }
  .mobilebar .spacer { flex: 1; }

  .view { padding: 20px 16px 32px; }
  .view-inbox { padding-bottom: 0; }

  .mail-layout { grid-template-columns: 1fr; gap: 0; }
  .mail-layout .reader-panel { display: none; }
  .mail-layout.reader-open .mail-list-panel { display: none; }
  .mail-layout.reader-open .reader-panel { display: flex; }
  .mail-list-panel, .reader-panel { border-radius: 13px; }
  .mail-layout { padding-bottom: 18px; }
}

@media (max-width: 600px) {
  .view-head { align-items: flex-start; }
  .view-actions { width: 100%; }
  .view-actions .btn-primary { flex: 1; }
  .form-row, .form-row-3, .scope-grid { grid-template-columns: 1fr; }
  .data-table th:nth-child(3),
  .data-table td:nth-child(3) { display: none; }
  .settings-grid { gap: 12px; }
  .modal-body { padding: 16px; }
  .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .reader-head, .sender-row { padding-left: 16px; padding-right: 16px; }
  .reader-body-wrap { padding: 16px; }
  .reader-actions .btn span { display: none; }
  .reader-actions .btn { padding: 0 10px; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { width: 100%; }
}

/* ---------- Version & Changelog page ---------- */

.version-wrap {
  max-width: 820px;
  margin: 32px auto;
  padding: 0 16px;
}

.version-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
}

.version-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.version-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--ink);
}

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

.version-stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.version-stat small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.version-stat strong {
  display: block;
  font-size: 1rem;
  color: var(--ink);
}

.version-stat .clean {
  color: var(--forest);
}

.version-stat .dirty {
  color: var(--clay);
}

.version-pre {
  background: var(--paper);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 8px 0 20px;
  white-space: pre-wrap;
  word-break: break-all;
}

.version-foot {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

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