/* euskal.life — correo temporal efímero (Matrix oscuro + ikurriña) */

:root {
  --bg: #04070a;
  --bg-2: #071015;
  --panel: rgba(8, 16, 20, 0.82);
  --panel-2: rgba(10, 20, 24, 0.94);
  --panel-3: rgba(6, 12, 15, 0.7);
  --line: rgba(53, 240, 160, 0.14);
  --line-soft: rgba(120, 160, 150, 0.12);
  --line-strong: rgba(53, 240, 160, 0.32);
  --matrix: #35f0a0;
  --matrix-soft: #9fffd3;
  --matrix-dim: #1f8a60;
  --red: #d21f2b;
  --green: #0f9d58;
  --white: #f2f7f5;
  --ink: #d9f7ec;
  --muted: #7ea497;
  --muted-2: #547065;
  --warn: #f5c451;
  --err: #ff6f6f;
  --ok: #35f0a0;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

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

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(15, 157, 88, 0.12), transparent 60%),
              radial-gradient(900px 500px at 110% 0%, rgba(210, 31, 43, 0.1), transparent 55%),
              linear-gradient(180deg, #030608 0%, #04070a 40%, #030507 100%);
  font-family: var(--sans);
  line-height: 1.45;
  overflow-x: hidden;
}

a {
  color: inherit;
}

code, pre, kbd {
  font-family: var(--mono);
}

code {
  color: var(--matrix-soft);
}

.hidden {
  display: none !important;
}

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

#matrix {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.22;
  pointer-events: none;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(4, 7, 10, 0.15), rgba(4, 7, 10, 0.55)),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 4px
    );
}

.topbar,
main,
.footer {
  position: relative;
  z-index: 1;
}

main {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

/* Topbar */
.topbar {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.flag {
  width: 34px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.35);
  flex: 0 0 auto;
}

.flag.small {
  width: 24px;
  border-radius: 3px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text strong {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.brand-text strong span {
  color: var(--red);
}

.brand-text small {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(7, 14, 17, 0.7);
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--mono);
}

.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 0 rgba(53, 240, 160, 0);
}

.status.on {
  color: var(--matrix-soft);
  border-color: rgba(53, 240, 160, 0.25);
}

.status.on i {
  background: var(--matrix);
  box-shadow: 0 0 10px rgba(53, 240, 160, 0.7);
}

.status.off {
  color: #ffb0b0;
  border-color: rgba(255, 111, 111, 0.25);
}

.status.off i {
  background: var(--err);
  box-shadow: 0 0 10px rgba(255, 111, 111, 0.5);
}

/* Buttons & inputs */
.btn,
button,
input,
select {
  font: inherit;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(18, 40, 34, 0.35);
  color: var(--matrix-soft);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  font-weight: 600;
  line-height: 1.1;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(53, 240, 160, 0.5);
  background: rgba(20, 52, 42, 0.55);
  box-shadow: 0 0 0 1px rgba(53, 240, 160, 0.08) inset;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(180deg, rgba(53, 240, 160, 0.22), rgba(15, 157, 88, 0.22));
  color: #eafff6;
  border-color: rgba(53, 240, 160, 0.45);
  box-shadow: 0 10px 24px rgba(7, 40, 26, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.btn.primary:hover {
  background: linear-gradient(180deg, rgba(53, 240, 160, 0.3), rgba(15, 157, 88, 0.28));
}

.btn.ghost {
  background: rgba(8, 16, 20, 0.35);
  color: var(--ink);
  border-color: var(--line-soft);
}

.btn.ghost:hover {
  color: var(--matrix-soft);
  border-color: var(--line-strong);
}

.btn.danger {
  color: #ffd3d3;
  border-color: rgba(255, 111, 111, 0.35);
  background: rgba(60, 16, 20, 0.3);
}

.btn.danger:hover {
  border-color: rgba(255, 111, 111, 0.55);
  background: rgba(80, 18, 24, 0.45);
}

.btn.sm {
  padding: 7px 11px;
  font-size: 0.86rem;
  border-radius: 9px;
}

.btn.xs {
  padding: 5px 9px;
  font-size: 0.78rem;
  border-radius: 8px;
}

.btn.block {
  width: 100%;
}

.btn.busy {
  opacity: 0.7;
}

.link-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--matrix-soft);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  text-decoration: underline;
  text-decoration-color: rgba(53, 240, 160, 0.3);
}

.link-btn:hover {
  color: #fff;
}

input,
select {
  width: 100%;
  background: rgba(4, 10, 12, 0.7);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

input:focus,
select:focus {
  border-color: rgba(53, 240, 160, 0.45);
  box-shadow: 0 0 0 3px rgba(53, 240, 160, 0.08);
  background: rgba(5, 14, 16, 0.85);
}

select option {
  background: #081216;
  color: var(--ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 0.85rem;
  color: var(--muted);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.error-text {
  margin: 0;
  min-height: 1.2em;
  color: #ff9d9d;
  font-size: 0.84rem;
}

/* Panels */
.panel {
  background: linear-gradient(180deg, rgba(10, 20, 24, 0.88), rgba(7, 14, 17, 0.9));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
}

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

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.tag,
.badge,
.unread-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-family: var(--mono);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  background: rgba(8, 18, 20, 0.7);
  white-space: nowrap;
}

.tag.live {
  color: var(--matrix-soft);
  border-color: rgba(53, 240, 160, 0.28);
  background: rgba(15, 50, 38, 0.35);
}

.badge.ok,
.unread-pill {
  color: #04150e;
  background: var(--matrix);
  border-color: rgba(53, 240, 160, 0.5);
  font-weight: 700;
}

.badge.warn {
  color: #2a1d03;
  background: var(--warn);
  border-color: rgba(245, 196, 81, 0.6);
  font-weight: 700;
}

.badge.err {
  color: #2b0707;
  background: #ff8d8d;
  border-color: rgba(255, 111, 111, 0.6);
  font-weight: 700;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 420px);
  gap: 22px;
  align-items: start;
  margin-top: 8px;
}

.hero-copy {
  padding: 10px 4px 0;
}

.hero-flag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(8, 16, 20, 0.55);
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 14px;
}

.hero-flag svg {
  width: 26px;
  height: auto;
  border-radius: 3px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--matrix-dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.hero-copy h1 em {
  font-style: normal;
  color: var(--matrix);
  text-shadow: 0 0 24px rgba(53, 240, 160, 0.18);
}

.lede {
  margin: 16px 0 0;
  max-width: 62ch;
  color: #b7d3c8;
  font-size: 1.02rem;
}

.hero-points {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: grid;
  gap: 10px;
  max-width: 520px;
}

.hero-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(8, 16, 20, 0.45);
  color: #cfe8df;
}

.hero-points li span {
  font-family: var(--mono);
  color: var(--matrix);
  font-size: 0.8rem;
  padding: 4px 7px;
  border: 1px solid rgba(53, 240, 160, 0.25);
  border-radius: 8px;
  background: rgba(12, 30, 24, 0.5);
}

.hero-panels {
  display: grid;
  gap: 14px;
}

.create-card,
.access-card {
  display: grid;
  gap: 12px;
}

.input-suffix {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
}

.input-suffix input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-suffix b {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-left: none;
  border-radius: 0 10px 10px 0;
  background: rgba(14, 28, 30, 0.8);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
}

.input-suffix:focus-within b {
  border-color: rgba(53, 240, 160, 0.45);
}

.create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.dice {
  height: 42px;
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
}

.access-card {
  border-color: rgba(210, 31, 43, 0.18);
  background: linear-gradient(180deg, rgba(20, 12, 14, 0.55), rgba(8, 14, 17, 0.88));
}

.access-card .panel-head h2 {
  font-size: 0.98rem;
}

/* Workspace */
.workspace {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 12px;
}

.active-box {
  display: grid;
  gap: 12px;
}

.email-copy {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 26, 24, 0.55);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.email-copy:hover {
  border-color: rgba(53, 240, 160, 0.5);
  background: rgba(12, 34, 30, 0.7);
}

.email-copy code {
  font-size: 0.95rem;
  color: #ecfff8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-copy-action {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
}

.expiry-wrap {
  display: grid;
  gap: 6px;
}

.expiry-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(120, 160, 150, 0.12);
  border: 1px solid rgba(120, 160, 150, 0.1);
  overflow: hidden;
}

.expiry-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--matrix));
  box-shadow: 0 0 12px rgba(53, 240, 160, 0.35);
  transition: width 0.4s ease, background 0.3s ease;
}

.expiry-bar i.warn {
  background: linear-gradient(90deg, #d6a22e, var(--warn));
  box-shadow: 0 0 12px rgba(245, 196, 81, 0.3);
}

.expiry-bar i.err {
  background: linear-gradient(90deg, #a32020, var(--err));
  box-shadow: 0 0 12px rgba(255, 111, 111, 0.25);
  width: 100% !important;
}

.expiry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

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

.meta-grid > div {
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(6, 12, 15, 0.45);
  display: grid;
  gap: 2px;
}

.meta-grid span {
  font-size: 0.74rem;
  color: var(--muted);
}

.meta-grid b {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.token-details {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(6, 12, 15, 0.35);
  padding: 8px 10px;
}

.token-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.84rem;
  user-select: none;
}

.token-details[open] summary {
  margin-bottom: 8px;
  color: var(--matrix-soft);
}

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

.token-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: #cfe8df;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid rgba(120, 160, 150, 0.08);
}

.token-details .hint {
  margin-top: 8px;
  font-size: 0.78rem;
}

.row-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kbd-hint {
  font-size: 0.76rem;
  color: var(--muted-2);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid rgba(120, 160, 150, 0.25);
  border-bottom-color: rgba(120, 160, 150, 0.35);
  border-radius: 5px;
  background: rgba(10, 20, 22, 0.8);
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.2;
}

.saved-boxes {
  display: grid;
  gap: 8px;
}

.box-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.box-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(6, 12, 15, 0.4);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.box-item:hover {
  border-color: var(--line-strong);
  background: rgba(10, 22, 24, 0.6);
}

.box-item.active {
  border-color: rgba(53, 240, 160, 0.4);
  background: rgba(12, 34, 28, 0.45);
}

.box-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--matrix);
  box-shadow: 0 0 8px rgba(53, 240, 160, 0.45);
  flex: 0 0 auto;
}

.box-item .dot.expired {
  background: var(--muted-2);
  box-shadow: none;
}

.box-item code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}

.box-item .remove {
  color: var(--muted-2);
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  border-radius: 6px;
}

.box-item .remove:hover {
  color: #ffb0b0;
  background: rgba(255, 111, 111, 0.12);
}

.stat-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}

.stat {
  text-align: center;
  padding: 8px 4px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(6, 12, 15, 0.4);
}

.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--matrix-soft);
}

.stat span {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.2;
}

/* Mail panel */
.mail-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.mail-head {
  align-items: flex-start;
  margin-bottom: 0;
}

.mail-head-main h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.unread-pill.hidden {
  display: none;
}

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

.sync-text {
  font-family: var(--mono);
  font-size: 0.76rem;
}

.mail-search input {
  background: rgba(5, 12, 14, 0.75);
}

.mail-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  min-height: 520px;
}

.msg-list {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(5, 10, 12, 0.45);
  overflow: auto;
  max-height: 70vh;
  min-height: 320px;
  padding: 6px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.list-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.list-empty.waiting .wait-title {
  color: var(--matrix-soft);
  font-weight: 600;
}

.list-empty .small {
  font-size: 0.82rem;
  color: var(--muted);
}

.msg-item {
  width: 100%;
  text-align: left;
  padding: 10px 10px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(8, 16, 19, 0.35);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.msg-item:hover {
  background: rgba(12, 24, 27, 0.55);
  border-color: var(--line-soft);
}

.msg-item.selected {
  background: rgba(12, 34, 28, 0.5);
  border-color: rgba(53, 240, 160, 0.35);
  box-shadow: inset 2px 0 0 var(--matrix);
}

.msg-item.unread .msg-subject,
.msg-item.unread .msg-from {
  font-weight: 700;
  color: #f2fff9;
}

.msg-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.msg-from {
  font-size: 0.82rem;
  color: #cfe8df;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-time {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
  flex: 0 0 auto;
}

.msg-subject {
  font-size: 0.9rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-preview {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-attach {
  font-size: 0.72rem;
  color: var(--matrix-dim);
  font-family: var(--mono);
}

/* Reader */
.reader {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(5, 10, 12, 0.45);
  min-height: 320px;
  max-height: 70vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin: auto;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.empty-icon {
  font-size: 2rem;
  color: var(--matrix-dim);
  filter: drop-shadow(0 0 12px rgba(53, 240, 160, 0.15));
}

.empty-state p {
  margin: 0;
  color: #cfe8df;
  font-size: 1rem;
}

.empty-state small {
  color: var(--muted);
}

.reader-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 16, 19, 0.55);
  display: grid;
  gap: 8px;
}

.reader-subject {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f2fff9;
  line-height: 1.25;
  word-break: break-word;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.reader-meta b {
  color: #dff7ee;
  font-weight: 600;
}

.reader-meta code {
  color: var(--matrix-dim);
  font-size: 0.78rem;
}

.reader-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.reader-back {
  display: none;
}

.reader-body {
  padding: 0;
  flex: 1;
  min-height: 220px;
}

.reader-body iframe {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: none;
  background: #fff;
  display: block;
}

.reader-body pre {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #d9f7ec;
  font-family: var(--mono);
}

.reader-foot {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(6, 12, 15, 0.35);
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(8, 16, 20, 0.6);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  max-width: 100%;
}

.attach-chip:hover {
  border-color: var(--line-strong);
  color: #fff;
}

.attach-chip span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.attach-chip small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
}

/* Footer */
.footer {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-2);
  font-size: 0.8rem;
  border-top: 1px solid rgba(120, 160, 150, 0.08);
}

.footer-left,
.footer-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dot-sep {
  color: rgba(120, 160, 150, 0.25);
}

/* Toasts */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 18, 20, 0.96);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
}

.toast.ok {
  border-color: rgba(53, 240, 160, 0.4);
  color: #eafff6;
}

.toast.error {
  border-color: rgba(255, 111, 111, 0.45);
  color: #ffe3e3;
}

.toast.warn {
  border-color: rgba(245, 196, 81, 0.45);
  color: #fff3d6;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scrollbars */
.msg-list::-webkit-scrollbar,
.reader::-webkit-scrollbar,
.box-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.msg-list::-webkit-scrollbar-thumb,
.reader::-webkit-scrollbar-thumb,
.box-list::-webkit-scrollbar-thumb {
  background: rgba(120, 160, 150, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.msg-list::-webkit-scrollbar-thumb:hover,
.reader::-webkit-scrollbar-thumb:hover,
.box-list::-webkit-scrollbar-thumb:hover {
  background: rgba(53, 240, 160, 0.28);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Responsive */
@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-panels {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    grid-template-columns: 1fr 1fr;
  }
  .sidebar .active-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .hero-panels {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-template-columns: 1fr;
  }
  .mail-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .msg-list,
  .reader {
    max-height: none;
  }
  .reader-back {
    display: inline-flex;
  }
  .mail-grid.mobile-reading .msg-list {
    display: none;
  }
  .mail-grid:not(.mobile-reading) .reader .reader-head,
  .mail-grid:not(.mobile-reading) .reader .reader-body,
  .mail-grid:not(.mobile-reading) .reader .reader-foot {
    display: none;
  }
  .mail-grid:not(.mobile-reading) .reader .empty-state {
    display: grid;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar-right {
    justify-content: space-between;
  }
  .hero-copy h1 {
    font-size: 2.2rem;
  }
  .row-actions {
    grid-template-columns: 1fr;
  }
  .stat-panel {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .mail-head {
    flex-direction: column;
    align-items: stretch;
  }
  .mail-tools {
    justify-content: space-between;
  }
  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Ads */
.ad-wrap {
  width: min(1280px, calc(100% - 32px));
  margin: 8px auto 0;
  position: relative;
  z-index: 1;
}

.ad-slot {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px dashed rgba(120, 160, 150, 0.18);
  border-radius: 12px;
  background: rgba(6, 12, 15, 0.35);
  padding: 12px;
  overflow: hidden;
}

.ad-label {
  font-size: 0.7rem;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot ins.adsbygoogle {
  display: block;
  width: 100%;
}
