/* ============================================================
   CheckStock – Verwaltungs-Website
   Funktionale, werkstattnahe Ästhetik: Signalblau, klare Flächen.
   ============================================================ */

:root {
  --blue: #1565c0;
  --blue-dark: #0d47a1;
  --blue-soft: #e8f0fb;
  --amber: #ff8f00;
  --ink: #1a2230;
  --muted: #5f6b7a;
  --line: #e2e6ec;
  --bg: #f5f7fa;
  --card: #ffffff;
  --ok: #2e7d32;
  --warn: #f9a825;
  --crit: #c62828;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.08), 0 1px 2px rgba(20, 30, 50, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border-top: 4px solid var(--blue);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.brand-mark {
  width: 40px; height: 40px;
  background: var(--blue);
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 20px;
  letter-spacing: -1px;
}
.brand h1 { font-size: 22px; letter-spacing: -0.5px; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ---- Layout (eingeloggt) ---- */
.app { display: none; min-height: 100vh; grid-template-columns: 240px 1fr; }
.app.active { display: grid; }

.sidebar {
  background: var(--ink);
  color: #cfd6e0;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand h1 { color: #fff; font-size: 18px; }
.sidebar .brand-mark { width: 32px; height: 32px; font-size: 16px; }
.nav { margin-top: 32px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav button {
  background: transparent;
  border: none;
  color: #aeb8c6;
  text-align: left;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav button.active { background: var(--blue); color: #fff; font-weight: 600; }
.sidebar-foot { font-size: 12px; color: #7c8697; border-top: 1px solid #2b3547; padding-top: 14px; }
.sidebar-foot button {
  background: none; border: none; color: var(--amber);
  cursor: pointer; font-size: 13px; padding: 0; margin-top: 6px;
  font-family: inherit;
}

.main { padding: 28px 32px; overflow-y: auto; max-height: 100vh; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-head h2 { font-size: 24px; letter-spacing: -0.5px; }
.page-head p { color: var(--muted); font-size: 14px; }

/* ---- Karten & Tabellen ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted);
  padding: 11px 18px; border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
td { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ---- Statusfarben ---- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.pill.open { background: #fdecea; color: var(--crit); }
.pill.ordered { background: #fff3e0; color: #e65100; }
.pill.done { background: #e8f5e9; color: var(--ok); }
.pill.critical { background: #fdecea; color: var(--crit); }
.pill.normal { background: var(--blue-soft); color: var(--blue-dark); }
.pill.low { background: #eceff1; color: #546e7a; }

.dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:6px; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }

/* ---- Formulare & Buttons ---- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: #fbfcfd; transition: border 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--blue); background: #fff; }
.field { margin-bottom: 16px; }

.btn {
  background: var(--blue); color: #fff; border: none;
  padding: 11px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background 0.15s;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.amber { background: var(--amber); }
.btn.amber:hover { background: #ef6c00; }
.btn.danger { background: var(--crit); }
.btn.full { width: 100%; }

/* ---- Hinweise ---- */
.alert {
  padding: 11px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}
.alert.err { background: #fdecea; color: var(--crit); }
.alert.ok { background: #e8f5e9; color: var(--ok); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---- Kennzahlen ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.crit .num { color: var(--crit); }
.stat.warn .num { color: #e65100; }

/* ---- Modal ---- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20,30,50,0.5);
  display: none; place-items: center; padding: 20px; z-index: 50;
}
.modal-bg.active { display: grid; }
.modal {
  background: #fff; border-radius: 12px; padding: 26px;
  width: 100%; max-width: 460px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal h3 { font-size: 19px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---- Responsive ---- */
@media (max-width: 780px) {
  .app.active { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px; }
  .nav { flex-direction: row; margin-top: 0; flex-wrap: wrap; }
  .sidebar-foot { border: none; padding: 0; }
  .main { max-height: none; }
}
