/* ==== Admin Dashboard ==== */
:root {
  --cream: #FAF6EE;
  --espresso: #1f1410;
  --line: #e6e0d2;
  --tomato: #C8281C;
  --pistacchio: #7FA650;
  --sand: #E8B548;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: #f5f1e8;
  color: var(--espresso);
}

.adm-top {
  background: var(--espresso); color: var(--cream);
  padding: 14px 24px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.adm-top h1 { margin: 0; font-family: 'Playfair Display', serif; font-size: 1.4rem; }
.adm-top h1 span { color: var(--sand); font-style: italic; }
.adm-top button { background: var(--tomato); color: #fff; border: 0; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }

.tabs { display: flex; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.tab { padding: 14px 22px; cursor: pointer; border: 0; background: transparent; font-weight: 600; font-size: 14px; color: #777; border-bottom: 3px solid transparent; }
.tab.active { color: var(--espresso); border-bottom-color: var(--tomato); }

.adm-main { padding: 30px 24px; max-width: 1400px; margin: 0 auto; }

.card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 4px 16px rgba(0,0,0,0.04); margin-bottom: 20px; }
.card h2 { margin: 0 0 20px; font-family: 'Playfair Display', serif; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #888; font-weight: 700; background: #fafaf6; }
tr:hover td { background: #fcfaf3; }

.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.status.new { background: #fff5d4; color: #826200; }
.status.preparing { background: #ffe0d4; color: #8b3415; }
.status.ready { background: #dff3c5; color: #3f6112; }
.status.done { background: #e6e6e6; color: #555; }
.status.cancelled { background: #fadcd9; color: #7a1d18; text-decoration: line-through; }

.btn { background: var(--espresso); color: #fff; border: 0; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; margin-right: 4px; transition: background 0.15s; }
.btn:hover { background: var(--tomato); }
.btn.tomato { background: var(--tomato); }
.btn.green { background: var(--pistacchio); }
.btn.danger { background: #b22; }
.btn.ghost { background: transparent; color: var(--espresso); border: 1px solid var(--line); }

input, select, textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; font-size: 14px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--tomato); border-color: var(--tomato); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #555; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #3A2418 0%, #5A3A28 100%); }
.login-card { background: #fff; padding: 50px; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); width: 380px; }
.login-card h1 { font-family: 'Playfair Display', serif; text-align: center; margin: 0 0 8px; }
.login-card p { text-align: center; color: #888; margin: 0 0 30px; font-size: 14px; }

.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--espresso); color: #fff;
  padding: 14px 22px; border-radius: 8px;
  font-weight: 600; z-index: 999;
  opacity: 0; transition: opacity .2s, transform .2s;
  transform: translateY(-10px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b22; }

.order-items { font-size: 13px; color: #555; }
.order-items div { padding: 1px 0; }

.empty { text-align: center; padding: 40px; color: #888; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; padding: 18px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.kpi .lbl { font-size: 11px; text-transform: uppercase; color: #888; letter-spacing: 1px; font-weight: 700; }
.kpi .val { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--espresso); margin-top: 4px; }
.kpi .val.tomato { color: var(--tomato); }

/* ===== Edit Modal ===== */
.modal {
  position: fixed; inset: 0; background: rgba(31,20,16,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  background: #fff; border-radius: 14px; padding: 30px;
  width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.35); position: relative;
}
.modal-x {
  position: absolute; top: 14px; right: 14px;
  background: transparent; border: 0; font-size: 28px; line-height: 1;
  cursor: pointer; color: #888; padding: 4px 12px;
}
.modal-x:hover { color: var(--tomato); }
.modal-card textarea { width: 100%; resize: vertical; }
.modal-card input[type="number"], .modal-card input[type="text"], .modal-card input:not([type]) { width: 100%; }
.modal-card select { width: 100%; }

/* ===== Kind badges ===== */
.kind-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.kind-badge.kind-cafe  { background: #f3e9d2; color: #6b4a17; }
.kind-badge.kind-shop  { background: #d8e7d3; color: #2f5a1e; }
.kind-badge.kind-lunch { background: #fadcd9; color: #872c1d; }

/* ===== Filter buttons ===== */
.btn.ghost.flt.active { background: var(--espresso); color: #fff; border-color: var(--espresso); }

/* ===== Image upload widget ===== */
.img-upload {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: start;
}
.img-preview {
  width: 120px; height: 120px;
  border-radius: 10px;
  background: #f0ece0 center/cover no-repeat;
  border: 1px dashed #cbc3a9;
  display: flex; align-items: center; justify-content: center;
  color: #999; font-size: 12px;
}
.img-preview.has-img { border-style: solid; border-color: var(--line); }
.img-upload-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .img-upload { grid-template-columns: 1fr; }
  .img-preview { width: 100%; height: 180px; }
}

/* ====== Mobile Optimierung ====== */
@media (max-width: 820px) {
  .adm-top { padding: 10px 14px; }
  .adm-top h1 { font-size: 1.1rem; }
  .adm-top button { padding: 6px 12px; font-size: 13px; }
  #autoIndicator { display: none; }

  .tabs {
    padding: 0 6px; overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 12px 14px; font-size: 13px; flex-shrink: 0; }

  .adm-main { padding: 16px 12px; }
  .card { padding: 16px; border-radius: 10px; }
  .card h2 { font-size: 1.2rem; margin-bottom: 14px; }

  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 1.5rem; }

  /* Tabellen → Card-Layout */
  table { display: block; }
  table thead { display: none; }
  table tbody, table tr { display: block; }
  table tr {
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    margin-bottom: 12px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
  }
  table tr:hover td { background: transparent; }
  table td {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 6px 0; border: 0; text-align: right; font-size: 14px;
  }
  table td::before {
    content: attr(data-label);
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
    color: #888; font-weight: 700; align-self: center;
  }
  table td:first-child {
    border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 8px;
    font-weight: 700; font-size: 16px;
  }
  table td:first-child::before { content: ''; }

  /* Buttons in Card-Layout */
  .btn { padding: 10px 14px; font-size: 14px; min-height: 40px; margin: 2px; }

  /* Modal mobil-fit */
  .modal-card { width: 96vw !important; max-width: 96vw !important; padding: 18px !important; max-height: 92vh; overflow-y: auto; }
  .row { grid-template-columns: 1fr !important; }

  /* Scanner stack */
  #tab-scanner .card > div[style*="grid-template-columns:1fr 1fr"],
  #tab-scanner .card > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #scanVideo { max-width: 100% !important; }

  /* Login */
  .login-card { width: 92vw; padding: 30px 24px; border-radius: 12px; }

  /* Toasts unten statt oben (Daumenreichweite) */
  .toast { top: auto; bottom: 24px; right: 12px; left: 12px; text-align: center; }
}

/* iOS Form-Zoom verhindern */
@media (max-width: 820px) {
  input, select, textarea { font-size: max(16px, 14px); }
}
