@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --nacht: #03080e;
  --tiefblau: #0a1c2e;
  --signalblau: #286eb3;
  --lichtblau: #7db1ec;
  --weiss: #fff;
  --hell: #eef3f8;
  --hell-leise: #a9b6c4;
  --papier: #f3f5f7;
  --tinte: #0a1420;
  --linie: rgb(255 255 255 / 0.16);
  --linie-stark: rgb(255 255 255 / 0.28);
  --danger: #e07a6a;
  --ok: #6fbf8a;
  --schrift: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --rand: clamp(1.1rem, 4vw, 2rem);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--nacht);
  color: var(--hell);
  font-family: var(--schrift);
  font-size: 1.05rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--lichtblau);
}

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

:focus-visible {
  outline: 3px solid var(--lichtblau);
  outline-offset: 3px;
}

/* --- Buttons (CI) -------------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid var(--linie-stark);
  background: transparent;
  color: var(--hell);
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  font-weight: 650;
  font-stretch: 108%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.btn:hover {
  border-color: var(--lichtblau);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--signalblau);
  border-color: transparent;
  color: var(--weiss);
}

.btn.primary:hover {
  background: #3380cb;
}

.btn.hell {
  background: var(--weiss);
  border-color: transparent;
  color: var(--nacht);
}

.btn.danger {
  color: #ffd2ca;
  border-color: rgba(224, 122, 106, 0.45);
}

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

/* --- App shell ----------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    radial-gradient(900px 420px at 100% -10%, rgb(40 110 179 / 0.22), transparent 55%),
    var(--nacht);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem var(--rand);
  border-bottom: 1px solid var(--linie);
  background: rgb(3 8 14 / 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand__mark {
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.brand__name {
  font-size: 0.95rem;
  font-weight: 750;
  font-stretch: 112%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
}

.brand__name span {
  color: var(--lichtblau);
}

.brand__sub {
  color: var(--hell-leise);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  min-height: 0;
}

.sidebar {
  border-right: 1px solid var(--linie);
  background: var(--tiefblau);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-height: 0;
}

.panel {
  background: rgb(10 28 46 / 0.72);
  border: 1px solid var(--linie);
}

.panel-pad {
  padding: 1rem;
}

.sidebar h2,
.main h2,
.compose h2 {
  margin: 0 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hell-leise);
}

.account-list,
.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.account-item,
.message-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  border-radius: 2px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
}

.account-item:hover,
.message-item:hover,
.account-item.active,
.message-item.active {
  background: rgb(125 177 236 / 0.1);
  border-color: rgb(125 177 236 / 0.28);
}

.account-item small,
.message-item small {
  display: block;
  color: var(--hell-leise);
  margin-top: 0.2rem;
  font-size: 0.82rem;
}

.main {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  min-height: 0;
}

.list-pane,
.read-pane {
  min-height: 0;
  overflow: auto;
}

.list-pane {
  border-right: 1px solid var(--linie);
  padding: 1rem;
}

.read-pane {
  padding: 1rem 1.2rem 2rem;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  align-items: center;
}

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

.empty {
  padding: 1.5rem 0.5rem;
  color: var(--hell-leise);
}

.message-item.unread {
  background: rgb(40 110 179 / 0.12);
}

.message-item .subject {
  font-weight: 650;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  color: var(--hell-leise);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.mail-body {
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.mail-body.html {
  white-space: normal;
  background: var(--papier);
  color: var(--tinte);
  border-radius: 2px;
  padding: 1rem;
}

.attachments {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.compose {
  margin-top: 1.25rem;
  padding: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hell-leise);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--linie);
  background: rgb(3 8 14 / 0.55);
  color: var(--hell);
  border-radius: 2px;
  padding: 0.8rem 0.9rem;
  font-size: 1rem;
  font-weight: 450;
  letter-spacing: normal;
  text-transform: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--lichtblau);
  outline: none;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.error,
.ok {
  border-radius: 2px;
  padding: 0.75rem 0.9rem;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}

.error {
  background: rgba(224, 122, 106, 0.14);
  color: #ffd2ca;
  border: 1px solid rgba(224, 122, 106, 0.35);
}

.ok {
  background: rgba(111, 191, 138, 0.14);
  color: #c8f0d5;
  border: 1px solid rgba(111, 191, 138, 0.3);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3 8 14 / 0.72);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  padding: 1.25rem;
  background: var(--tiefblau);
  border: 1px solid var(--linie);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hell-leise);
}

.badge.warn {
  color: #ffdf6b;
  border: 1px solid rgb(255 223 107 / 0.45);
  padding: 0.15rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.account-item.pending {
  border-color: rgb(255 223 107 / 0.35);
  background: rgb(255 223 107 / 0.06);
}

/* --- Login (Bühne) ------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--rand);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 520px at 85% 10%, rgb(40 110 179 / 0.28), transparent 55%),
    radial-gradient(700px 400px at 10% 90%, rgb(125 177 236 / 0.1), transparent 50%),
    linear-gradient(180deg, #03080e 0%, #07111c 55%, #03080e 100%);
}

.login-page__emblem {
  position: absolute;
  right: -8%;
  top: 8%;
  width: min(52vw, 34rem);
  opacity: 0.08;
  pointer-events: none;
  user-select: none;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  display: grid;
  gap: 1.75rem;
}

.login-brand {
  display: grid;
  gap: 0.85rem;
  justify-items: start;
}

.login-brand__mark {
  width: 4.25rem;
  height: 4.25rem;
}

.login-brand__etikett {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hell-leise);
}

.login-brand__title {
  margin: 0;
  font-size: clamp(1.85rem, 5vw, 2.45rem);
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 0.95;
}

.login-brand__title span {
  color: var(--lichtblau);
}

.login-brand__lead {
  margin: 0;
  max-width: 28ch;
  color: var(--hell-leise);
  font-size: 1rem;
}

.login-card {
  padding: 1.4rem 1.35rem 1.35rem;
  background: rgb(10 28 46 / 0.72);
  border: 1px solid var(--linie);
  backdrop-filter: blur(10px);
}

.login-card__actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.login-card__actions .btn {
  width: 100%;
  justify-content: center;
  padding-block: 0.9rem;
}

.login-foot {
  margin: 0;
  color: var(--hell-leise);
  font-size: 0.8rem;
}

.login-foot a {
  color: var(--hell);
  text-underline-offset: 0.18em;
}

@media (max-width: 960px) {
  .layout,
  .main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--linie);
  }

  .list-pane {
    border-right: none;
    border-bottom: 1px solid var(--linie);
    max-height: 42vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}
