:root {
  --dark: #3B2E24;       /* тёмно-коричневый (кофейное зерно с логотипа) */
  --mocha: #9C8A72;      /* мокко/тауп (буква S) */
  --mocha-light: #C9BBA4;
  --cream: #F7F1E8;      /* фон, тёплый крем */
  --paper: #FFFFFF;
  --accent: #B5652E;     /* тёплый терракотовый акцент для действий/статусов */
  --success: #4C7A4A;
  --danger: #A23B32;
  --line: #E4D9C6;
  --text: #2A2119;
  --text-muted: #8A7A66;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(59, 46, 36, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--dark) 0%, #2A2019 100%);
}

.login-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 340px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  text-align: center;
  animation: floatIn 0.5s ease;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card h1 {
  font-size: 22px;
  letter-spacing: 1px;
  margin: 0 0 4px;
  text-transform: uppercase;
  color: var(--dark);
}

.login-card p.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 24px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--cream);
}

.login-card input:focus { outline: 2px solid var(--mocha); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--dark); color: #fff; width: 100%; }
.btn-primary:hover { background: #2A2019; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { box-shadow: 0 4px 14px rgba(181,101,46,0.4); }
.btn-ghost { background: transparent; color: var(--dark); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

#login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 8px;
}

.demo-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

/* ---------- App shell ---------- */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--dark);
  color: #EDE6DA;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 6px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--mocha);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--dark);
}
.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-transform: uppercase;
}
.brand-name small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--mocha-light);
  text-transform: none;
  letter-spacing: 0.3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: #D8CDBC;
  margin-bottom: 4px;
  transition: background 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item.active { background: var(--mocha); color: var(--dark); font-weight: 700; }

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  color: var(--mocha-light);
}
.sidebar-footer .role-badge {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  margin-bottom: 10px;
}

.main {
  flex: 1;
  padding: 28px 36px;
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h2 {
  margin: 0;
  font-size: 22px;
  color: var(--dark);
}
.page-header p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.toolbar { display: flex; gap: 10px; align-items: center; }

/* ---------- Orders board ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.board-col {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  min-height: 200px;
}
.board-col h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
}
.board-col h3 .count {
  background: var(--cream);
  color: var(--dark);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
}

.order-card {
  display: flex;
  align-items: stretch;
  gap: 10px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  animation: floatIn 0.25s ease;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.order-card--new {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(162, 59, 50, 0.25);
}
.order-card-info { flex: 1; min-width: 0; }
.order-card .order-code {
  font-weight: 800;
  font-size: 14px;
  color: var(--dark);
}
.order-card .order-time {
  font-size: 11px;
  color: var(--text-muted);
  float: right;
}
.order-card .order-items {
  font-size: 12.5px;
  margin: 8px 0;
  color: var(--text);
  line-height: 1.5;
}
.order-card .order-customer {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.order-card .order-total {
  font-weight: 700;
  font-size: 13px;
}
.order-card .order-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  width: 92px;
}
.order-card .order-actions .btn { width: 100%; }

.empty-col {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
}

/* ---------- Tables / cards grid ---------- */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
.avail-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.avail-yes { background: #E4EFE1; color: var(--success); }
.avail-no { background: #F3E2DE; color: var(--danger); }

.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.promo-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.promo-card .thumb {
  height: 100px;
  background: linear-gradient(135deg, var(--mocha), var(--dark));
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  overflow: hidden;
}
.promo-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.promo-card .body { padding: 12px 14px; }
.promo-card .type-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.5px;
}
.promo-card h4 { margin: 6px 0 2px; font-size: 15px; }
.promo-card p { margin: 0 0 10px; font-size: 12.5px; color: var(--text-muted); }
.promo-card .actions { display: flex; gap: 6px; padding: 0 14px 12px; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--dark); margin-top: 4px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(42,33,25,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  width: 420px;
  max-height: 86vh;
  overflow-y: auto;
  animation: floatIn 0.2s ease;
}
.modal h3 { margin-top: 0; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--cream);
}
.form-row textarea { resize: vertical; min-height: 60px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.image-preview {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
}
.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.upload-btn {
  cursor: pointer;
  display: inline-flex;
}
.upload-status {
  font-size: 11.5px;
  color: var(--text-muted);
}

.option-group {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.option-group-header {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.option-group-header input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  background: var(--paper);
}
.option-choice-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.option-choice-row input {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12.5px;
  background: var(--paper);
}
.option-choice-row .option-choice-label { flex: 2; }
.option-choice-row .option-choice-delta { flex: 1; }

.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  animation: floatIn 0.25s ease;
  z-index: 100;
}
