:root {
  color-scheme: light;
  --font-sans: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, 'Cascadia Mono', 'SFMono-Regular', monospace;

  --hero-bg: #21232a;
  --hero-bg-elevated: #2a2d36;
  --hero-border: #3a3e49;
  --hero-ink: #ffffff;
  --hero-muted: #a2a6b0;

  --accent: #286ef0;
  --accent-hover: #1d5ed9;
  --on-accent: #ffffff;
  --brand-accent: #4c8df6;

  --strip-bg: transparent;
  --action-pill-bg: #ffffff;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-hover: #eef2f6;
  --inbox-head-bg: #22242b;
  --inbox-head-ink: #ffffff;

  --ink: #1c2028;
  --ink-2: #3b404d;
  --muted: #585d6a;
  --border: #dfe3ec;
  --border-strong: #bcc4d4;
  --input-border: #aeb6c7;

  --primary: #22242b;
  --primary-hover: #14161b;
  --primary-ink: #ffffff;

  --ok-bg: #e8f1ff;
  --ok-ink: #174ea6;
  --ok-border: #adc9fa;
  --warn-bg: #fef4e6;
  --warn-ink: #8a4b00;
  --warn-border: #f2cf9e;
  --err-bg: #fdecec;
  --err-ink: #a61d24;
  --err-border: #f3b7b9;
  --info-bg: #eef2f7;
  --info-ink: #273244;
  --info-border: #c4cedf;

  --code-bg: #181a21;
  --code-ink: #e5eaf4;
  --code-border: #2c3140;

  --footer-bg: #22242b;
  --footer-ink: #e6e9f0;
  --footer-muted: #a2a6b0;

  --card-shadow: 0 2px 10px rgba(17, 22, 26, 0.04), 0 12px 28px rgba(17, 22, 26, 0.05);
  --modal-shadow: 0 24px 64px rgba(14, 18, 24, 0.24);
  --toast-bg: #1c2028;
  --toast-ink: #ffffff;
  --dark-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='2.8' intercept='-0.9'/%3E%3CfeFuncG type='linear' slope='2.8' intercept='-0.9'/%3E%3CfeFuncB type='linear' slope='2.8' intercept='-0.9'/%3E%3CfeFuncA type='linear' slope='0.055'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --dark-grain-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.80' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='2.6' intercept='-0.8'/%3E%3CfeFuncG type='linear' slope='2.6' intercept='-0.8'/%3E%3CfeFuncB type='linear' slope='2.6' intercept='-0.8'/%3E%3CfeFuncA type='linear' slope='0.038'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --hero-bg: #14161c;
  --hero-bg-elevated: #1c1f28;
  --hero-border: #2f3445;
  --hero-ink: #f4f6fa;
  --hero-muted: #a4aab8;

  --accent: #286ef0;
  --accent-hover: #1e5ee0;
  --on-accent: #ffffff;
  --brand-accent: #5c9bff;

  --strip-bg: transparent;
  --action-pill-bg: #1c1f28;

  --bg: #12141a;
  --surface: #1c1f28;
  --surface-2: #222530;
  --surface-hover: #282c3a;
  --inbox-head-bg: #15171e;
  --inbox-head-ink: #f2f4f8;

  --ink: #f2f4f8;
  --ink-2: #d2d7e2;
  --muted: #a4aab8;
  --border: #2c313f;
  --border-strong: #4d556b;
  --input-border: #6f7688;

  --primary: #286ef0;
  --primary-hover: #1e5ee0;
  --primary-ink: #ffffff;

  --ok-bg: rgba(40, 110, 240, 0.16);
  --ok-ink: #84b8ff;
  --ok-border: rgba(59, 130, 246, 0.38);
  --warn-bg: rgba(245, 165, 36, 0.15);
  --warn-ink: #f9c264;
  --warn-border: rgba(245, 165, 36, 0.34);
  --err-bg: rgba(244, 67, 54, 0.16);
  --err-ink: #ff948e;
  --err-border: rgba(244, 67, 54, 0.38);
  --info-bg: #232836;
  --info-ink: #d5dce9;
  --info-border: #3a4257;

  --code-bg: #12141a;
  --code-ink: #e5eaf4;
  --code-border: #2c313f;

  --footer-bg: #0e1015;
  --footer-ink: #eef1f6;
  --footer-muted: #9fa6b5;

  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.32), 0 12px 30px rgba(0, 0, 0, 0.24);
  --modal-shadow: 0 24px 68px rgba(0, 0, 0, 0.62);
  --toast-bg: #286ef0;
  --toast-ink: #ffffff;
  --dark-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='2.8' intercept='-0.9'/%3E%3CfeFuncG type='linear' slope='2.8' intercept='-0.9'/%3E%3CfeFuncB type='linear' slope='2.8' intercept='-0.9'/%3E%3CfeFuncA type='linear' slope='0.048'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

[hidden],
.hidden {
  display: none !important;
}

html {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--footer-bg);
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

:root[data-theme="dark"] body {
  background-color: var(--bg);
  background-image: var(--dark-grain-soft);
  background-size: 180px 180px;
}

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

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Header */
.site-header {
  position: relative;
  z-index: 40;
  background-color: var(--hero-bg);
  background-image: var(--dark-grain);
  background-size: 180px 180px;
  color: var(--hero-ink);
}

.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hdr-outline-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #e8ecf4;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.hdr-outline-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.hdr-outline-btn.active {
  border-color: rgba(76, 141, 246, 0.48);
  background: rgba(40, 110, 240, 0.24);
  color: #ffffff;
  font-weight: 600;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--hero-ink);
  min-height: 44px;
  padding: 4px 6px 4px 0;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 999px;
  background: #ffffff;
}

.brand-mark span:nth-child(1) {
  height: 11px;
  opacity: 0.72;
}

.brand-mark span:nth-child(2) {
  height: 18px;
}

.brand-mark span:nth-child(3) {
  height: 13px;
  background: var(--brand-accent);
}

.brand-title {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-icon-only {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  justify-content: center;
}

.brand-icon-only .brand-mark {
  gap: 3.5px;
  height: 20px;
}

.brand-icon-only .brand-mark span:nth-child(1) {
  height: 12px;
}

.brand-icon-only .brand-mark span:nth-child(2) {
  height: 20px;
}

.brand-icon-only .brand-mark span:nth-child(3) {
  height: 14px;
}

.header-controls {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hdr-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #e8ecf4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, color 150ms ease;
}

.hdr-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

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

.settings-button.active {
  border-color: rgba(76, 141, 246, 0.48);
  background: rgba(40, 110, 240, 0.24);
  color: #ffffff;
}

.settings-button svg {
  transition: transform 240ms ease;
}

.settings-button:hover svg,
.settings-button.active svg {
  transform: rotate(35deg);
}

.hdr-icon-btn svg.theme-sun {
  display: none;
}

:root[data-theme="dark"] .hdr-icon-btn svg.theme-moon {
  display: none;
}

:root[data-theme="dark"] .hdr-icon-btn svg.theme-sun {
  display: block;
}

.button-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

/* View transition theme reveal (suppresses child CSS transitions & UA fade/blend ghosting) */
:root.is-theme-switching *,
:root.is-theme-switching *::before,
:root.is-theme-switching *::after {
  transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 9999;
}

:root.theme-anim body,
:root.theme-anim .site-header,
:root.theme-anim .hero-band,
:root.theme-anim .section-btn-header,
:root.theme-anim .tm-action-btn,
:root.theme-anim .inboxWarpMain,
:root.theme-anim .site-footer,
:root.theme-anim .doc-card,
:root.theme-anim .auth-card,
:root.theme-anim .admin-panel,
:root.theme-anim .modal-dialog {
  transition:
    background-color 280ms cubic-bezier(0.4, 0, 0.2, 1),
    color 240ms cubic-bezier(0.4, 0, 0.2, 1),
    border-color 260ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hero Band (Matte dark grain block without fuzzy orb glow) */
.hero-band {
  background-color: var(--hero-bg);
  background-image: var(--dark-grain);
  background-size: 180px 180px;
  color: var(--hero-ink);
  padding: 20px 20px 26px;
}

.hero-band-inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.hero-brand {
  margin: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #ffffff;
}

.hero-brand .brand-mark {
  gap: 4px;
  height: 24px;
}

.hero-brand .brand-mark span {
  width: 5px;
}

.hero-brand .brand-mark span:nth-child(1) {
  height: 14px;
}

.hero-brand .brand-mark span:nth-child(2) {
  height: 24px;
}

.hero-brand .brand-mark span:nth-child(3) {
  height: 17px;
}

.hero-brand .brand-title {
  font-size: 22px;
  letter-spacing: 0.09em;
  line-height: 1;
}

.hero-command {
  max-width: 600px;
  margin: 0 auto;
}

.address-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-warp {
  flex: 1 1 auto;
  min-width: 0;
  height: 52px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  padding: 0 6px 0 17px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.input-warp:hover {
  background: rgba(255, 255, 255, 0.13);
}

.input-warp:focus-within {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(76, 141, 246, 0.32);
}

.mail-icon {
  width: 18px;
  height: 18px;
  color: var(--hero-muted);
  flex-shrink: 0;
}

.address-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--hero-ink);
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 500;
  padding: 4px 0;
}

.address-input::placeholder {
  color: #9ba1af;
}

.hero-circle-btn {
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.hero-random-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.11);
  color: #f0f3f9;
}

.hero-random-btn:hover {
  background: rgba(255, 255, 255, 0.20);
  color: #ffffff;
}

.hero-random-btn:hover .tool-icon {
  transform: rotate(90deg);
}

.hero-random-btn .circle-btn-label {
  display: none;
}

.hero-copy-btn {
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.hero-copy-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.hero-copy-btn:active {
  transform: translateY(0);
}

.hero-copy-btn .circle-btn-label {
  display: none;
  font-size: 14px;
  font-weight: 700;
}

.tool-icon {
  width: 19px;
  height: 19px;
  display: block;
  transition: transform 200ms ease;
}

.hero-copy-btn .copy-icon rect {
  fill: var(--accent);
  transition: fill 150ms ease;
}

.hero-copy-btn:hover .copy-icon rect {
  fill: var(--accent-hover);
}

.hero-copy-btn .check-icon {
  display: none;
}

.hero-copy-btn.copied .copy-icon {
  display: none;
}

.hero-copy-btn.copied .check-icon {
  display: block;
}

.hero-meta-row {
  margin-top: 12px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
}

.hero-link-trigger {
  border: 0;
  padding: 4px 2px;
  margin: 0;
  background: transparent;
  color: #cfd6e6;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  cursor: pointer;
  transition: color 140ms ease;
}

.hero-link-trigger:hover {
  color: #ffffff;
}

.hero-link-trigger:hover .address-url {
  color: #ffffff;
  text-decoration: underline;
}

.hero-link-icon {
  width: 15px;
  height: 15px;
  color: #79b0ff;
  flex-shrink: 0;
  display: block;
}

/* Floating Action Strip blended onto canvas */
.section-btn-header {
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}

.action-strip-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 20px 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tm-action-btn {
  min-width: 148px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--action-pill-bg);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(17, 22, 26, 0.04);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.tm-action-btn:not(:disabled):hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
}

.tm-action-btn.danger:not(:disabled):hover {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-ink);
  box-shadow: 0 4px 12px rgba(166, 29, 36, 0.14);
}

.tm-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dock-icon,
.refresh-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.tm-action-btn .dock-icon rect {
  fill: var(--action-pill-bg);
  transition: fill 150ms ease;
}

.tm-action-btn:not(:disabled):hover .dock-icon rect {
  fill: var(--accent);
}

.refresh-button.is-spinning .refresh-icon {
  animation: spinOnce 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Main Workspace */
.page {
  flex: 1 0 auto;
  width: 100%;
}

.workspace-page {
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
}

.sub-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.page-heading {
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* Admin / Settings Inline Panel */
.settings-panel {
  width: 100%;
  max-width: 560px;
  margin: 0 auto 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: var(--card-shadow);
  transition: max-width 200ms ease;
}

.settings-panel.is-admin-wide {
  max-width: 820px;
}

.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-heading {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.panel-note {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--muted);
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 4px;
}

.domain-input,
.text-field,
.domain-select {
  width: 100%;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.domain-input:focus,
.text-field:focus,
.domain-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 110, 240, 0.2);
  outline: none;
}

.panel-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.save-button,
.btn-primary {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  border: 0;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease;
}

.save-button:hover,
.btn-primary:hover {
  background: var(--primary-hover);
}

.api-docs-btn,
.btn-secondary {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease;
}

.api-docs-btn:hover,
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-danger {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--err-border);
  background: var(--err-bg);
  color: var(--err-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  filter: brightness(0.96);
}

.admin-inline-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sub-page:has(.admin-login-card) .page-heading {
  text-align: center;
}

.admin-login-card {
  max-width: 440px;
  margin: 0 auto;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.security-links-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.security-link-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 720px) {
  .security-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-tile-lbl {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat-tile-val {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* Inbox Container (Tall card extending cleanly down) */
.inboxWarpMain {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  flex: 1 0 auto;
  min-height: 390px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.inbox-header {
  background-color: var(--inbox-head-bg);
  background-image: var(--dark-grain);
  background-size: 180px 180px;
  color: var(--inbox-head-ink);
  min-height: 50px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 74px 158px;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.col-time,
.col-view {
  text-align: right;
}

.bg-header-inbox {
  display: none;
  background-color: var(--inbox-head-bg);
  background-image: var(--dark-grain);
  background-size: 180px 180px;
  color: var(--inbox-head-ink);
  min-height: 50px;
  padding: 0 18px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.message-count {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(40, 110, 240, 0.26);
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-count.bump {
  animation: countPop 340ms ease;
}

@keyframes countPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.address-url {
  color: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.address-status {
  margin: 0;
  font-size: 12.5px;
  color: #9ca3b3;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
}

.address-status.is-supported {
  color: #84b8ff;
  font-weight: 500;
}

.address-status.is-unsupported {
  color: #ff948e;
  font-weight: 500;
}

.inbox-stage {
  flex: 1 0 auto;
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

/* Empty orbital state */
.inbox-empty {
  flex: 1 0 auto;
  min-height: 340px;
  padding: 40px 24px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-orbital-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--muted);
}

.empty-orbit-ring {
  position: absolute;
  inset: 0;
  width: 90px;
  height: 90px;
  opacity: 0.45;
  transition: color 220ms ease, opacity 220ms ease;
}

.empty-orbital-wrap.is-live .empty-orbit-ring {
  color: var(--accent);
  opacity: 0.85;
}

@media (prefers-reduced-motion: no-preference) {
  .emptyInboxRotation {
    animation: tmOrbitSpin 2.4s linear infinite;
  }
}

@keyframes tmOrbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.empty-icon {
  display: grid;
  place-items: center;
  color: var(--ink-2);
}

.tray-mark {
  display: block;
}

:root[data-theme="dark"] .tray-outer {
  fill: var(--surface-2);
}

:root[data-theme="dark"] .tray-inner {
  fill: var(--surface);
}

.emptyInboxTitle,
.empty-title {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--ink);
}

.empty-copy {
  margin: 0;
  max-width: 440px;
  font-size: 13.5px;
  color: var(--muted);
}

.empty-actions {
  margin-top: 18px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
}

/* Search & Message List */
.search-strip {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-strip input {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
}

.search-meta {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.mail-list {
  display: flex;
  flex-direction: column;
}

.mail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  transition: background 140ms ease;
}

.mail-row:last-child {
  border-bottom: 0;
}

.mail-row:nth-child(even) {
  background: var(--surface-2);
}

.mail-row:hover {
  background: var(--surface-hover);
}

.mail-row-main {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 15px 0;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 74px;
  gap: 14px;
  align-items: center;
}

.mail-col-sender,
.mail-col-subj {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mail-sender {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.mail-sender-addr {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-subject {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-snippet {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.mail-row-actions {
  flex: 0 0 158px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.otp-pill-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-ink);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.otp-pill-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.mail-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mail-delete-btn:hover {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-ink);
}

/* Subpages, Cards, Tables & Code Blocks */
.doc-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: var(--card-shadow);
}

.doc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.doc-card h2,
.doc-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.doc-card-sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.meta-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.field-row > .text-field,
.field-row > .domain-select {
  flex: 1 1 200px;
  width: auto;
}

.notice-box {
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 13.5px;
  margin: 12px 0;
}

.notice-box.ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-ink);
}

.notice-box.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-ink);
}

.notice-box.err {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-ink);
}

.notice-box.info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-ink);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
}

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

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

th {
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

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

.inline-copy-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.inline-copy-btn:hover {
  border-color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill.ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-ink);
}

.status-pill.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-ink);
}

.status-pill.err {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-ink);
}

.status-pill.mute {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}

.code-pre {
  margin: 10px 0 0;
  padding: 14px 16px;
  border-radius: 9px;
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--code-border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
}

.syn-c { color: #8c96ab; }
.syn-s { color: #7dd3fc; }
.syn-k { color: #93c5fd; }

.legal-content h2 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p,
.legal-content li {
  color: var(--ink-2);
  font-size: 14.5px;
}

.legal-meta {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--muted);
}

/* Modal & Reader */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(13, 16, 22, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--modal-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close:hover {
  border-color: var(--accent);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

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

.reader-meta-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.reader-meta-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.reader-meta-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
  color: var(--muted);
}

.reader-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.reader-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
}

.reader-otps,
.reader-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.reader-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

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

.reader-tab {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.reader-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
}

.banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
  margin-bottom: 12px;
}

iframe.mail-frame {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
}

.text-pre {
  margin: 0;
  padding: 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.attach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.attach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Footer */
.site-footer {
  width: 100%;
  flex-shrink: 0;
  margin-top: auto;
  background-color: var(--footer-bg);
  background-image: var(--dark-grain);
  background-size: 180px 180px;
  color: var(--footer-ink);
  padding: 24px 20px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.footer-link {
  color: var(--footer-ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 6px;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-sep {
  color: var(--footer-muted);
  opacity: 0.55;
  font-size: 12px;
}

.footer-copy {
  margin: 0;
  font-size: 12px;
  color: var(--footer-muted);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: var(--toast-bg);
  color: var(--toast-ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-mark {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

:root[data-theme="dark"] .toast-mark {
  background: var(--toast-ink);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .site-header-inner {
    padding: 0 18px;
    gap: 10px;
  }

  .hdr-outline-btn {
    padding: 0 10px;
    font-size: 12.5px;
  }
}

@media (max-width: 760px) {
  .site-header-inner {
    min-height: 60px;
    padding: 0 12px;
    gap: 8px;
  }

  .brand {
    gap: 7px;
    padding-right: 0;
  }

  .brand-title {
    font-size: 15px;
    letter-spacing: 0.06em;
  }

  .header-controls {
    gap: 5px;
  }

  .hdr-icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .hdr-outline-btn {
    min-height: 44px;
    padding: 0 9px;
    gap: 5px;
    font-size: 12px;
  }

  .action-strip-inner {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 13px 14px;
  }

  .tm-action-btn {
    min-width: 0;
    width: 100%;
    height: 44px;
    padding: 0 8px;
    font-size: 13px;
  }

  .workspace-page {
    padding: 18px 14px 36px;
  }

  .inbox-header {
    display: none;
  }

  .bg-header-inbox {
    display: flex;
  }

  .inboxWarpMain,
  .inbox-stage,
  .inbox-empty {
    min-height: 280px;
  }

  .mail-row {
    padding: 0 16px;
    gap: 10px;
  }

  .mail-row-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 13px 0;
  }

  .mail-time {
    text-align: left;
  }

  .mail-row-actions {
    flex: 0 0 auto;
  }
}

@media (max-width: 580px) {
  .hero-band {
    padding: 14px 14px 20px;
  }

  .hero-brand {
    margin-bottom: 14px;
    gap: 10px;
  }

  .hero-brand .brand-mark {
    height: 20px;
    gap: 3px;
  }

  .hero-brand .brand-mark span {
    width: 4px;
  }

  .hero-brand .brand-mark span:nth-child(1) {
    height: 12px;
  }

  .hero-brand .brand-mark span:nth-child(2) {
    height: 20px;
  }

  .hero-brand .brand-mark span:nth-child(3) {
    height: 14px;
  }

  .hero-brand .brand-title {
    font-size: 19px;
  }

  .address-box {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .input-warp {
    height: 48px;
    padding: 0 4px 0 14px;
  }

  .hero-random-btn {
    width: 44px;
    height: 44px;
  }

  .hero-copy-btn {
    width: 100%;
    height: 46px;
  }

  .hero-copy-btn .circle-btn-label {
    display: inline;
  }

  .hero-meta-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 0 2px;
  }

  .hero-link-trigger {
    min-height: 36px;
    justify-content: center;
  }

  .address-url {
    font-size: 11.5px;
  }

  .address-status {
    text-align: center;
    white-space: normal;
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .site-header-inner {
    padding: 0 8px;
    gap: 6px;
  }

  .site-header .brand {
    gap: 5px;
  }

  .site-header .brand-mark {
    height: 15px;
  }

  .site-header .brand-title {
    font-size: 13px;
    letter-spacing: 0.04em;
  }

  .header-controls {
    gap: 4px;
  }

  .hdr-outline-btn {
    padding: 0 8px;
    font-size: 11.5px;
  }

  .hdr-outline-btn svg {
    display: none;
  }

  .hdr-icon-btn {
    min-width: 40px;
    width: 40px;
    min-height: 44px;
  }
}

@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;
  }
}
