:root {
  --font-sans: 'Space Grotesk', 'Inter', 'SF Pro Display', 'Segoe UI', sans-serif;
  --bg: #f4f6fb;
  --bg-strong: #e9eef9;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #0f172a;
  --muted: #5b6475;
  --border: rgba(15, 23, 42, 0.08);
  --accent: #ff6f61;
  --accent-2: #3b82f6;
  --shadow-soft: 0 26px 60px rgba(15, 23, 42, 0.12);
  --shadow-strong: 0 40px 86px rgba(15, 23, 42, 0.16);
  --radius-lg: 22px;
  --radius-md: 14px;
  color-scheme: light;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #060910;
  --bg-strong: #0b1222;
  --surface: rgba(17, 24, 39, 0.78);
  --surface-strong: #0f172a;
  --text: #e5e9f3;
  --muted: #9aa3b5;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #f7a76c;
  --accent-2: #7cc4ff;
  --shadow-soft: 0 30px 70px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 40px 90px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.09), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(255, 111, 97, 0.12), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-strong));
  color: var(--text);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background: radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.14), transparent 32%),
    radial-gradient(circle at 78% 12%, rgba(255, 111, 97, 0.16), transparent 30%),
    radial-gradient(circle at 50% 85%, rgba(59, 130, 246, 0.09), transparent 35%);
  filter: blur(40px);
  opacity: 0.8;
}

body::after {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 45%),
    linear-gradient(240deg, rgba(255, 255, 255, 0.05), transparent 40%);
  mix-blend-mode: screen;
}

.hidden {
  display: none !important;
}

main {
  position: relative;
  z-index: 1;
  padding-top: 1rem;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 6.25rem 1.5rem 3.25rem;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr;
  align-items: center;
  gap: 1.25rem;
  padding: 1.05rem 1.75rem;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.8));
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 0 0 18px 18px;
}

.nav-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-left h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-left h1::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff9b85);
  box-shadow: 0 0 0 6px rgba(255, 111, 97, 0.12);
}

.nav-center {
  display: flex;
  justify-content: center;
}

.nav-right {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.nav-auth {
  font-size: 0.95rem;
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body.theme-dark .topbar {
  background: linear-gradient(120deg, rgba(17, 24, 39, 0.9), rgba(15, 23, 42, 0.82));
  border-color: var(--border);
}

body.theme-dark .nav-auth {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e9f3;
}

.hint-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--text);
}

.hint-field input {
  min-width: 240px;
}

label {
  color: var(--muted);
  font-weight: 600;
}

input[type='text'],
input[type='email'],
input[type='password'] {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus {
  border-color: var(--accent-2);
  outline: none;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.18);
  transform: translateY(-1px);
}

body.theme-dark input[type='text'],
body.theme-dark input[type='email'],
body.theme-dark input[type='password'] {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}

button {
  padding: 0.85rem 1.55rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #ff9b85);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 15px 30px rgba(255, 111, 97, 0.24);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(255, 111, 97, 0.28);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.secondary:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.ghost-icon {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: none;
}

body.theme-dark .ghost-icon {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.auth-status {
  display: none;
}

body.locked main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.locked .topbar,
body.locked #protected-section-body,
body.locked .table-wrapper,
body.locked .legend,
body.locked #status {
  display: none !important;
}

.tables-container {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.table-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: relative;
  animation: fadeUp 0.35s ease both;
}

.category-title {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  margin: 0;
  padding-left: 0.35rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-transform: uppercase;
}

.category-title::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), #7bd0ff);
  box-shadow: 0 0 0 7px rgba(59, 130, 246, 0.12);
}

.category-toggle {
  background: none;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem 0.85rem;
  border-radius: 12px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.category-toggle:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-2);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.3rem 1.4rem 1.1rem;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.menu-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
  table-layout: fixed;
  color: var(--text);
}

th,
td {
  text-align: left;
  padding: 0.95rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

thead th {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.4));
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.theme-dark thead th {
  background: linear-gradient(135deg, rgba(124, 196, 255, 0.12), rgba(255, 255, 255, 0.06));
}

td input {
  width: 100%;
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.97rem;
  color: var(--text);
}

td input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.15);
  outline: none;
}

body.theme-dark td input {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
  color: var(--text);
}

.menu-table th:nth-child(1),
.menu-table td:nth-child(1) {
  width: 5rem;
}

.menu-table th:nth-child(2),
.menu-table td:nth-child(2) {
  width: 18rem;
}

.menu-table th:nth-child(3),
.menu-table td:nth-child(3) {
  width: 26rem;
}

.menu-table th:nth-child(4),
.menu-table td:nth-child(4),
.menu-table th:nth-child(5),
.menu-table td:nth-child(5) {
  width: 8rem;
}

.menu-table th:nth-child(6),
.menu-table td:nth-child(6),
.menu-table th:nth-child(7),
.menu-table td:nth-child(7),
.menu-table th:nth-child(8),
.menu-table td:nth-child(8) {
  width: 6rem;
}

.col-spalte {
  display: none !important;
}

.menu-table.has-beverages th.col-spalte {
  display: table-cell !important;
}

.beverage-entry td.col-spalte {
  display: table-cell !important;
}

.col-actions {
  width: 5rem;
  text-align: right;
}

.action-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-2), #7bd0ff);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(59, 130, 246, 0.2);
}

.action-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 5;
  min-width: 190px;
}

.action-menu button {
  width: 100%;
  text-align: left;
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  box-shadow: none;
}

.action-menu button:hover {
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent-2);
}

body.theme-dark .action-menu button {
  background: rgba(124, 196, 255, 0.08);
}

.category-row td {
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.8));
  color: var(--text);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid rgba(59, 130, 246, 0.16);
}

body.theme-dark .category-row td {
  background: linear-gradient(120deg, rgba(124, 196, 255, 0.12), rgba(17, 24, 39, 0.92));
  border-bottom: 2px solid rgba(124, 196, 255, 0.25);
}

.legend {
  margin-bottom: 1.4rem;
  background: var(--surface);
  border-radius: 18px;
  padding: 1.6rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.legend-body.hidden {
  display: none;
}

.legend h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--text);
}

.legend p {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.legend-list {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 1.6rem;
}

.legend-list li {
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: var(--text);
}

.legend-list span {
  font-weight: 700;
  color: var(--accent-2);
  margin-right: 0.35rem;
}

.zutaten-editor,
.name-editor {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ingredient-btn {
  align-self: flex-start;
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  background: linear-gradient(135deg, var(--accent-2), #7bd0ff);
  border-radius: 999px;
  color: #fff;
  border: none;
  box-shadow: 0 12px 22px rgba(59, 130, 246, 0.2);
}

.ghost-button {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 12px;
  box-shadow: none;
}

.ghost-button:hover {
  background: rgba(59, 130, 246, 0.14);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal:not(.hidden) {
  display: flex;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface);
  width: min(900px, 95%);
  max-height: 90vh;
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  overflow-y: auto;
  padding-right: 0.35rem;
}

.modal-footer {
  text-align: right;
}

.prefix-field {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

#ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ingredient-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

body.theme-dark .ingredient-item {
  background: var(--surface-strong);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.35);
}

.ingredient-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.ingredient-name {
  width: 100%;
  margin-bottom: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  color: var(--text);
}

.additive-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.4rem;
  font-size: 0.87rem;
  color: var(--text);
}

.additive-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ingredient-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.beverage-entry td {
  background: rgba(255, 255, 255, 0.55);
}

.beverage-entry input[disabled] {
  background: rgba(255, 255, 255, 0.35);
  color: var(--muted);
}

body.theme-dark .beverage-entry td {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .beverage-entry input[disabled] {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

#status {
  min-height: 1.75rem;
  margin-bottom: 0.9rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.35rem 0.85rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

#status[data-type='success'] {
  color: #0f9d58;
  background: rgba(15, 157, 88, 0.1);
  border-color: rgba(15, 157, 88, 0.25);
}

#status[data-type='error'] {
  color: #e63946;
  background: rgba(230, 57, 70, 0.1);
  border-color: rgba(230, 57, 70, 0.25);
}

body.theme-dark #status {
  background: rgba(124, 196, 255, 0.08);
  border-color: rgba(124, 196, 255, 0.24);
  color: var(--text);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
    border-radius: 0 0 14px 14px;
  }

  .container {
    padding-top: 8.25rem;
  }

  .nav-right {
    justify-content: flex-start;
  }

  .menu-table {
    min-width: 820px;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 7rem 1rem 3rem;
  }

  .table-wrapper {
    padding: 1rem;
  }

  .legend {
    padding: 1.25rem;
  }

  button {
    width: 100%;
  }

  .nav-right {
    flex-direction: column;
    align-items: stretch;
  }

  .hint-field input {
    width: 100%;
  }
}
