:root {
  --bg: #0f172a;
  --card: #111c2f;
  --card2: #0b1426;
  --border: #22314f;
  --text: #eef2ff;
  --muted: #a7b0c6;

  --green: #2e7d32;
  --blue: #1976d2;
  --gray: #455a64;
  --purple: #6a1b9a;
  --orange: #ef6c00;
  --red: #c62828;

  --shadow: 0 6px 16px rgba(0, 0, 0, .10);
}

body.light {
  --bg: #f4f7f4;
  --card: #ffffff;
  --card2: #ffffff;
  --border: #d7dde6;
  --text: #162033;
  --muted: #506079;
  --shadow: 0 6px 16px rgba(0, 0, 0, .06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial;
  background: var(--bg);
  color: var(--text);
  padding: 12px;
  font-size: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-size: 20px;
}

.themeBtn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tabBtn {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.tabBtn.active {
  outline: 2px solid rgba(25, 118, 210, .35);
  border-color: rgba(25, 118, 210, .55);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

label {
  font-weight: 650;
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-top: 10px;
}

input,
select,
button,
textarea {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 16px;
  /* iOS Zoom verhindern */
  border-radius: 12px;
}

input,
select,
textarea {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

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

button {
  border: none;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

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

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

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

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

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

.status {
  font-size: 14px;
  margin-top: 8px;
  color: var(--muted);
}

/* Sonderpreis-Grid */
.priceGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width:420px) {
  .priceGrid {
    grid-template-columns: 1fr;
  }
}

.hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* 🔴 Sonderpreis Warn-Style */
input.sonderpreis-aktiv {
  background: #3a0f12 !important;
  border: 2px solid #c62828 !important;
  color: #fff !important;
}

body.light input.sonderpreis-aktiv {
  background: #ffd6d6 !important;
  border: 2px solid #c62828 !important;
  color: #000 !important;
}

/* Untermenü (Einsatz) */
.submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
  margin-top: 8px;
}

.submenu.open {
  max-height: 4200px;
}

/* Tabelle */
.tableWrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card2);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1150px;
  /* Handy: horizontal scroll */
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  font-size: 14px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.bar {
  background: rgba(46, 125, 50, .12);
}

.ec {
  background: rgba(25, 118, 210, .12);
}

.rechnung {
  background: rgba(230, 81, 0, .12);
}

.summe {
  font-weight: 900;
}

.actionBtn {
  padding: 8px 10px;
  font-size: 13px;
  width: auto;
  border-radius: 10px;
  margin-right: 6px;
}

/* Datenbank Filter Grid */
.filterGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width:520px) {
  .filterGrid {
    grid-template-columns: 1fr;
  }
}

.smallRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.smallRow>button {
  flex: 1;
  min-width: 160px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Details (aufklappbar) */
.detailsRow td {
  white-space: normal;
  font-size: 13px;
  color: var(--text);
}

.detailsBox {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
}

.detailsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media(max-width:720px) {
  .detailsGrid {
    grid-template-columns: 1fr;
  }
}

.kv {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.kv .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kv .v {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 800;
}

hr.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* ===== Bestellungen UI ===== */
.orderRow {
  border: 1px solid var(--border);
  background: var(--card2);
  border-radius: 14px;
  padding: 12px;
  margin-top: 10px;
}

.orderTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.orderTitle {
  font-weight: 900;
  font-size: 15px;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.pill.neu {
  border-color: rgba(239, 108, 0, .6);
  color: #ffcc80;
}

.pill.intour {
  border-color: rgba(25, 118, 210, .6);
  color: #90caf9;
}

.pill.erledigt {
  border-color: rgba(46, 125, 50, .6);
  color: #a5d6a7;
}

.orderMeta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

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

.orderBtns button {
  width: auto;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

/* Toast */
.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  background: rgba(17, 28, 47, .96);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: none;
}

body.light .toast {
  background: rgba(255, 255, 255, .96);
}

.toastRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.toastMsg {
  font-weight: 800;
}

.toastSmall {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.toast button {
  width: auto;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
}
