:root {
  --blue: #2f80ed;
  --blue-deep: #1c3f70;
  --navy: #16324f;
  --mint: #3ecf8e;
  --bg: #eef2f6;
  --panel: #ffffff;
  --muted-band: #f4f6f8;
  --line: #d5dde7;
  --text: #142033;
  --muted: #6a7a8f;
  --danger: #d64545;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 248px;
  --radius: 0;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

.hidden {
  display: none !important;
}

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

/* —— Sidebar —— */
.sidebar {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mark {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.55);
}

.sidebar .icon-btn {
  display: none;
  margin-left: auto;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: transparent;
}

.sidebar-label {
  margin: 1rem 1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.account-list {
  list-style: none;
  margin: 0;
  padding: 0 0.65rem;
  display: grid;
  gap: 0.25rem;
  align-content: start;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.account-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  padding: 0.7rem 0.7rem;
  cursor: pointer;
  display: grid;
  gap: 0.12rem;
}

.account-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.account-item.active {
  background: rgba(47, 128, 237, 0.35);
  color: #fff;
}

.account-name {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-mail {
  font-size: 0.7rem;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}

.sidebar-foot {
  padding: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 0.55rem;
}

.sidebar-note {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.backdrop {
  display: none;
}

/* —— Main —— */
.main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.hero {
  background: var(--blue);
  color: #fff;
  padding: 1.25rem 1.5rem 1.25rem;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.hero-kicker {
  margin: 0;
  flex: 1;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.hero-name {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* —— Buttons —— */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.btn.solid {
  background: var(--mint);
  color: #0b2a1a;
  border-color: var(--mint);
}

.btn.solid:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn.ghost {
  background: transparent;
  color: var(--blue-deep);
  border-color: #9db6d8;
}

.btn.ghost:hover:not(:disabled) {
  background: #eaf1fb;
}

.btn.ghost-light {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
}

.btn.ghost-light:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: #f0b4b4;
}

.icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.icon-btn.light {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.burger,
.burger::before,
.burger::after {
  display: block;
  width: 14px;
  height: 2px;
  background: currentColor;
  position: relative;
}

.burger::before,
.burger::after {
  content: "";
  position: absolute;
  left: 0;
}

.burger::before {
  top: -5px;
}

.burger::after {
  top: 5px;
}

#btn-menu {
  display: none;
}

/* —— Bands / tiles —— */
.band {
  padding: 1.15rem 1.5rem;
}

.band-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
}

.tile {
  appearance: none;
  border: 0;
  text-align: left;
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  display: grid;
  gap: 0.45rem;
  min-height: 132px;
  align-content: start;
}

.tile:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tile-navy {
  background: var(--navy);
  color: #fff;
}

.tile-white {
  background: var(--panel);
  color: var(--text);
  border-left: 1px solid var(--line);
}

.tile-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.7;
}

.tile-value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  word-break: break-all;
  line-height: 1.35;
}

.tile-action {
  margin-top: auto;
  display: inline-flex;
  width: fit-content;
  margin-top: 0.55rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.tile-navy .tile-action {
  border-color: rgba(255, 255, 255, 0.55);
}

.tile-white .tile-action {
  border-color: #9db6d8;
  color: var(--blue-deep);
}

.band-muted {
  background: var(--muted-band);
}

.band-white {
  background: var(--panel);
}

.band-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.band-head h2,
.inbox-bar h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.band-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.band-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.band-toggle-main {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.band-toggle-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.band-toggle-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.band-toggle-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-right: 0.2rem;
}

.band-muted.is-open .band-toggle-chevron {
  transform: rotate(-135deg);
  margin-top: 0.25rem;
}

.identity-body {
  margin-top: 0.85rem;
}

.identity-body[hidden] {
  display: none !important;
}

.copy-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.copy-bar {
  width: 100%;
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: inherit;
}

.copy-bar:last-child {
  border-bottom: 0;
}

.copy-bar:hover {
  background: #f7fafc;
}

.copy-bar:active {
  background: #eaf1fb;
}

.copy-bar.accent .copy-value {
  color: var(--blue-deep);
  font-weight: 600;
}

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

.copy-value {
  font-family: var(--mono);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-action {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--blue);
}

/* —— Inbox —— */
.inbox-panel {
  border-top: 1px solid var(--line);
}

.inbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.inbox-bar h2 span {
  color: var(--muted);
  font-weight: 500;
}

.inbox {
  border: 1px solid var(--line);
  min-height: 160px;
  background: #fafbfc;
}

.msg-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.msg-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: grid;
  gap: 0.12rem;
}

.msg-item:hover {
  background: #eef3fb;
}

.msg-item.unread .msg-subject {
  font-weight: 700;
}

.msg-from,
.msg-intro,
.msg-time {
  color: var(--muted);
}

.msg-from {
  font-size: 0.76rem;
}

.msg-subject {
  font-size: 0.95rem;
}

.msg-intro {
  font-size: 0.82rem;
}

.msg-time {
  font-size: 0.72rem;
  font-family: var(--mono);
}

.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.empty-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #516278;
}

.empty-sub {
  margin: 0.3rem 0 0;
  font-size: 0.84rem;
}

.reader {
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  padding: 1rem;
  background: #fff;
}

.reader-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.reader h3 {
  margin: 0 0 0.55rem;
  font-size: 1.1rem;
}

.mail-meta {
  margin: 0 0 0.85rem;
  display: grid;
  gap: 0.25rem;
}

.mail-meta div {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0.4rem;
  font-size: 0.86rem;
}

.mail-meta dt {
  color: var(--muted);
}

.mail-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.mail-content iframe {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  background: #fff;
}

.mail-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.84rem;
}

.foot {
  margin-top: auto;
  padding: 1rem 1.5rem 1.35rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.foot a {
  color: var(--blue);
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  z-index: 40;
}

.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 2rem);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(20, 35, 60, 0.4);
}

.modal-inner {
  margin: 0;
  padding: 1.15rem;
  display: grid;
  gap: 0.65rem;
}

.modal-inner h3 {
  margin: 0;
}

.modal-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

@media (max-width: 820px) {
  .band-split {
    grid-template-columns: 1fr;
    padding-left: 0;
    padding-right: 0;
  }

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

@media (max-width: 720px) {
  .shell {
    grid-template-columns: 1fr;
  }

  #btn-menu {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 300px);
    height: 100dvh;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    padding-top: env(safe-area-inset-top);
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar .icon-btn {
    display: inline-grid;
  }

  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 28, 48, 0.4);
    z-index: 25;
  }

  .hero {
    padding: calc(0.85rem + env(safe-area-inset-top)) 1rem 1rem;
  }

  .band:not(.band-split) {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .band-split {
    padding: 0;
  }

  .hero-top {
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .hero-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn.ghost-light {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
  }

  .hero-name {
    font-size: 1.55rem;
  }

  .tile {
    min-height: 0;
    padding: 1rem 1rem 1.05rem;
    gap: 0.35rem;
  }

  .tile-value {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .tile-action {
    margin-top: 0.45rem;
  }

  .band-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    margin-bottom: 0.7rem;
  }

  .band-head p {
    font-size: 0.75rem;
  }

  .band-toggle-hint {
    font-size: 0.75rem;
  }

  .identity-body {
    margin-top: 0.7rem;
  }

  /* Zeile ist der Tap-Target – „Kopieren“-Text nur unnötig eng */
  .copy-action {
    display: none;
  }

  .copy-bar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "value";
    gap: 0.18rem;
    padding: 0.8rem 0.9rem;
  }

  .copy-label {
    grid-area: label;
  }

  .copy-value {
    grid-area: value;
    white-space: normal;
    word-break: break-word;
    font-size: 0.95rem;
  }

  .inbox-bar {
    gap: 0.5rem;
  }

  .inbox-bar .btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

  .foot {
    padding: 1rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(1rem + env(safe-area-inset-bottom));
    max-width: calc(100% - 2rem);
    text-align: center;
  }
}
