/* Palette und Schrift aus den Mail-Vorlagen, damit Panel und Mail
   erkennbar zusammengehoeren. */
:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #6b7280;
  --line: #d2d2d7;
  --accent: #3b82f6;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --good: #067647;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1112;
    --surface: #171a1c;
    --ink: #f4f5f7;
    --muted: #9aa1ab;
    --line: #2c3135;
    --accent: #7ea5f8;
    --accent-ink: #0e1112;
    --danger: #f2837a;
    --good: #6ecf9e;
  }
}

* {
  box-sizing: border-box;
}

/* Das hidden-Attribut wirkt ueber die Regel [hidden]{display:none} des
   Browsers. Jede eigene display-Regel mit hoeherer Spezifitaet schlaegt
   die — .login unten setzt display:flex, und damit blieb die
   Anmeldemaske nach erfolgreicher Anmeldung stehen. Die Verwaltung
   erschien darunter, ausserhalb des Sichtfelds. Fuer den Benutzer sah
   das aus, als passiere gar nichts. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1 {
  font-size: 1.15rem;
  margin: 0;
}
h2 {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}
h2.inline {
  display: inline;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.right {
  text-align: right;
}

/* ---------------------------------------------------------- Anmeldung */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-title {
  margin-bottom: 0.25rem;
}

#login-sub {
  margin-top: 0;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------- Geruest */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-inner,
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding-inline: 20px;
}

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

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

.wrap {
  padding-block: 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------ Formular */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

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

input,
select {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
  min-width: 0;
}

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

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.row input {
  flex: 1 1 220px;
}

.grid {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 14px;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: var(--danger);
}

.small-btn {
  padding: 5px 10px;
  font-size: 0.85rem;
}

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '+ ';
  color: var(--muted);
}

details[open] summary::before {
  content: '– ';
}

/* -------------------------------------------------------------- Tabelle */

.table-scroll {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

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

td.actions {
  text-align: right;
  white-space: nowrap;
}

td.actions .btn {
  margin-left: 6px;
}

.account-mail {
  font-weight: 600;
  word-break: break-all;
}

.account-name {
  color: var(--muted);
  font-size: 0.85rem;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.tag.admin {
  border-color: var(--accent);
  color: var(--accent);
}

.tag.yes {
  color: var(--good);
  border-color: var(--good);
}

.tag.no {
  color: var(--danger);
  border-color: var(--danger);
}

/* ------------------------------------------------------- Rueckmeldungen */

.error,
.notice,
.result {
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 0.88rem;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  background: var(--bg);
}

.error {
  color: var(--danger);
  border-color: var(--danger);
}

.notice {
  border-color: var(--good);
  color: var(--good);
}

.result code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  word-break: break-all;
}

.password-box {
  display: block;
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  user-select: all;
}

.events {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.events li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.85rem;
}

.events .head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.events .detail {
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 560px) {
  .topbar-inner,
  .wrap {
    padding-inline: 16px;
  }
  td.actions {
    text-align: left;
  }
  td.actions .btn {
    margin: 4px 6px 0 0;
  }
}
