/* ==========================================================================
   1. Переменные и базовые стили
   ========================================================================== */
:root {
  --yellow:       #ffd500;
  --yellow-hover: #ffdf33;
  --yellow-soft:  #fff8cc;
  --black:        #1a1a1a;
  --black-hover:  #333333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1a1a1a;
  background: #f4f4f4;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

main.container {
  flex: 1; /* Прижимает футер к низу */
}

/* ==========================================================================
   2. Шапка сайта (Topbar)
   ========================================================================== */
.topbar {
  background: #fff;
  border-bottom: 3px solid var(--yellow);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo-link {
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.15s;
}
.logo-link:hover {
  opacity: 0.85;
}

.logo {
  display: inline-block;
  background: var(--yellow);
  color: var(--black);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.5px;
  padding: 6px 12px;
  border-radius: 6px;
}
.logo span { margin-left: 2px; }

nav a {
  margin-left: 20px;
  color: var(--black);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
nav a:hover {
  background: var(--yellow);
}

.nav-user {
  margin-left: 20px;
  font-weight: 600;
  font-size: 15px;
}

.nav-logout {
  display: inline;
  margin-left: 12px;
}

.link-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  font: inherit;
  font-weight: 600;
  color: var(--black);
  cursor: pointer;
  border-radius: 6px;
}
.link-btn:hover {
  background: var(--yellow);
}

/* ==========================================================================
   3. Футер
   ========================================================================== */
.site-footer {
  margin-top: 48px;
  padding: 20px 0;
  background: var(--black);
  color: #ddd;
  font-size: 14px;
  border-top: 4px solid var(--yellow);
}
.site-footer .footer-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 24px;
  text-align: center;
}
.site-footer b { color: #fff; }
.site-footer a {
  color: var(--yellow);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   4. Типографика и карточки
   ========================================================================== */
h1 { font-size: 28px; margin: 28px 0 8px; line-height: 1.2; }
h2 { font-size: 22px; margin: 32px 0 12px; }
.lead { color: #555; margin: 0 0 24px; font-size: 17px; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  margin-bottom: 20px;
}
.card.center { text-align: center; }

/* ==========================================================================
   5. Формы
   ========================================================================== */
label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 400;
  font-family: inherit;
  background: #fff;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--black);
  outline: none;
  box-shadow: 0 0 0 3px var(--yellow);
}

.hint {
  display: block;
  margin-top: 4px;
  color: #777;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
}
.check input {
  width: auto;
  margin: 3px 0 0;
}
.check a {
  color: var(--black);
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.check a:hover {
  background: var(--yellow);
}

.row { display: flex; gap: 8px; align-items: center; }

.row-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.row-form input, .row-form label { margin-bottom: 0; }
.row-form label { flex: 1; }

/* Выделение поля "Объект" */
.field-highlight {
  position: relative;
  padding: 16px 16px 14px;
  margin: 0 -16px 20px;
  border-radius: 12px;
  background: var(--yellow-soft);
  border: 2px solid var(--yellow);
}
.field-highlight .field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 16px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}
.field-highlight .field-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--black);
  color: var(--yellow);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  text-transform: uppercase;
  white-space: nowrap;
}
.field-highlight select {
  margin-top: 0;
  font-size: 17px;
  font-weight: 700;
  padding: 14px 16px;
  border: 2px solid var(--black);
  background: #fff;
}
.field-highlight select:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px var(--yellow);
}

/* Степпер количества (Кнопки + и -) */
.qty-stepper {
  display: flex;
  align-items: stretch;
  margin-top: 6px;
}
.qty-stepper input {
  margin: 0;
  flex: 1;
  border-radius: 0;
  border-left: none;
  border-right: none;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-btn {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  color: #fff;
  border: 2px solid var(--black);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  padding: 0;
  user-select: none;
}
.qty-btn:hover { background: var(--black-hover); border-color: var(--black-hover); }
.qty-btn:disabled { background: #d9d9d9; border-color: #d9d9d9; color: #999; cursor: not-allowed; }
.qty-btn#qtyMinus { border-radius: 8px 0 0 8px; }
.qty-btn#qtyPlus  { border-radius: 0 8px 8px 0; }

/* ==========================================================================
   6. Кнопки
   ========================================================================== */
.btn {
  display: inline-block;
  width: 100%;
  padding: 16px;
  background: var(--black);
  color: #fff;
  border: 2px solid var(--black);
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--black-hover); border-color: var(--black-hover); }
.btn:disabled {
  background: #d9d9d9;
  border-color: #d9d9d9;
  color: #777;
  cursor: not-allowed;
}
.btn-small { width: auto; padding: 12px 24px; font-size: 15px; }

/* ==========================================================================
   7. Разное (Flash, предупреждения, итого)
   ========================================================================== */
.total { font-size: 20px; margin: 16px 0; }
.total b { color: var(--black); }

.warning {
  background: var(--yellow-soft);
  border: 1px solid var(--yellow);
  color: var(--black);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  text-align: center;
}

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-weight: 600;
  border-left: 4px solid var(--yellow);
}
.flash-ok    { background: #f2f2f2; color: var(--black); }
.flash-error { background: var(--yellow-soft); color: var(--black); }

/* Модальное окно согласия */
dialog {
  border: none;
  border-radius: 12px;
  padding: 24px;
  max-width: 560px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(0,0,0,.5); }
.consent-text { white-space: pre-line; font-size: 15px; color: #333; }

/* Страница Успеха */
.success-details {
  margin: 24px 0;
  font-size: 18px;
  line-height: 1.6;
}
.success-details p { margin: 8px 0; }
.success-hint { color: #555; margin-bottom: 24px; }

/* ==========================================================================
   8. Таблицы (Общие и Меню)
   ========================================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
th { background: var(--black); color: #fff; font-size: 14px; }
tfoot th { background: #f4f4f4; color: var(--black); }
details summary { cursor: pointer; color: var(--black); font-weight: 600; }
details summary:hover { background: var(--yellow); }
.details-list { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.details-list li { margin-bottom: 4px; }

/* Меню на клиентской странице */
.menu-card { border-left: 6px solid var(--yellow); }
.menu-card h2 { margin: 0 0 4px; font-size: 20px; }
.menu-day { color: #777; font-size: 14px; margin: 0 0 12px; }
.menu-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  font-size: 15px;
}
.menu-table th, .menu-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.menu-table thead th {
  background: transparent;
  color: #777;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid var(--yellow);
}
.menu-table tbody tr:last-child td { border-bottom: none; }
.menu-table .col-num { width: 48px; text-align: center; color: #888; }
.menu-table .col-weight {
  width: 110px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.menu-note {
  margin: 16px 0 0;
  padding: 12px 16px;
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--black);
}

/* ==========================================================================
   9. Страница Кассира (Сводка)
   ========================================================================== */
.cashier-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.cashier-list .card { margin-bottom: 0; }

.cashier-object {
  padding: 0;
  overflow: hidden;
}

.obj-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--black);
  color: #fff;
}
.obj-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.obj-name { font-size: 16px; }
.obj-name b { color: var(--yellow); }
.obj-total { font-size: 15px; white-space: nowrap; }
.obj-total b {
  display: inline-block;
  min-width: 32px;
  padding: 2px 10px;
  margin-left: 4px;
  background: var(--yellow);
  color: var(--black);
  border-radius: 999px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Кнопка скачивания в шапке объекта */
.btn-download {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: transparent;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-download:hover {
  background: var(--yellow);
  color: var(--black);
}

/* Таблица заказов внутри карточки */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 0;
  table-layout: fixed;
}
.orders-table th, .orders-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 15px;
}
.orders-table thead th {
  background: #fafafa;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid var(--yellow);
}
.orders-table tbody tr:last-child td { border-bottom: none; }

.orders-table .col-num { width: 48px; text-align: center; color: #888; }
.orders-table .col-time {
  width: 130px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.orders-table .col-qty {
  width: 120px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Примечания в таблице кассира */
.orders-table .note-row td { padding-top: 0; border-bottom: 1px solid #eee; }
.orders-table .note-cell {
  color: #555;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
}

.cashier-grand-total {
  font-size: 16px;
  text-align: right;
}
.cashier-grand-total b {
  display: inline-block;
  min-width: 44px;
  padding: 2px 12px;
  background: var(--yellow);
  color: var(--black);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   10. Админка (Настройки и Объекты)
   ========================================================================== */
.login-card {
  max-width: 420px;
  margin: 40px auto;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.inline-form input[type="text"] {
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
}
.inline-form .btn-small {
  padding: 8px 14px;
  font-size: 14px;
  white-space: nowrap;
}

tr.row-inactive td { opacity: .55; }
tr.row-inactive .inline-form input,
tr.row-inactive .inline-form .btn-small { opacity: 1; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.badge-on  { background: var(--yellow); color: var(--black); }
.badge-off { background: #e5e5e5; color: #666; }

/* ==========================================================================
   11. Адаптивность (Мобильные устройства)
   ========================================================================== */
@media (max-width: 640px) {
  .cashier-table, .orders-table { table-layout: auto; }
  .orders-table .col-time, .orders-table .col-qty { width: auto; }
  .obj-header { font-size: 14px; }
  .obj-actions { flex-wrap: wrap; gap: 8px; }
}


/* ==========================================================================
   Переключатель видов (За день / За месяц)
   ========================================================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 28px 0 20px;
}
.page-header h1 {
  margin: 0;
}

.view-switch {
  display: flex;
  background: #e5e5e5;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.switch-btn {
  padding: 8px 20px;
  border-radius: 6px;
  text-decoration: none;
  color: #555;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.15s;
  white-space: nowrap;
}
.switch-btn:hover {
  color: var(--black);
}
.switch-btn.active {
  background: var(--yellow);
  color: var(--black);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Ссылка на день в отчете за месяц */
.day-link {
  display: inline-block;
  padding: 4px 10px;
  color: var(--black);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--yellow);
  transition: background 0.15s;
  border-radius: 4px 4px 0 0;
}
.day-link:hover {
  background: var(--yellow);
}

/* Поля ввода внутри таблицы объектов */
table td input[type="text"] {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  transition: all 0.15s;
}
table td input[type="text"]:focus {
  background: #fff;
  border-color: var(--black);
  box-shadow: 0 0 0 2px var(--yellow);
  outline: none;
}
/* Чекбокс активности */
table td input[type="checkbox"] {
  accent-color: var(--yellow); /* Желтый цвет галочки (в современных браузерах) */
}
