/* Оформление веба команды — как у сайта mornis.ru.
   Источник правил и пометок [С САЙТА] / [НОВОЕ] — docs/WEB_STYLE.md. */

/* ===== Токены [С САЙТА] ===== */
:root {
  --c-bg: #faf6f1;
  --c-surface: #ffffff;
  --c-text: #2e2119;
  --c-muted: #76675b; /* решение владельца: темнее сайтового #86766a, контраст 5.1:1 */
  --c-accent: #ffb76b;
  --c-accent-text: #3b2415; /* текст на оранжевом — никогда не белый */
  --c-brand: #9c6035;
  --c-danger: #c23b3b; /* решение владельца: темнее сайтового #d64545, контраст 4.9:1 */
  --c-border: #efe3d5;
  --radius: 16px;
  --shadow: 0 4px 20px rgb(0 0 0 / 0.06);
  --tap: 44px;

  /* [НОВОЕ] состояния и статусы */
  --c-accent-hover: #ffa94d;
  --c-accent-active: #f59a3a;
  --c-ok-bg: #e2f3e5;
  --c-ok-text: #1e6b2e;
  --c-warn-bg: #fdf0d8;
  --c-warn-text: #8a5a00;
  --c-bad-bg: #fde3e3;
  --c-bad-text: #a32020;
  --c-neutral-bg: #eeeeee;
  --c-neutral-text: #555555;

  /* [НОВОЕ] шкала размеров, раздел 2 */
  --fs-13: 13px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-24: 24px;
  --fs-32: 32px;

  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
}

/* ===== База [С САЙТА] ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  font-size: var(--fs-16);
  line-height: 1.45;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Шапка [С САЙТА, админка] ===== */
.admin-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.logo {
  display: inline-flex;
  padding: 4px 0;
  color: var(--c-brand);
}

.user {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--c-muted);
  font-size: var(--fs-15);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

@media (max-width: 800px) {
  .admin-top {
    flex-wrap: wrap;
  }
}

/* ===== Кнопка [С САЙТА] ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--c-accent);
  color: var(--c-accent-text);
  font-weight: 600;
  text-align: center;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  border: 1px solid var(--c-border);
  background: transparent;
}

/* [НОВОЕ] наведение, нажатие, фокус */
@media (hover: hover) {
  .btn:not([disabled]):not(.btn-ghost):hover {
    background: var(--c-accent-hover);
  }

  .btn-ghost:not([disabled]):hover {
    background: var(--c-surface);
  }
}

.btn:not([disabled]):not(.btn-ghost):active {
  background: var(--c-accent-active);
}

.btn:focus-visible,
.segmented button:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

/* ===== Вкладки: сегмент-переключатель [С САЙТА] ===== */
.tabs {
  margin: 0 0 16px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--c-border);
  border-radius: 14px;
}

.segmented button {
  min-height: var(--tap);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--c-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* На сайте активный вариант — button[aria-checked='true']; у нас его ставит app.js классом. */
.segmented button.is-active {
  background: var(--c-surface);
  box-shadow: var(--shadow);
}

/* ===== Уведомления [С САЙТА] ===== */
.notice {
  margin: 12px 0;
  padding: 12px 16px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
}

.notice-bad {
  border-color: #f2b8b8;
  background: #fff6f6;
  color: var(--c-danger);
}

.notice-action {
  margin: 0 0 16px;
}

/* ===== Строка обновления [НОВОЕ] ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
}

.updated,
.loading,
.empty {
  color: var(--c-muted);
  font-size: var(--fs-15);
}

.updated {
  font-variant-numeric: tabular-nums;
}

.loading {
  margin: 0 0 12px;
}

.empty {
  margin: 0;
}

/* ===== Стоп-лист [С САЙТА, админка: карточка и строки-разделители] ===== */
.admin-card {
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}

.stoplist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.stoplist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--tap);
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}

.stoplist-item:last-child {
  border-bottom: 0;
}

.stoplist-name {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.stoplist-meta {
  color: var(--c-muted);
  font-size: var(--fs-15);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ===== Доставки [С САЙТА: карточка order-box] ===== */
.deliveries {
  display: grid;
  gap: 12px;
}

.delivery-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}

.delivery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.delivery-number {
  overflow-wrap: anywhere;
  font-size: var(--fs-15);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.delivery-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
  color: var(--c-muted);
  font-size: var(--fs-15);
}

.delivery-time,
.delivery-source {
  font-variant-numeric: tabular-nums;
}

.delivery-items {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

/* ===== Бейдж статуса [С САЙТА] ===== */
.stage-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--c-neutral-bg);
  color: var(--c-neutral-text);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
}

.stage-cooking .stage-badge {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
}

.stage-ready .stage-badge,
.stage-on_way .stage-badge,
.stage-delivered .stage-badge {
  background: var(--c-ok-bg);
  color: var(--c-ok-text);
}

.stage-closed .stage-badge,
.stage-cancelled .stage-badge {
  background: var(--c-neutral-bg);
  color: var(--c-neutral-text);
}

.stage-error .stage-badge {
  background: var(--c-bad-bg);
  color: var(--c-bad-text);
}

/* ===== Вход [С САЙТА, админка] ===== */
.admin-login {
  width: calc(100% - 32px);
  max-width: 360px;
  margin: 12vh auto 0;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}

.login-logo {
  margin: 0 0 20px;
}

.login-status {
  margin: 0;
  font-size: var(--fs-18);
  line-height: 1.45;
}

/* ===== Телефон ===== */
@media (max-width: 480px) {
  .stoplist-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .stoplist-meta {
    white-space: normal;
  }
}
