:root {
  --cream: #f3ede3;
  --cream-dark: #e8dfd0;
  --ink: #1c1612;
  --ink-soft: #2a231e;
  --gold: #c4a35a;
  --gold-deep: #9a7a32;
  --gold-soft: #e8d7a8;
  --white: #fffbfa;
  --muted: #7a7168;
  --line: #e6ddd0;
  --terracotta: #b85c38;
  --success: #3f6b4e;
  --info: #3d5a73;
  --shadow: 0 10px 30px rgba(28, 22, 18, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "DM Sans", sans-serif;
  background: var(--cream);
  color: var(--ink);
}

h1, h2, h3 { font-family: "Playfair Display", serif; font-weight: 700; margin: 0; }
button, input, select { font-family: inherit; }
.hidden { display: none !important; }
.kicker {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold-deep);
  margin: 0 0 6px;
}

/* Login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #3a2d22, var(--ink));
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: #241c17;
  border: 1px solid rgba(196, 163, 90, 0.28);
  border-radius: 24px;
  padding: 36px;
  color: var(--white);
}
.login-card h1 { font-size: 40px; }
.login-sub { color: var(--gold-soft); margin: 8px 0 24px; }
.login-card label {
  display: block;
  font-size: 12px;
  color: var(--gold-soft);
  margin: 12px 0 6px;
}
.login-card input {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid #3d332b;
  background: #1c1612;
  color: white;
  padding: 0 14px;
}
.login-card button {
  width: 100%;
  margin-top: 18px;
  height: 50px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.hint { color: #8a8178; font-size: 12px; text-align: center; margin-top: 18px; }
.error { color: #e08a72; font-size: 13px; min-height: 18px; }

/* App shell */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: var(--white);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 12px; }
.mark {
  width: 42px; height: 42px; border-radius: 21px;
  border: 1px solid var(--gold);
  display: grid; place-items: center;
  font-family: "Playfair Display", serif;
  color: var(--gold-soft); font-size: 20px;
}
.brand strong { display: block; }
.brand span { color: var(--gold-soft); font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 6px; }
.nav-group {
  margin: 14px 8px 6px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a8178;
}
.nav-btn {
  text-align: left;
  background: transparent;
  border: 0;
  color: #cfc6bb;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  width: 100%;
}
.nav-btn small {
  display: block;
  font-size: 11px;
  color: #8a8178;
  font-weight: 400;
  margin-top: 2px;
}
.nav-btn.active, .nav-btn:hover { background: #2a231e; color: var(--gold-soft); }
.staff { margin-top: auto; padding: 12px; background: #2a231e; border-radius: 14px; font-size: 13px; }
.staff small { color: var(--gold); display: block; margin-top: 4px; }
.ghost {
  background: transparent;
  border: 1px solid #3d332b;
  color: #cfc6bb;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}

.main { padding: 22px 28px 40px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.top h2 { font-size: 32px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
#search {
  width: 280px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white); padding: 0 14px;
}
.live { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--success); font-weight: 600; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--white);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 28px; margin-top: 8px; font-family: "Playfair Display", serif; }

.panel {
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel h3 { padding: 16px 18px 0; font-size: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; font-size: 13px; border-top: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
tr { cursor: pointer; }
tr:hover td { background: #faf6f0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
.chip.on { background: var(--ink); color: white; border-color: var(--ink); }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.b-new { background: #f3e4c8; color: #8a5a12; }
.b-preparing { background: #f6e0d6; color: var(--terracotta); }
.b-ready { background: #dce8df; color: var(--success); }
.b-assigned { background: #dbe4ee; color: var(--info); }
.b-out_for_delivery { background: #e3d7f3; color: #5b3d86; }
.b-delivered { background: #dce8df; color: var(--success); }
.b-cancelled { background: #eee; color: #6b6560; }

.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kanban.delivery { grid-template-columns: repeat(4, 1fr); }
.col {
  background: #efe8dc;
  border-radius: 16px;
  padding: 12px;
  min-height: 360px;
}
.col h3 { font-size: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; }
.card {
  background: var(--white);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.card b { display: block; margin-bottom: 4px; }
.card p { margin: 0; color: var(--muted); font-size: 12px; }
.assign-box {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.assign-box .select {
  margin: 0;
  height: 36px;
  flex: 1;
  font-size: 12px;
}

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  background: var(--white);
  box-shadow: -12px 0 40px rgba(28,22,18,.14);
  padding: 22px;
  overflow: auto;
  z-index: 20;
}
.drawer[hidden] { display: none; }
.drawer h2 { font-size: 28px; }
.item-row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions button, .assign {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 600;
}
.actions .soft { background: var(--cream-dark); color: var(--ink); }
.actions .danger { background: var(--terracotta); }
.select {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 10px;
  margin-top: 8px;
}
.timeline { list-style: none; padding: 0; margin: 16px 0; }
.timeline li { font-size: 13px; color: var(--muted); padding-left: 14px; border-left: 2px solid var(--gold); margin: 8px 0; }
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--ink); color: white; padding: 12px 16px;
  border-radius: 12px; z-index: 30;
}

.mod-wrap { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }
.mod {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eee;
  color: #8a8178;
}
.mod.on { background: #1c1612; color: #e8d7a8; }
.mod-pick { display: grid; gap: 8px; margin: 8px 0 16px; }
.mod-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: start;
  background: var(--cream);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.mod-check span { grid-column: 2; color: var(--muted); font-size: 12px; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.btn-gold { background: linear-gradient(90deg, var(--gold), var(--gold-deep)); }
.btn.soft { background: var(--cream-dark); color: var(--ink); }
.btn.danger { background: var(--terracotta); }
.btn.tiny { padding: 6px 10px; font-size: 12px; margin-top: 8px; }
.overlay {
  position: fixed; inset: 0;
  background: rgba(28,22,18,.45);
  z-index: 15;
}
.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  z-index: 25;
  padding: 20px;
}
.modal-card {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--white);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  height: 42px; border-radius: 10px; border: 1px solid var(--line);
  padding: 0 10px; background: white;
}
.field textarea { height: 80px; padding: 10px; }
.toggle { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.pay { font-size: 11px; font-weight: 700; color: var(--gold-deep); }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.bar { flex: 1; height: 8px; background: var(--cream-dark); border-radius: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.item-pick { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.switch { cursor: pointer; }

@media print {
  .sidebar, .top, .actions, .live, .btn, nav, #overlay, #modal { display: none !important; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .stats, .kanban, .kanban.delivery, .grid-2 { grid-template-columns: 1fr; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .staff, .ghost { margin-top: 0; }
}
