/* Единый кабинет ресторанной группы */
:root {
  --bg: #0e0f13;
  --panel: #16181f;
  --panel-2: #1c1f28;
  --line: #262a35;
  --text: #eef0f5;
  --muted: #8b91a3;
  --accent: #e2582b;
  --green: #35c07a;
  --red: #ef4d5a;
  --amber: #f0b030;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

/* ---------- Каркас ---------- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.sidebar__brand b { font-size: 16px; letter-spacing: -.02em; }
.sidebar__brand span { font-size: 12px; color: var(--muted); }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav a {
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s, color .15s;
}
.sidebar__nav a:hover { background: var(--panel-2); color: var(--text); }
.sidebar__nav a.is-active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.sidebar__foot { margin-top: auto; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }

.main { padding: 26px 30px 60px; max-width: 1500px; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.topbar__title { display: flex; flex-direction: column; gap: 3px; }
.topbar__title span { font-size: 13px; color: var(--muted); }
.topbar__spacer { flex: 1; }

/* ---------- Элементы управления ---------- */
.control, select, input, textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 11px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
select:focus, input:focus, textarea:focus { border-color: #3a4152; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label.field input, label.field select, label.field textarea { color: var(--text); }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #232733; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn--primary:hover { background: #cf4c22; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn--danger { color: var(--red); }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.seg button.is-active { background: var(--bg); color: var(--text); font-weight: 600; }

/* ---------- Карточки ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card__head h2 { flex: 1; }

.grid { display: grid; gap: 14px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid--rest { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi__label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin-top: 8px; }
.kpi__sub { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.kpi__sub .delta { white-space: nowrap; }
.delta { font-weight: 600; }
.delta--up { color: var(--green); }
.delta--down { color: var(--red); }
.delta--flat { color: var(--muted); }

/* Карточка ресторана */
.rest {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rest__head { display: flex; align-items: baseline; gap: 8px; }
.rest__head b { font-size: 16px; }
.rest__head span { font-size: 12px; color: var(--muted); }
.rest__revenue { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.rest__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; }
.rest__row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.rest__row b { color: var(--text); font-weight: 600; }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 0 12px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
}
.tag__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-new { color: var(--amber); }
.status-confirmed, .status-preparing { color: #7aa2f7; }
.status-delivering { color: #56b6c2; }
.status-done { color: var(--green); }
.status-cancelled { color: var(--red); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------- Воронка ---------- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel__step { display: flex; flex-direction: column; gap: 5px; }
.funnel__meta { display: flex; justify-content: space-between; font-size: 13px; }
.funnel__meta b { font-size: 15px; }
.funnel__bar { height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.funnel__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #f0954a); }

/* ---------- График ---------- */
.chart { width: 100%; height: 240px; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Прочее ---------- */
.notice {
  padding: 12px 14px; border-radius: 10px; font-size: 13.5px;
  background: rgba(240, 176, 48, .1); border: 1px solid rgba(240, 176, 48, .3); color: #f5cd7c;
}
.notice--ok { background: rgba(53, 192, 122, .1); border-color: rgba(53, 192, 122, .3); color: #7ee0ab; }
.notice--err { background: rgba(239, 77, 90, .1); border-color: rgba(239, 77, 90, .3); color: #ff9aa2; }

.empty { padding: 40px; text-align: center; color: var(--muted); }
.spinner { padding: 30px; text-align: center; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.pill-list { display: flex; flex-direction: column; gap: 9px; }
.pill-list__row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bar { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login__box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.login__box h1 { margin-bottom: 6px; }
.login__box p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.login__box form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Модалка ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal[hidden] { display: none; }
.modal__box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; max-height: 86vh; overflow: auto; box-shadow: var(--shadow); }
.modal__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal__head h2 { flex: 1; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; gap: 14px; }
  .sidebar__nav { flex-direction: row; }
  .sidebar__foot { display: none; }
  .main { padding: 18px 16px 50px; }
}
