/* CRM «Якудза» — тёмный сайдбар, светлый контент */

.admin-body { background: #f4efe6; }
.admin-body[hidden] { display: none; }

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(80% 60% at 80% 10%, rgba(177, 49, 16, 0.18), transparent 60%),
    var(--ink);
}
.login-card {
  width: min(400px, 100%);
  background: var(--paper);
  border-radius: 24px;
  padding: 36px 34px;
  display: grid;
  gap: 14px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.7);
}
.login-card img { justify-self: start; }
.login-card h1 { font-family: var(--font-display); font-size: 1.7rem; }
.login-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.login-card label { display: grid; gap: 6px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.login-card input {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}
.login-card input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(177, 49, 16, 0.12); }
.login-error { color: #c0392b; font-weight: 600; }

.abtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: 0.25s var(--ease);
}
.abtn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.abtn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.abtn--primary:hover { background: var(--accent-2); }
.abtn--danger { background: #fff; border-color: #e3b4ad; color: #b3261e; }
.abtn--danger:hover { background: #fdf1ef; }
.abtn--ghost { background: transparent; }
.abtn--sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 10px; }
.abtn[disabled] { opacity: 0.5; pointer-events: none; }

.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.admin-side {
  background: var(--ink);
  color: var(--paper);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand span { font-family: var(--font-display); font-size: 1.2rem; display: flex; flex-direction: column; gap: 4px; }
.admin-brand small { font-family: var(--font-body); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(251, 247, 240, 0.5); }

.admin-nav { display: grid; gap: 4px; }
.admin-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.94rem;
  color: rgba(251, 247, 240, 0.75);
  transition: 0.25s;
}
.admin-nav a:hover { background: rgba(251, 247, 240, 0.08); color: #fff; }
.admin-nav a.active { background: var(--accent); color: #fff; }
.admin-nav b {
  font-size: 0.72rem;
  background: rgba(251, 247, 240, 0.14);
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 22px;
  text-align: center;
}
.admin-nav a.active b { background: rgba(0, 0, 0, 0.25); }

.admin-side-foot { margin-top: auto; display: grid; gap: 8px; }
.admin-side-foot a, .admin-side-foot button {
  background: none;
  border: 0;
  color: rgba(251, 247, 240, 0.65);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 10px;
}
.admin-side-foot a:hover, .admin-side-foot button:hover { background: rgba(251, 247, 240, 0.08); color: #fff; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(244, 239, 230, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.admin-top h1 { font-family: var(--font-display); font-size: 1.35rem; }
.admin-top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.admin-user { font-size: 0.84rem; color: var(--muted); }
.admin-burger { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; }

.admin-content { padding: 26px 28px 60px; display: grid; gap: 22px; align-content: start; }

.acard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
}
.acard h2 { font-family: var(--font-body); font-size: 1rem; font-weight: 800; margin-bottom: 14px; }
.acard-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.acard-head h2 { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: grid; gap: 6px; }
.stat-card b { font-family: var(--font-display); font-size: 1.8rem; }
.stat-card span { font-size: 0.85rem; color: var(--muted); }
.stat-card--accent { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.stat-card--accent span { color: rgba(251, 247, 240, 0.65); }

.status-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sbadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f1ece3;
  color: #4a3f36;
}
.sbadge i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sbadge[data-s="new"] { background: #e8f0fd; color: #1d4ed8; }
.sbadge[data-s="confirmed"] { background: #ece9fd; color: #5b21b6; }
.sbadge[data-s="cooking"] { background: #fdf0e3; color: #b45309; }
.sbadge[data-s="delivering"] { background: #f3e8fd; color: #7e22ce; }
.sbadge[data-s="ready"] { background: #e3f6f4; color: #0f766e; }
.sbadge[data-s="done"] { background: #e6f6ea; color: #15803d; }
.sbadge[data-s="cancelled"] { background: #fdeaea; color: #b3261e; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}
.filter-bar input:focus, .filter-bar select:focus { outline: 0; border-color: var(--accent); }

.table-wrap { overflow-x: auto; }
table.atable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.atable th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.atable td { padding: 12px; border-bottom: 1px solid rgba(23, 18, 16, 0.07); vertical-align: middle; }
.atable tr.is-click { cursor: pointer; }
.atable tr.is-click:hover td { background: #faf6ef; }
.atable .num { font-weight: 800; }
.atable .muted { color: var(--muted); font-size: 0.82rem; }
.atable .nowrap { white-space: nowrap; }

.bonus-pos { color: #15803d; font-weight: 800; }
.bonus-neg { color: #b3261e; font-weight: 800; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.pager span { font-size: 0.85rem; color: var(--muted); }

.detail-rows { display: grid; gap: 10px; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; font-size: 0.92rem; border-bottom: 1px dashed rgba(23, 18, 16, 0.1); padding-bottom: 8px; }
.detail-row span:first-child { color: var(--muted); }
.detail-row b { text-align: right; }
.items-list { display: grid; gap: 6px; }
.items-list li { display: flex; justify-content: space-between; gap: 14px; font-size: 0.9rem; padding: 6px 0; border-bottom: 1px dashed rgba(23, 18, 16, 0.08); }

.drawer { position: fixed; inset: 0; z-index: 200; }
.drawer-veil { position: absolute; inset: 0; background: rgba(15, 11, 9, 0.55); animation: fadeIn 0.25s; }
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100%);
  background: var(--paper);
  padding: 26px;
  overflow-y: auto;
  animation: slideIn 0.3s var(--ease);
  display: grid;
  gap: 18px;
  align-content: start;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-panel h2 { font-family: var(--font-display); font-size: 1.4rem; }
.drawer-close { position: absolute; top: 18px; right: 18px; border: 0; background: #f1ece3; width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status-actions .abtn[data-active="1"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.note-area { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; resize: vertical; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.25s;
}
.toast--error { background: #8f1f14; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 780px; }
.settings-grid label { display: grid; gap: 6px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.settings-grid input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; }
.settings-grid .full { grid-column: 1 / -1; }

.connect-box { display: grid; gap: 10px; }
.connect-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #b98a2e; }
.dot--on { background: #15803d; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; word-break: break-all; }

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed;
    z-index: 120;
    width: 260px;
    transform: translateX(-105%);
    transition: transform 0.3s var(--ease);
  }
  .admin-side.is-open { transform: none; }
  .admin-burger { display: block; }
  .admin-content, .admin-top { padding-left: 16px; padding-right: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
}
