:root {
  --bg: #f5f0e8;
  --panel: rgba(255, 252, 245, 0.95);
  --panel-strong: #fffdf8;
  --line: #d7c9b4;
  --text: #1b1a17;
  --muted: #6c6357;
  --accent: #0b6e4f;
  --accent-dark: #084c37;
  --warn: #c58a00;
  --danger: #b5402a;
  --shadow: 0 16px 40px rgba(70, 53, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(11, 110, 79, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(197, 138, 0, 0.14), transparent 20%),
    linear-gradient(180deg, #f7f2e9 0%, #efe6d8 100%);
  overflow-x: hidden;
}

.login-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at top, rgba(255, 140, 26, 0.18), transparent 32%),
    rgba(247, 242, 233, 0.97);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.login-splash.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.login-splash.is-hiding {
  opacity: 0;
  visibility: hidden;
}

.login-splash-card {
  display: grid;
  justify-items: center;
  gap: 1rem;
  width: min(560px, 100%);
  padding: 1.6rem;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 48px rgba(95, 62, 14, 0.16);
  border: 1px solid rgba(255, 152, 45, 0.14);
}

.login-splash-image {
  width: min(420px, 100%);
  display: block;
}

.login-splash-loader {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 6px solid rgba(255, 132, 24, 0.16);
  border-top-color: #ff7a00;
  animation: splash-spin 0.9s linear infinite;
}

@keyframes splash-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border-radius: 28px;
  padding: 1.6rem;
}

.auth-form {
  margin-bottom: 0;
}

.auth-error {
  margin-bottom: 1rem;
  background: #f8ddda;
  color: var(--danger);
  border: 1px solid rgba(181, 64, 42, 0.18);
  border-radius: 16px;
  padding: 0.85rem 1rem;
}

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

button {
  border: 0;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  background: #ecf4ef;
  color: var(--accent-dark);
}

.danger-button {
  background: #b5402a;
  color: #fff;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.shell {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
}

.hero-logo {
  width: min(360px, 42vw);
  min-width: 180px;
}

.auth-brand-logo {
  width: min(320px, 100%);
  margin: 0 auto 1rem;
}

.hero-actions {
  display: grid;
  gap: 0.8rem;
  justify-items: end;
}

.hero-button-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.session-card {
  min-width: 220px;
  padding: 0.9rem 1rem;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 0.15rem;
}

.maintenance-badge {
  margin-top: 0.35rem;
  color: #92400e;
  font-weight: 700;
}

.logout-form {
  margin: 0;
}

.site-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.maintenance-downloads {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.maintenance-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.maintenance-card {
  width: min(760px, 100%);
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 144, 24, 0.12);
  border-radius: 32px;
  box-shadow: 0 18px 48px rgba(95, 62, 14, 0.16);
}

.maintenance-logo {
  width: min(520px, 100%);
  display: block;
  margin: 0 auto 1rem;
}

.maintenance-admin-link {
  width: fit-content;
  margin: 0.6rem auto 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
}

.delete-member-flow {
  display: grid;
  gap: 1rem;
}

.delete-checklist {
  display: grid;
  gap: 0.7rem;
}

.delete-check-item {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.82);
}

.delete-check-item input {
  width: auto;
  margin-top: 0.2rem;
}

.delete-check-item span {
  display: grid;
  gap: 0.2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent-dark);
  margin-bottom: 0.4rem;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  margin-bottom: 0.6rem;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scan-landing {
  margin-bottom: 1.5rem;
}

.scan-landing-card {
  background: linear-gradient(135deg, rgba(11, 110, 79, 0.12), rgba(255, 252, 245, 0.96));
  border: 1px solid rgba(11, 110, 79, 0.18);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 1.2rem;
}

.stat-card,
.panel,
dialog {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.stat-card {
  border-radius: 22px;
  padding: 1rem 1.2rem;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-card strong {
  font-size: 1.8rem;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1.45fr 1fr;
  gap: 1rem;
  align-items: start;
}

.fullpage-layout {
  grid-template-columns: 1fr;
}

.panel-switcher {
  display: none;
  gap: 0.7rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
  position: sticky;
  top: 0.6rem;
  z-index: 20;
}

.panel {
  border-radius: 28px;
  padding: 1.2rem;
}

.panel-wide {
  min-width: 0;
}

.fullpage-material-panel {
  width: 100%;
  max-width: 100%;
}

@media (min-width: 1101px) {
  .panel {
    position: sticky;
    top: 1rem;
    max-height: calc(100dvh - 2rem);
    overflow: auto;
  }

  .fullpage-material-panel {
    max-height: none;
    overflow: visible;
  }
}

.panel-header,
.toolbar,
.item-meta,
.item-actions,
.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.history-header {
  margin-top: 1.2rem;
}

.toolbar {
  margin-bottom: 1rem;
}

.segmented-nav {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.active-segment {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.badge,
.status-pill,
.assigned-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.badge,
.assigned-pill {
  background: #f0ebe3;
  color: var(--muted);
}

.status-ok {
  background: #dff3e8;
  color: var(--accent-dark);
}

.status-defekt {
  background: #fff0cf;
  color: #8a6500;
}

.status-verloren {
  background: #f8ddda;
  color: var(--danger);
}

.stacked-form {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-columns textarea,
.two-columns button {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 0.85rem 0.95rem;
  color: var(--text);
}

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

.member-list,
.item-list,
.history-list {
  display: grid;
  gap: 0.8rem;
}

.item-subgroup {
  display: grid;
  gap: 0.8rem;
}

.item-subgroup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.item-subgroup-header h3 {
  margin-bottom: 0;
}

.item-subgroup-list {
  display: grid;
  gap: 0.8rem;
}

.bulk-assign-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 120px auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.9rem 1rem;
  background: rgba(255, 253, 248, 0.8);
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.user-admin-list {
  display: grid;
  gap: 0.8rem;
}

.admin-mail-section {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.user-admin-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.member-card,
.item-card,
.history-entry {
  width: 100%;
  text-align: left;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  color: inherit;
}

.member-card {
  display: grid;
  gap: 0.2rem;
}

.member-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.item-card {
  display: grid;
  gap: 0.8rem;
}

.selected-item-card {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.uniform-sheet {
  padding: 1.2rem;
}

.stock-help {
  margin-bottom: 0.4rem;
}

.stock-accordion {
  padding: 0;
  overflow: hidden;
}

.stock-summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  cursor: pointer;
}

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

.stock-summary h3,
.stock-summary .eyebrow {
  margin-bottom: 0;
}

.stock-summary-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stock-summary-toggle {
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.stock-summary-toggle::after {
  content: "Anzeigen";
}

.stock-accordion[open] .stock-summary {
  border-bottom: 1px solid var(--line);
}

.stock-accordion[open] .stock-summary-toggle::after {
  content: "Ausblenden";
}

.stock-accordion-body {
  padding: 1rem 1.2rem 1.2rem;
}

.uniform-header {
  margin-bottom: 1rem;
}

.uniform-form {
  display: grid;
  gap: 1rem;
}

.uniform-info-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
}

.uniform-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.uniform-info-grid label {
  display: grid;
  gap: 0.35rem;
}

.uniform-inline-fields {
  display: grid;
  gap: 0.5rem;
}

.uniform-info-grid span {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.uniform-table {
  width: 100%;
  border-collapse: collapse;
  background: #fffdf8;
  border-radius: 18px;
  overflow: hidden;
}

.uniform-table th,
.uniform-table td {
  min-width: 0;
}

.uniform-table th,
.uniform-table td {
  border: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
  vertical-align: middle;
}

.uniform-table th {
  background: #f0ebe3;
  color: var(--accent-dark);
}

.compact-uniform-table {
  margin-bottom: 1rem;
}

.signature-section {
  margin-top: 1rem;
}

.signature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.signature-canvas {
  width: 100%;
  height: 180px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  touch-action: none;
}

.member-large-info-grid {
  margin-bottom: 1rem;
}

.signature-preview {
  margin: 1rem 0;
}

.signature-preview img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.status-block,
.compact {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.compact {
  justify-content: flex-start;
}

.description {
  margin-bottom: 0;
}

.member-detail {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
}

.detail-edit-button {
  margin-bottom: 1rem;
}

.edit-form {
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

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

.member-large-card {
  background: linear-gradient(180deg, #fffaf2 0%, #f2ebdf 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.4rem;
}

.member-large-card h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.4rem;
}

.member-large-role {
  font-size: 1.15rem;
  color: var(--accent-dark);
}

.member-large-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.member-large-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.member-large-notes {
  font-size: 1.05rem;
  line-height: 1.5;
}

.assigned-list {
  display: grid;
  gap: 0.7rem;
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.assigned-list li {
  display: grid;
  gap: 0.15rem;
}

.assigned-category-group {
  margin-bottom: 1rem;
}

.assigned-category-group h5 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
}

dialog {
  border: 0;
  border-radius: 26px;
  padding: 1.2rem;
  width: min(560px, calc(100% - 1rem));
  max-height: calc(100dvh - 1rem);
  overflow: auto;
}

dialog::backdrop {
  background: rgba(12, 19, 15, 0.55);
}

.qr-box {
  display: grid;
  place-items: center;
  min-height: 260px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.qr-frame {
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}

.qr-canvas-target {
  display: grid;
  place-items: center;
}

.qr-number {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
}

#qrCodeCaption {
  overflow-wrap: anywhere;
}

.scanner-reader {
  min-height: 280px;
  overflow: hidden;
  border-radius: 18px;
}

.scanner-selected-member {
  margin-bottom: 0.8rem;
}

.scanner-member-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.scanner-result {
  margin-top: 0.8rem;
  color: var(--accent-dark);
}

.mail-status-box {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  background: rgba(255, 255, 255, 0.82);
}

.mail-status-box.success {
  border-color: rgba(26, 127, 55, 0.28);
  background: rgba(235, 255, 241, 0.95);
  color: #135c2d;
}

.mail-status-box.warning {
  border-color: rgba(180, 83, 9, 0.24);
  background: rgba(255, 247, 237, 0.96);
  color: #92400e;
}

@media (max-width: 1100px) {
  .panel-switcher {
    display: grid;
  }

  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 1rem, 1440px);
    padding: 1rem 0 1.5rem;
  }

  .hero,
  .item-subgroup-header,
  .segmented-nav,
  .toolbar,
  .panel-header,
  .item-meta,
  .item-actions,
  .dialog-head {
    flex-direction: column;
    align-items: stretch;
  }

  .hero {
    margin-bottom: 1rem;
  }

  .hero-brand {
    align-items: stretch;
  }

  .hero-logo {
    width: min(100%, 320px);
    min-width: 0;
  }

  .hero-actions {
    justify-items: stretch;
    width: 100%;
  }

  .hero-button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-switcher {
    gap: 0.55rem;
    top: 0.35rem;
  }

  .panel-switcher button {
    min-height: 44px;
  }

  h1 {
    font-size: clamp(1.7rem, 8vw, 2.2rem);
  }

  h2 {
    font-size: 1.2rem;
  }

  .lead {
    font-size: 0.98rem;
  }

  .panel {
    border-radius: 22px;
    padding: 1rem;
  }

  .stat-card {
    border-radius: 18px;
    padding: 0.9rem 1rem;
  }

  .stat-card strong {
    font-size: 1.45rem;
  }

  button,
  input,
  textarea,
  select {
    font-size: 16px;
  }

  button {
    min-height: 46px;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }

  .segmented-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .segmented-nav button {
    width: 100%;
  }

  .toolbar {
    gap: 0.6rem;
  }

  .bulk-assign-form {
    grid-template-columns: 1fr;
    padding: 0.9rem;
  }

  .user-admin-card {
    flex-direction: column;
    align-items: stretch;
  }

  .member-card,
  .item-card,
  .history-entry {
    border-radius: 18px;
    padding: 0.9rem;
  }

  .badge,
  .status-pill,
  .assigned-pill {
    width: fit-content;
  }

  .member-detail,
  .uniform-info-card,
  .scan-landing-card,
  .member-large-card {
    border-radius: 18px;
    padding: 1rem;
  }

  .stock-summary,
  .stock-accordion-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .member-large-card h2 {
    font-size: 1.8rem;
  }

  .member-large-grid {
    grid-template-columns: 1fr;
  }

  .uniform-info-grid {
    grid-template-columns: 1fr;
  }

  .uniform-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .uniform-table thead,
  .uniform-table tbody,
  .uniform-table tr {
    white-space: nowrap;
  }

  .uniform-table th,
  .uniform-table td {
    min-width: 110px;
    padding: 0.65rem;
  }

  .uniform-table td:first-child,
  .uniform-table th:first-child {
    min-width: 150px;
  }

  .signature-head {
    align-items: stretch;
  }

  .signature-canvas {
    height: 150px;
  }

  dialog {
    width: calc(100% - 0.5rem);
    border-radius: 18px;
    padding: 0.9rem;
    margin: auto;
  }

  .qr-box {
    min-height: 220px;
  }
}

@media (max-width: 420px) {
  .shell {
    width: calc(100% - 0.6rem);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .segmented-nav {
    grid-template-columns: 1fr;
  }

  .panel-switcher {
    grid-template-columns: 1fr;
  }

  .uniform-table th,
  .uniform-table td {
    min-width: 96px;
    font-size: 0.92rem;
  }

  .uniform-table td:first-child,
  .uniform-table th:first-child {
    min-width: 130px;
  }

  .stock-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .stock-summary-meta {
    justify-content: space-between;
  }
}
