:root {
  color-scheme: light;
  --ink: #273133;
  --muted: #718078;
  --line: #ded9cf;
  --paper: #fffefa;
  --sand: #f7f3eb;
  --brand: #a66a2c;
  --brand-dark: #33433f;
  --danger: #a53b2d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(145deg, var(--sand) 0%, #f0ebe3 52%, #ecebe3 100%);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.stage {
  width: min(560px, calc(100% - 2rem));
  margin: clamp(18px, 6vh, 72px) auto 7vh;
  padding: 0;
  overflow: hidden;
  background: rgba(255, 254, 250, 0.98);
  border: 1px solid rgba(222, 217, 207, 0.96);
  border-top: 3px solid var(--brand);
  border-radius: 18px;
  box-shadow: 0 28px 76px rgba(57, 51, 41, 0.13);
}

.hero {
  min-height: 188px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 28px 34px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, #f4eee3 0%, #faf7f0 52%, #edf1eb 100%);
}

.brand-signature {
  display: grid;
  width: 214px;
  justify-items: center;
}

.brand-logo {
  display: block;
  width: 214px;
  height: auto;
}

.brand-suffix {
  display: flex;
  align-items: center;
  width: 170px;
  margin-top: -2px;
  gap: 7px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

.brand-suffix::before,
.brand-suffix::after {
  content: "";
  display: block;
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.75;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 17px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  padding: 0.26rem 0.62rem;
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chip:hover { border-color: rgba(166, 106, 44, 0.5); }

.chip.is-active {
  border-color: #afc4be;
  color: var(--brand-dark);
  background: rgba(255, 254, 250, 0.88);
}

.public-language {
  position: relative;
  z-index: 10;
  margin-top: 17px;
}

.public-language summary {
  min-width: 142px;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 7px 13px;
  border: 1px solid #cfc7ba;
  border-radius: 9px;
  background: rgba(255, 254, 250, .9);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
}

.public-language summary::-webkit-details-marker { display: none; }
.public-language summary i {
  width: 8px;
  height: 8px;
  margin: 0 0 4px 3px;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(45deg);
}
.public-language[open] summary i { margin: 4px 0 0 3px; transform: rotate(225deg); }

.public-language-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  width: 166px;
  overflow: hidden;
  transform: translateX(-50%);
  border: 1px solid #cfc7ba;
  border-radius: 9px;
  background: linear-gradient(155deg, #f4eee3 0%, #faf7f0 100%);
  box-shadow: 0 9px 18px rgba(57, 51, 41, .16);
}
.public-language-panel a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 14px;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}
.public-language-panel a:hover { background: rgba(255, 254, 250, .75); }

.panel {
  margin: 0;
  padding: 32px 38px 36px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.panel + .panel { border-top: 1px solid var(--line); }

.panel.narrow { width: 100%; }
.auth-card,
.form-card {
  width: 100%;
  margin: 0;
}

.narrow { max-width: 580px; }

h1 {
  margin: 0 0 .62rem;
  font: 500 2.2rem/1.06 Georgia, "Times New Roman", serif;
}

h1 + p { color: var(--muted); margin: 0 0 1rem; }

p { color: var(--muted); margin: 0 0 0.9rem; }

.eyebrow {
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

.field {
  margin: 0 0 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c6c0b0;
  border-radius: 9px;
  padding: 0.75rem;
  background: #fff;
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(166, 106, 44, 0.16);
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--brand-dark);
  color: #fffdf7;
  cursor: pointer;
  font: 700 0.96rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-decoration: none;
}

button:hover { filter: brightness(0.98); }
button:disabled { opacity: 0.65; cursor: not-allowed; }

.secondary {
  background: transparent;
  color: var(--brand-dark);
  border: 1px solid var(--line);
}

.quiet {
  background: transparent;
  color: var(--brand-dark);
  border: 1px solid var(--line);
}

.danger {
  background: var(--danger);
}

.actions, .button-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 1rem 0 0.25rem;
}

.actions form { margin: 0; }

.messages { margin: 0; padding: 24px 38px 0; }

.message {
  border-left: 4px solid var(--brand);
  padding: 0.65rem 0.8rem;
  background: #f4f2ea;
  color: var(--ink);
  margin: 0;
}

.error {
  color: #8e2b25;
  margin: 0.35rem 0 0;
}

.form-alert {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
  margin: 0 0 1.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e4c5bd;
  border-left: 4px solid var(--danger);
  border-radius: 9px;
  background: #f8ebe7;
  color: #702b24;
}

.form-alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

.form-alert strong { display: block; margin: 0 0 0.2rem; }
.form-alert p { margin: 0; color: inherit; font-size: 0.9rem; line-height: 1.45; }

.help {
  color: var(--muted);
  margin-top: 0.45rem;
  font-size: 0.87rem;
}

.help ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.back {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 700;
}

.back:hover { text-decoration: underline; }

.qr {
  width: min(260px, 100%);
  margin: 1rem 0;
  padding: 0.75rem;
  background: white;
  border: 1px solid var(--line);
}

.qr svg { display: block; width: 100%; height: auto; }

.session-list { display: grid; gap: 0.75rem; margin: 1rem 0; }

.session {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
}

.session small {
  display: block;
  color: var(--muted);
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .stage {
    width: calc(100% - 1rem);
    margin: 14px auto 5vh;
    border-radius: 15px;
  }

  .hero {
    min-height: 150px;
    padding: 22px 24px 19px;
  }

  .brand-logo {
    width: 174px;
  }

  .brand-signature { width: 174px; }

  .brand-suffix {
    width: 139px;
    font-size: 7px;
  }

  .panel,
  .panel.narrow,
  .auth-card,
  .form-card {
    padding: 26px 24px 30px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .session { align-items: flex-start; flex-direction: column; }
}

/* Verbindlicher Rahmen fuer angemeldete interne Anwendungen. */
.internal-stage {
  width: min(1180px, calc(100% - 2rem));
  min-height: calc(100vh - 4rem);
  margin: 2rem auto;
  border-radius: 14px;
}

.internal-header {
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 18px 38px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, #f4eee3 0%, #faf7f0 52%, #edf1eb 100%);
}

.internal-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.internal-title span,
.internal-content .eyebrow,
.internal-section-title {
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.internal-title strong {
  color: var(--ink);
  font: 500 34px/1.08 Georgia, "Times New Roman", serif;
  letter-spacing: -.015em;
}

.internal-brand {
  width: 112px;
  flex: 0 0 112px;
  padding: 9px 0;
}

.internal-brand .brand-logo { width: 104px; }
.internal-brand .brand-suffix {
  width: 84px;
  margin-top: 2px;
  gap: 7px;
  color: var(--danger);
  font-size: 5px;
  font-weight: 650;
}

.internal-brand .brand-suffix::before,
.internal-brand .brand-suffix::after {
  color: #111;
  opacity: .45;
  transform: scaleY(.45);
}

.internal-tools {
  min-height: 58px;
  display: flex;
  align-items: stretch;
  padding-left: 38px;
  border-bottom: 1px solid #cfc9bd;
  background: linear-gradient(90deg, #f7f2e9 0%, #edf1eb 100%);
  box-shadow: 0 3px 9px rgba(57, 51, 41, .06);
}

.breadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}

.breadcrumbs a { color: var(--ink); text-decoration: none; font-weight: 650; }
.breadcrumbs a:first-child::first-letter { color: var(--brand); }
.breadcrumbs .current { overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs .separator { color: #aaa79f; }

.internal-menus { margin-left: auto; display: flex; align-items: stretch; }
.menu { position: relative; border-left: 1px solid rgba(207, 201, 189, .85); }
.menu summary {
  height: 57px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-size: 14px;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary i {
  width: 8px;
  height: 8px;
  margin-left: 3px;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(45deg) translateY(-2px);
}
.menu[open] summary i { transform: rotate(225deg) translate(-2px, -1px); }
.menu-panel {
  position: absolute;
  top: 57px;
  right: 0;
  z-index: 20;
  min-width: 220px;
  overflow: hidden;
  border: 1px solid #cfc7ba;
  border-top: 0;
  border-radius: 0 0 0 10px;
  background: linear-gradient(155deg, #f4eee3 0%, #faf7f0 100%);
  box-shadow: 0 9px 18px rgba(57, 51, 41, .16);
}
.menu-panel a,
.menu-panel button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 500 13px/1.3 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: left;
  text-decoration: none;
}
.menu-panel a:hover { background: rgba(255, 254, 250, .72); }
.menu-panel form { margin: 0; border-top: 1px solid var(--line); }
.menu-panel form button { color: var(--danger); font-weight: 700; }
.language-panel { min-width: 150px; }

.internal-content {
  min-height: calc(100vh - 254px);
  padding: 58px 38px 88px;
  background: linear-gradient(155deg, rgba(255,254,250,.98) 0%, rgba(247,243,235,.62) 100%);
}
.internal-content.detail-surface {
  background: linear-gradient(155deg, rgba(255,254,250,.98) 0%, rgba(237,241,235,.64) 100%);
}
.internal-content h1 { margin-bottom: 0; font-size: 42px; }
.internal-content h1 + p { margin: 4px 0 44px; }
.internal-section-title { margin: 0 0 14px; }

.nav-card-list { display: grid; gap: 9px; }
.dashboard-section-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
}
.dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.member-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dashboard-grid .nav-card,
.member-dashboard-grid .nav-card { min-height: 116px; }
.create-user-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.create-user-form .field { margin-bottom: 0; }
.create-user-form > button { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
.nav-card {
  min-height: 96px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 64px 20px 23px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,254,250,.96);
  box-shadow: 0 8px 22px rgba(57,51,41,.035);
  color: var(--ink);
  text-decoration: none;
}
.nav-card strong { font: 500 20px/1.2 Georgia, "Times New Roman", serif; }
.nav-card small { margin-top: 5px; color: var(--muted); font-size: 13px; font-weight: 600; }
.nav-card::after {
  content: "→";
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  font: 500 25px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.internal-divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0 16px; }

.internal-content .session { background: #f7f4ed; }
.internal-content .back { display: none; }

@media (max-width: 760px) {
  .internal-stage { width: calc(100vw - 1rem); max-width: calc(100vw - 1rem); margin: .5rem auto 1.5rem; }
  .internal-header,
  .internal-tools,
  .internal-content { width: 100%; min-width: 0; }
  .internal-header { min-height: 112px; position: relative; padding: 14px 112px 14px 18px; gap: .5rem; }
  .internal-title { min-width: 0; max-width: 100%; }
  .internal-title strong { font-size: 25px; }
  .internal-title span { font-size: 9px; }
  .internal-brand { width: 76px; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); }
  .internal-brand .brand-logo { width: 74px; }
  .internal-brand .brand-suffix { width: 59px; font-size: 4px; gap: 4px; }
  .internal-tools { min-height: 102px; padding-left: 0; align-items: stretch; flex-wrap: wrap; }
  .breadcrumbs { width: 100%; height: 48px; padding: 0 18px; border-bottom: 1px solid rgba(207,201,189,.7); font-size: 13px; }
  .breadcrumbs .optional { display: none; }
  .internal-menus { width: 100%; height: 53px; justify-content: stretch; }
  .internal-menus .menu { width: 50%; }
  .internal-menus .menu summary { justify-content: center; }
  .menu summary { height: 53px; padding: 0 12px; }
  .account-menu summary > span { display: none; }
  .account-menu summary::before { content: "●"; color: var(--brand-dark); font-size: 12px; }
  .menu-panel { top: 53px; }
  .internal-content { min-height: calc(100vh - 270px); max-width: calc(100vw - 1rem); padding: 38px 22px 62px; overflow-wrap: anywhere; }
  .internal-content h1 { font-size: 34px; }
  .internal-content h1 + p { margin-bottom: 34px; }
  .nav-card-list { width: calc(100vw - 60px); max-width: 100%; }
  .nav-card { width: 100%; min-width: 0; padding-left: 18px; }
  .dashboard-section-grid { display: none; }
  .dashboard-grid,
  .member-dashboard-grid,
  .create-user-form { grid-template-columns: 1fr; }
}
