/* ========== RestoManager Styles ========== */
:root {
  --primary: #e8590c;
  --primary-dark: #d9480f;
  --bg: #f4f2ee;
  --card: #ffffff;
  --sidebar: #23222b;
  --sidebar-text: #b9b7c4;
  --text: #2b2a33;
  --muted: #8a8894;
  --border: #e6e2da;
  --green: #2f9e44;
  --green-bg: #e6f4ea;
  --red: #e03131;
  --red-bg: #fdecec;
  --orange: #f08c00;
  --orange-bg: #fff4e0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(35, 34, 43, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; font-size: 19px; font-weight: 700; color: #fff;
}
.logo-icon { font-size: 24px; }
.nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer .btn { color: var(--sidebar-text); }
.sidebar-footer .btn:hover { color: #fff; }
.btn-danger-text:hover { color: #ff8787 !important; }

/* ---------- Main ---------- */
.main { flex: 1; padding: 24px 32px 48px; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 22px;
}
.topbar h1 { font-size: 26px; }
.topbar-date { color: var(--muted); font-size: 14px; }

/* ---------- Cards & KPIs ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi-icon {
  font-size: 22px; width: 46px; height: 46px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--bg); border-radius: 10px;
}
.kpi-value { font-size: 21px; font-weight: 700; }
.kpi-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.kpi-green .kpi-value { color: var(--green); }
.kpi-red .kpi-value { color: var(--red); }
.kpi-orange .kpi-value { color: var(--orange); }

/* ---------- Charts ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}
.chart-card h3 { font-size: 15px; margin-bottom: 12px; }
.chart-box { position: relative; height: 260px; }

/* ---------- Toolbar, Filter, Pills ---------- */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.summary-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pill {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--muted);
}
.pill strong { color: var(--text); }
.pill-green { background: var(--green-bg); border-color: transparent; }
.pill-green strong { color: var(--green); }
.pill-red { background: var(--red-bg); border-color: transparent; }
.pill-red strong { color: var(--red); }
.pill-orange { background: var(--orange-bg); border-color: transparent; }
.pill-orange strong { color: var(--orange); }

/* ---------- Buttons & Inputs ---------- */
.btn {
  border: none; border-radius: 8px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text);
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.06); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-icon {
  border: none; background: transparent; cursor: pointer;
  font-size: 15px; padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.btn-icon:hover { background: rgba(0, 0, 0, 0.07); }

.input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
  background: var(--card); color: var(--text); min-width: 0;
}
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
textarea.input { resize: vertical; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 0, 0, 0.02); }
.num { text-align: right; white-space: nowrap; }
th.num { text-align: right; }
.actions { text-align: right; white-space: nowrap; }
td a { color: var(--primary); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-neutral { background: var(--bg); color: var(--muted); }
.text-green { color: var(--green); font-weight: 600; }
.text-red { color: var(--red); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Dashboard: letzte Buchungen ---------- */
.recent-list { list-style: none; }
.recent-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.recent-list li:last-child { border-bottom: none; }
.recent-desc { flex: 1; min-width: 0; }
.recent-desc small { display: block; color: var(--muted); }
.recent-amount { white-space: nowrap; }

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center; color: var(--muted);
  padding: 42px 16px; font-size: 14px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 20, 28, 0.45);
  display: grid; place-items: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal form { display: flex; flex-direction: column; min-height: 0; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px 0;
}
.modal-header h3 { font-size: 18px; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 0 22px 20px;
}
.field { display: block; margin-bottom: 13px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.field .input { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 13px; }
.confirm-text { padding: 6px 0 2px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 14px; }
.detail-full { grid-column: 1 / -1; }
.detail-heading { margin: 18px 0 8px; font-size: 14px; }
.detail-table th, .detail-table td { padding: 7px 8px; font-size: 13px; }

.invoice-item-row {
  display: grid; grid-template-columns: 1fr 84px 110px 34px;
  gap: 8px; margin-bottom: 8px; align-items: center;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--sidebar); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--red); }

/* ---------- PDF-Belege ---------- */
.toolbar-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone-active { outline: 3px dashed var(--primary); outline-offset: -3px; border-radius: var(--radius); }
.form-hint {
  background: var(--orange-bg); color: #7a5200;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 13px;
}
a.btn-icon { text-decoration: none; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: grid; place-items: center; padding: 20px;
}
.login-screen[hidden] { display: none; }
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  width: 100%; max-width: 360px; padding: 36px 32px;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.login-logo { font-size: 42px; }
.login-card h2 { font-size: 22px; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.login-error { color: var(--red); font-size: 13px; font-weight: 600; }

/* ---------- Rechnungsdruck ---------- */
.print-area { display: none; }

@media print {
  body > .app, .modal-backdrop, .toast-container { display: none !important; }
  .print-area { display: block; }
  body { background: #fff; }
}

.invoice-doc { max-width: 720px; margin: 0 auto; padding: 32px 8px; color: #000; font-size: 13px; }
.invoice-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.invoice-head h2 { font-size: 20px; margin-bottom: 6px; }
.invoice-meta h1 { font-size: 24px; margin-bottom: 8px; text-align: right; }
.invoice-meta table td { border: none; padding: 2px 0 2px 14px; text-align: right; }
.invoice-address { margin-bottom: 32px; }
.invoice-address .small { border-bottom: 1px solid #ccc; display: inline-block; padding-bottom: 3px; margin-bottom: 10px; }
.invoice-table { margin-bottom: 24px; }
.invoice-table th { border-bottom: 2px solid #000; color: #000; }
.invoice-table td { border-bottom: 1px solid #ddd; }
.invoice-table tfoot td { border-bottom: none; padding-top: 6px; }
.invoice-total td { font-weight: 700; font-size: 15px; border-top: 2px solid #000 !important; }
.invoice-foot {
  margin-top: 48px; padding-top: 12px; border-top: 1px solid #ccc;
  display: flex; flex-direction: column; gap: 3px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 18px 16px 40px; }
  .field-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
