:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --success: #34c759;
  --danger: #ff3b30;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --transition: 0.2s ease;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47059;
  color: var(--text);
  background: var(--bg);
}

body.login-page .main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}

body.login-page .page-header {
  display: none;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-light);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.92;
}

.site-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.site-logo--nav {
  height: 36px;
  width: auto;
}

.site-logo--login {
  height: 56px;
  width: auto;
  margin: 0 auto 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 980px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--text);
  color: #fff;
}

.nav-link--logout {
  margin-left: 4px;
}

/* Main */
.main {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 22px 80px;
}

.main--wide {
  max-width: 1200px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.page-subtitle {
  margin: 8px 0 0;
  font-size: 19px;
  color: var(--text-secondary);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin-bottom: 24px;
}

.card--login {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.card__logo {
  margin-bottom: 4px;
  line-height: 0;
}

.card__tagline {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 28px;
}

/* Menu cards */
.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition);
}

.menu-card:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: var(--text);
}

.menu-card__title {
  display: block;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.menu-card__subtitle {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.menu-card__chevron {
  font-size: 24px;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 17px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
  background: var(--surface);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row--3 {
  grid-template-columns: 120px 1fr;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 980px;
  cursor: pointer;
  font-size: 15px;
  transition: border-color var(--transition), background var(--transition);
}

.radio-pill:has(input:checked) {
  border-color: var(--accent);
  background: rgba(0, 113, 227, 0.08);
}

.radio-pill input {
  accent-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
  padding: 12px 24px;
  border: none;
  border-radius: 980px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn--inline {
  width: auto;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn--secondary {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  padding: 6px 14px;
}

.btn--danger:hover {
  background: rgba(255, 59, 48, 0.08);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 14px;
}

/* Page toolbar */
.page-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-toolbar__text {
  flex: 1;
  min-width: 200px;
}

.page-meta {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Product list */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.product-card__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.14), rgba(0, 113, 227, 0.05));
  border-radius: 14px;
}

.product-card__body {
  flex: 1;
  min-width: 0;
}

.product-card__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.product-card__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.product-card__subtitle {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.product-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  border-radius: 980px;
  color: var(--text);
}

.chip--price {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.chip--muted {
  color: var(--text-secondary);
  font-weight: 400;
}

.product-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge--muted {
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

/* Action dropdown menu */
.action-menu {
  position: relative;
}

.action-menu__trigger {
  list-style: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  font-size: 20px;
  line-height: 1;
  color: var(--text-secondary);
  transition: background var(--transition);
  user-select: none;
}

.action-menu__trigger::-webkit-details-marker {
  display: none;
}

.action-menu__trigger:hover {
  background: var(--border-light);
}

.action-menu[open] .action-menu__trigger {
  background: var(--border-light);
  color: var(--text);
}

.action-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  padding: 6px;
  z-index: 50;
}

.action-menu__item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  transition: background var(--transition);
  text-align: left;
  border: none;
  background: none;
  font-family: var(--font);
  cursor: pointer;
}

.action-menu__item:hover {
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}

.action-menu__item--danger {
  color: var(--danger);
}

.action-menu__item--danger:hover {
  background: rgba(255, 59, 48, 0.08);
}

/* Form card */
.card--form {
  padding: 0;
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light);
}

.card__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.product-form {
  padding: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 24px;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

/* Queue list */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.queue-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.queue-card--done {
  opacity: 0.75;
}

.queue-card__status {
  flex-shrink: 0;
  width: 100px;
}

.queue-card__body {
  flex: 1;
  min-width: 0;
}

.queue-card__title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell .inline-form {
  display: inline;
}

.actions-cell .btn,
.actions-cell form {
  margin: 2px 0;
}

/* Tables */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: rgba(0, 113, 227, 0.03);
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 980px;
}

.badge--success {
  background: rgba(52, 199, 89, 0.15);
  color: #248a3d;
}

.badge--pending {
  background: rgba(255, 149, 0, 0.15);
  color: #c93400;
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  margin-bottom: 20px;
}

.alert--error {
  background: rgba(255, 59, 48, 0.1);
  color: #d70015;
}

.alert--success {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.alert--info {
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
}

/* Legacy field classes (register_sim) */
.textfield_gross,
.textfield_klein,
.textfield_220px {
  width: 100%;
  font-family: var(--font);
  font-size: 17px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.textfield_klein { max-width: 120px; }
.textfield_220px { flex: 1; }

.form-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 16px;
}

.form-table td {
  padding: 4px 0;
  vertical-align: middle;
}

.form-table td:first-child {
  width: 220px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-right: 20px;
}

.form-table tr td[colspan] {
  padding-top: 8px;
}

/* Customer detail sections */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.detail-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.detail-item__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.detail-item__value {
  font-size: 19px;
  font-weight: 500;
}

.detail-item__value--ok { color: var(--success); }
.detail-item__value--warn { color: var(--danger); }

.section-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 40px 0 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 24px;
}

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-secondary);
}

.site-footer p { margin: 0; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

@media (max-width: 734px) {
  .page-title { font-size: 32px; }
  .topbar-inner { height: auto; min-height: 52px; padding: 12px 16px; flex-wrap: wrap; }
  .nav-links { width: 100%; justify-content: flex-start; }
  .form-row, .form-row--3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-table td:first-child { width: auto; display: block; padding-bottom: 4px; }
  .form-table tr { display: block; margin-bottom: 16px; }
  .main { padding: 24px 16px 60px; }
  .product-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .product-card__actions {
    justify-content: flex-end;
  }
  .queue-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .queue-card__status {
    width: auto;
  }
  .page-toolbar {
    flex-direction: column;
  }
  .page-toolbar__actions .btn {
    width: 100%;
  }
}
