:root {
  color-scheme: light;
  --bg: #f6f1ea;
  --panel: #fffaf3;
  --text: #2b2118;
  --muted: #76695f;
  --line: #eadfce;
  --brand: #8b5e34;
  --brand-dark: #6f4522;
  --danger: #b42318;
  --ok: #177245;
  --shadow: 0 20px 60px rgba(69, 45, 25, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  /* Фон сайта — белый по запросу. Раньше был тёплый градиент. */
  background: #ffffff;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  background: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--brand-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  background: #ffffff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.topbar,
.tabs {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.login-card {
  max-width: 430px;
  padding: 34px;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 28px 0 16px;
}

.topbar h1 {
  margin-bottom: 0;
}

/* Лого в шапке вместо «Кофейня»/«Рабочее меню». Высота фиксированная,
   ширина адаптивная — лого широкое (текстовый знак), сжимается на узких экранах.
   Размеры увеличены в 2.5× от изначальных (56→140 в шапке, 48→120 в логине). */
.topbar-logo {
  display: block;
  height: 140px;
  width: auto;
  max-width: min(1050px, 90vw);
  object-fit: contain;
}

/* На странице логина лого внутри карточки центрируется и стоит над h1. */
.login-card .topbar-logo {
  height: 120px;
  margin: 0 auto 16px;
}

/* Текстовый бренд на странице входа вместо лого. */
.login-brand {
  margin: 0 0 32px;
  text-align: center;
  font-size: 48px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text);
}

/* «Вход» — тот же шрифт-вес, что и бренд (regular). По умолчанию у h1
   нет явного font-weight, наследуется bold от браузера; здесь снимаем. */
.login-card h1 {
  font-weight: 400;
}

.account {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.tab {
  flex: 0 0 auto;
  color: var(--brand-dark);
  background: rgba(255, 250, 243, 0.74);
  border: 1px solid var(--line);
}

.tab:hover {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.tab.active {
  color: #ffffff;
  background: var(--brand);
}

.tab.active:hover {
  color: #ffffff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.panel {
  width: 100%;
  padding: 28px;
  border: 1px solid rgba(234, 223, 206, 0.8);
  border-radius: 24px;
  background: rgba(255, 250, 243, 0.92);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.today-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.secondary {
  color: var(--brand-dark);
  background: #efe2d0;
}

.secondary:hover {
  background: #e5d3ba;
}

.danger {
  background: var(--danger);
}

.stack {
  display: grid;
  gap: 12px;
}

.phone-input {
  display: flex;
  align-items: center;
}

.phone-input span {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: #efe2d0;
  font-weight: 800;
}

.phone-input input {
  border-radius: 0 12px 12px 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.list {
  display: grid;
  gap: 10px;
}

.wide {
  margin-top: 18px;
}

.item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.item.done {
  opacity: 0.58;
  text-decoration: line-through;
}

.form-grid,
.inline-form {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-form {
  grid-template-columns: 1fr auto;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
}

.checkbox input {
  width: auto;
}

.table {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.row.users-row {
  grid-template-columns: 1fr 1fr 1.4fr auto;
}

.row.important-row {
  grid-template-columns: 1fr;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
  user-select: none;
}

.button-like:hover {
  filter: brightness(1.05);
}

.button-like.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.invoice-status {
  margin: 8px 0 0;
}

.invoice-status.error {
  color: #b91c1c;
}

.invoice-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.invoice-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
}

/* Кнопка свернуть/развернуть карточку накладной. Скрывает только список
   позиций — шапка, оплата, заметки, фото, кнопка удаления остаются видны. */
.invoice-card-fold-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.invoice-card-fold-btn:hover { background: #f3f4f6; }
.invoice-card.folded .invoice-items { display: none; }

.invoice-card-supplier {
  font-weight: 700;
  font-size: 16px;
}

.invoice-card-meta {
  color: var(--muted);
  font-size: 13px;
}

.invoice-card-total {
  font-size: 17px;
  font-weight: 800;
  color: #000000;
}

.invoice-card-total-label {
  font-weight: 800;
  color: #000000;
}

.invoice-card-total-value {
  font-weight: 800;
  color: #000000;
  font-variant-numeric: tabular-nums;
}

.invoice-card-amount {
  font-weight: 700;
}

.invoice-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.invoice-card-footer .invoice-photo-link {
  margin-right: auto;
}

.invoice-card-payment {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 13px;
}

.invoice-card-payment-label {
  font-size: 12px;
}

.invoice-card-payment-select {
  padding: 4px 6px;
}

.invoice-card-paid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 13px;
  cursor: pointer;
}

.invoice-card-paid input[type="checkbox"] {
  cursor: pointer;
}

.invoice-card-paid input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Срок оплаты — компактное поле даты, рядом с галкой «Оплачено».
   margin-left:auto на .invoice-card-paid толкает галку вправо, поэтому
   срок ставим перед ней — он группируется с «Оплата». */
.invoice-card-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}
.invoice-card-due-label { font-size: 12px; }
.invoice-card-due-input {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}

.invoice-card-remove {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.invoice-items {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.invoice-items li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  font-size: 14px;
  padding: 4px 0;
  border-top: 1px dashed var(--line);
}

.invoice-items li:first-child {
  border-top: none;
}

.invoice-photo-link {
  font-size: 13px;
  color: var(--brand-dark);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #efe2d0;
  font-size: 13px;
  font-weight: 700;
}

.message {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--brand-dark);
  background: #efe2d0;
}

.message.error {
  color: var(--danger);
  background: #fff0eb;
}

.message.success {
  color: var(--ok);
  background: #ecfdf3;
}

.schedule-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.schedule-legend {
  margin-top: 12px;
  font-size: 13px;
}

.schedule-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.schedule-grid {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  width: max-content;
}

.schedule-grid col.day-col {
  width: 72px;
}

.schedule-grid th,
.schedule-grid td {
  border: 1px solid var(--line);
  padding: 4px 6px;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}

.schedule-grid thead th.weekday,
.schedule-grid thead th.day-num,
.schedule-grid tbody td.schedule-cell,
.schedule-grid tfoot td.day-summary {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  overflow: hidden;
}

.schedule-grid thead th {
  background: #fffaf3;
  font-weight: 700;
}

.schedule-grid .month-cell {
  font-size: 16px;
  font-weight: 800;
  text-transform: capitalize;
  background: #efe2d0;
  color: var(--brand-dark);
  padding: 0;
}

.month-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 8px;
}

.month-banner-label {
  flex: 1 1 auto;
  text-align: center;
}

.week-nav {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.week-nav:hover {
  background: var(--brand-dark);
}

.schedule-grid col.user-col-group {
  width: 220px;
}

.schedule-grid .user-col {
  position: sticky;
  left: 0;
  background: #fffaf3;
  text-align: right;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  z-index: 2;
}

.schedule-grid tbody .user-col {
  background: var(--row-bg, #ffffff);
  font-weight: 700;
  padding: 4px 6px 4px 6px;
  text-align: right;
  border-top: none;
  border-bottom: none;
  border-left: none;
}

.schedule-grid .user-name {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  text-align: right;
}

.schedule-grid .user-color-dot {
  display: none;
}

.schedule-grid .user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  text-align: right;
  width: 100%;
  min-width: 0;
}

.schedule-grid .user-display-name {
  font-weight: 700;
  white-space: normal;
  word-break: break-word;
  text-align: right;
  font-size: 13px;
  line-height: 1.15;
}

.schedule-grid .day-num.outside-month {
  opacity: 0.55;
  font-weight: 600;
}

.schedule-grid .day-num.weekend {
  color: var(--danger);
}

.schedule-cell {
  height: 56px;
  padding: 2px;
  position: relative;
}

.schedule-cell.weekend {
  background: rgba(180, 35, 24, 0.04);
}

.cell-empty {
  display: flex;
  gap: 2px;
  justify-content: center;
}

.cell-set {
  width: 20px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  background: #efe2d0;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 12px;
  filter: saturate(1) brightness(1);
}

.cell-set:hover {
  filter: brightness(0.9);
}

.legend-chip {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 6px;
  color: #ffffff;
  font-weight: 800;
  text-align: center;
}

.cell-filled {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  border-radius: 6px;
  padding: 2px;
}

.cell-value {
  font-weight: 800;
  font-size: 14px;
  min-width: 28px;
  text-align: right;
}

.cell-arrows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cell-arrows button {
  width: 18px;
  height: 14px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  background: transparent;
  color: var(--brand-dark);
  font-weight: 700;
}

.cell-arrows button:hover {
  background: var(--brand);
  color: #ffffff;
}

.cell-clear {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  background: var(--danger);
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.schedule-cell:hover .cell-clear {
  opacity: 1;
}

.day-summary {
  text-align: left;
  vertical-align: top;
  padding: 4px;
  font-size: 10px;
  background: #fffaf3;
  min-height: 60px;
}

.day-summary-item {
  margin-bottom: 2px;
  padding: 2px 4px;
  border-left: 3px solid var(--brand);
  border-radius: 3px;
  background: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shift-legend-cell {
  padding: 6px 10px !important;
  vertical-align: middle;
  background: #fffaf3 !important;
}

.shift-legend-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  padding: 2px 0;
}

.shift-line-saving {
  opacity: 0.55;
  pointer-events: none;
}

.shift-time-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  padding: 0 2px;
}

.shift-time-arrow {
  background: transparent;
  border: 0;
  padding: 0 4px;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  font-weight: 700;
  opacity: 0.7;
}

.shift-time-arrow:hover {
  opacity: 1;
}

.shift-time-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 38px;
  text-align: center;
}

.shift-time-dash {
  font-weight: 700;
  opacity: 0.6;
}

.shift-time-hours {
  margin-left: 4px;
  opacity: 0.85;
}

.shift-legend-line-sunday {
  border-top: 1px dashed rgba(0, 0, 0, 0.18);
  margin-top: 4px;
  padding-top: 4px;
  opacity: 0.95;
}

/* Воскресная пустая ячейка: одна большая кнопка во всю ширину */
.cell-empty.cell-empty-sunday {
  display: flex;
  justify-content: center;
}

.cell-set.cell-set-sunday {
  width: auto;
  min-width: 56px;
  padding: 0 6px;
  font-size: 11px;
  letter-spacing: 0;
  background: rgba(134, 239, 172, 0.5) !important;
  color: #14532d !important;
}

.color-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  font-weight: 700;
}

.color-label input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.user-color-pill {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}

.requests-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.requests-controls input[type="search"] {
  width: 240px;
}

.requests-summary {
  margin: 16px 0 8px;
  padding: 14px 16px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.requests-summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.requests-summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.requests-summary-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.requests-summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.requests-summary-card h3 {
  margin: 0;
  font-size: 14px;
  color: var(--brand-dark);
}

.requests-summary-copy {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.requests-summary-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.requests-summary-card li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #faf3e8;
}

/* Когда в карточке появилось поле «количество», ставим имя+поле в строку
   с автоматическим выравниванием поля по правому краю. */
.requests-summary-card li.summary-item {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.summary-item-name {
  font-weight: 700;
  flex: 1;
}

.summary-item-qty {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.summary-item-qty:disabled {
  background: #f3f3f3;
  cursor: not-allowed;
}

.summary-item-meta {
  font-size: 12px;
  color: var(--muted);
}

.requests-add {
  margin-top: 8px;
  margin-bottom: 16px;
  grid-template-columns: 160px 1.5fr 1fr 1.5fr auto;
  gap: 10px;
}

.requests-add select {
  background: #ffffff;
}

.requests-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.requests-tab {
  background: #ffffff;
  color: var(--brand-dark);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.requests-tab:hover {
  background: #efe2d0;
  color: var(--brand-dark);
  border-color: var(--brand);
}

.requests-tab.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.requests-tab.active:hover {
  background: var(--brand-dark);
  color: #ffffff;
  border-color: var(--brand-dark);
}

.requests-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.requests-table thead th {
  background: #faf0df;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-dark);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.requests-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.requests-table tbody tr:last-child td {
  border-bottom: 0;
}

.requests-row.needed {
  background: #fff6e6;
}

.requests-row.needed td:first-child {
  box-shadow: inset 4px 0 0 var(--brand);
}

.requests-check {
  width: 48px;
  text-align: center;
}

.requests-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.requests-editable input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 600;
}

.requests-editable input:focus {
  border-color: var(--brand);
  background: #ffffff;
  outline: none;
}

.requests-editable.muted {
  color: var(--muted);
  font-style: italic;
}

.requests-actions {
  width: 84px;
  text-align: right;
}

.requests-actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.craft-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.craft-add {
  margin-bottom: 16px;
  grid-template-columns: 1.5fr 2fr auto;
  gap: 10px;
}

.craft-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.craft-grid {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 100%;
}

.craft-grid col.craft-brand-col {
  width: 220px;
}

.craft-grid col.craft-day-col {
  width: 64px;
}

.craft-grid th,
.craft-grid td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
  font-size: 13px;
}

.craft-grid thead th.craft-weekday,
.craft-grid thead th.craft-day-num,
.craft-grid tbody td.craft-cell {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  overflow: hidden;
}

.craft-grid thead th {
  background: #faf0df;
  color: var(--brand-dark);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.craft-grid thead th.weekend {
  color: var(--danger);
}

.craft-grid thead th.craft-day-num.today {
  background: var(--brand);
  color: #ffffff;
}

.craft-brand-cell {
  text-align: left !important;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  position: sticky;
  left: 0;
  background: #fffaf3;
  z-index: 2;
}

.craft-grid thead th.craft-brand-cell {
  z-index: 3;
}

.craft-brand-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.craft-brand-name-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 700;
  color: var(--text);
}

.craft-brand-name-input:focus {
  background: #ffffff;
  border-color: var(--brand);
  outline: none;
}

.craft-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.craft-brand-description {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.craft-brand-description-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.craft-brand-description-input:focus {
  background: #ffffff;
  border-color: var(--brand);
  color: var(--text);
  outline: none;
}

.craft-cell.weekend {
  background: #faf0df;
}

.craft-cell.today {
  background: rgba(139, 94, 52, 0.16);
}

.craft-cell-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 44px;
}

.craft-cell-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: center;
  font-size: 12px;
}

.craft-cell-input:focus {
  background: #ffffff;
  border-color: var(--brand);
  outline: none;
}

/* Панель «Загрузить фото» в шапке Ремеселки */
.craft-photo-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
}

.craft-photo-bar-today {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--brand-dark);
  cursor: pointer;
  user-select: none;
}

.craft-photo-bar-today input[type="checkbox"] {
  margin: 0;
  accent-color: var(--brand);
}

.craft-photo-date {
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  font-family: inherit;
}

.craft-photo-date:disabled {
  background: #f5ecdf;
  color: var(--muted);
  cursor: not-allowed;
}

.craft-photo-bar .button-like.is-loading {
  opacity: 0.6;
  cursor: wait;
}

/* Строки с фото */
.craft-photo-row .craft-photo-row-label {
  background: #fffaf3;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.craft-photo-cell {
  padding: 4px !important;
  vertical-align: top;
  background: #ffffff;
}

.craft-photo-thumb-wrap {
  position: relative;
  display: inline-block;
}

.craft-photo-thumb {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fffaf3;
}

.craft-photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  background: #dc2626;
  color: #ffffff;
  border: 0;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.craft-photo-thumb-wrap:hover .craft-photo-remove {
  display: block;
}

/* Столбец «Сумма × коэф.» */
.craft-grid col.craft-total-col {
  width: 110px;
}

.craft-grid thead th.craft-total-head {
  background: #efe2d0;
  color: var(--brand-dark);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.04em;
}

.craft-grid thead th.craft-total-subhead {
  background: #fffaf3;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  text-transform: lowercase;
}

.craft-total-cell {
  background: #fffaf3;
  vertical-align: middle;
  text-align: center;
  padding: 4px 6px !important;
}

.craft-total-cell-empty {
  background: #ffffff;
}

.craft-total-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.craft-total-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
  font-size: 13px;
}

.craft-coef-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.craft-coef-times {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
}

.craft-coef-input {
  width: 44px;
  padding: 1px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  text-align: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}

.craft-coef-input:focus,
.craft-coef-input:hover {
  border-color: rgba(0, 0, 0, 0.18);
  background: #ffffff;
  outline: none;
}

.craft-coef-static {
  font-size: 11px;
  color: var(--muted);
}

/* Подвал — общий итог */
.craft-grid tfoot .craft-grand-row th,
.craft-grid tfoot .craft-grand-row td {
  background: #efe2d0;
  color: var(--brand-dark);
  font-weight: 800;
  padding: 8px 10px;
}

.craft-grid tfoot .craft-grand-label {
  text-align: right;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.craft-grid tfoot .craft-grand-filler {
  background: #fffaf3;
  border: 1px solid var(--line);
}

.craft-grid tfoot .craft-grand-total {
  text-align: center;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* Админские столбцы: Номер телефона, Банк */
.craft-grid col.craft-phone-col {
  width: 340px;
}

.craft-grid col.craft-bank-col {
  width: 110px;
}

.craft-grid thead th.craft-phone-head,
.craft-grid thead th.craft-bank-head {
  background: #efe2d0;
  color: var(--brand-dark);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.04em;
}

.craft-grid thead th.craft-phone-subhead,
.craft-grid thead th.craft-bank-subhead {
  background: #fffaf3;
}

.craft-grid tbody td.craft-phone-cell,
.craft-grid tbody td.craft-bank-cell {
  background: #fffaf3;
  vertical-align: middle;
  padding: 4px 6px !important;
}

.craft-admin-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-family: inherit;
}

.craft-admin-input:focus,
.craft-admin-input:hover {
  border-color: rgba(0, 0, 0, 0.18);
  background: #ffffff;
  outline: none;
}

.craft-grid tbody td.craft-admin-cell-empty {
  background: #ffffff;
}

.craft-legend {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .three,
  .five,
  .form-grid,
  .inline-form,
  .row,
  .row.users-row {
    grid-template-columns: 1fr;
  }

  .requests-add {
    grid-template-columns: 1fr;
  }

  .requests-controls input[type="search"] {
    width: 100%;
  }

  .craft-add {
    grid-template-columns: 1fr;
  }
}

/* ===== График пожеланий ===== */

.wishes-heading {
  margin-top: 32px;
}

.wishes-legend {
  font-size: 13px;
  margin-top: 8px;
}

.wishes-grid .wish-cell {
  cursor: default;
  position: relative;
}

.wishes-grid .wish-cell-editable {
  cursor: pointer;
}

.wishes-grid .wish-cell-editable:hover {
  outline: 2px solid rgba(0, 0, 0, 0.15);
  outline-offset: -2px;
}

.wish-cell-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  min-height: 28px;
}

.wish-placeholder {
  color: rgba(0, 0, 0, 0.25);
  font-size: 14px;
}

.wish-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: #6b7280;
}

.wish-badge-all {
  width: 28px;
  height: 28px;
  font-size: 16px;
  background: #374151;
}

.wishes-grid .wish-all {
  background: rgba(55, 65, 81, 0.18) !important;
}

.wishes-grid .wish-partial {
  background: rgba(107, 114, 128, 0.12) !important;
}

.schedule-grid col.extra-col {
  width: 260px;
}

.schedule-grid thead th.extra-col-head {
  text-align: left;
  font-weight: 700;
}

.schedule-grid tbody td.extra-cell {
  padding: 4px 8px;
  vertical-align: middle;
}

.wish-note-cell .wish-note-input {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
}

.wish-note-cell .wish-note-input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}

.wish-note-cell .wish-note-input:disabled {
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.draft-target-cell .draft-target-input {
  display: block;
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
}

.draft-target-cell .draft-target-input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}

/* ===== Блокировки в обычном графике ===== */

.cell-set.cell-set-blocked {
  opacity: 0.35;
  filter: grayscale(0.6);
  position: relative;
}

.cell-set.cell-set-blocked::after {
  content: "⊘";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #ffffff;
  pointer-events: none;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.schedule-cell.cell-fully-blocked {
  background: repeating-linear-gradient(
    45deg,
    rgba(0, 0, 0, 0.04),
    rgba(0, 0, 0, 0.04) 6px,
    rgba(0, 0, 0, 0.08) 6px,
    rgba(0, 0, 0, 0.08) 12px
  ) !important;
}

.schedule-cell.schedule-cell-conflict {
  outline: 2px solid #dc2626;
  outline-offset: -2px;
}

/* ===== Попап выбора пожелания ===== */

.wish-popup {
  position: absolute;
  z-index: 1000;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wish-popup-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-dark);
  margin-bottom: 4px;
}

.wish-popup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 2px;
}

.wish-popup-row input[type="checkbox"] {
  margin: 0;
}

.wish-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.wish-popup-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

/* ===== Черновик графика ===== */

.draft-section {
  margin-top: 32px;
}

.draft-heading h2 {
  margin: 0;
}

.draft-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.draft-legend {
  font-size: 13px;
  margin-top: 8px;
}

.draft-target-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.draft-target-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.draft-target-input {
  width: 60px;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.draft-target-input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}

.draft-cell-buttons {
  display: flex;
  gap: 2px;
  justify-content: center;
}

.draft-cell-set {
  opacity: 0.55;
  transform: scale(0.95);
}

.draft-cell-set:hover {
  opacity: 0.85;
}

.draft-cell-set.draft-cell-set-active {
  opacity: 1;
  transform: scale(1);
  outline: 2px solid #ffffff;
  outline-offset: -2px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}

/* ===== Справочник ===== */

#requests-directory-toggle.active {
  background: var(--brand);
  color: #ffffff;
}

.directory-add {
  display: grid;
  grid-template-columns: 1fr 2fr 1.4fr 110px auto;
  gap: 8px;
  margin: 16px 0 12px;
}

.directory-supplier-cell {
  width: 240px;
}

.directory-supplier-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
}

.directory-supplier-select:hover,
.directory-supplier-select:focus {
  border-color: rgba(0, 0, 0, 0.12);
  background: #fffaf3;
  outline: none;
}

/* ===== Поставщики ===== */

#requests-suppliers-toggle.active {
  background: var(--brand);
  color: #ffffff;
}

.suppliers-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 16px 0 12px;
}

.suppliers-list {
  margin-top: 8px;
}

.suppliers-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.suppliers-table thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.suppliers-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 14px;
}

.suppliers-table tbody tr:last-child td {
  border-bottom: none;
}

.suppliers-table tbody tr.supplier-row-blocked {
  background: rgba(220, 38, 38, 0.12);
  transition: background 1s ease;
}

.supplier-name-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
}

.supplier-name-input:hover,
.supplier-name-input:focus {
  border-color: rgba(0, 0, 0, 0.12);
  background: #fffaf3;
  outline: none;
}

.supplier-usage {
  width: 90px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.supplier-copy-cell,
.supplier-actions {
  width: 1px;
  white-space: nowrap;
  text-align: right;
}

.suppliers-legend {
  margin-top: 12px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .suppliers-add {
    grid-template-columns: 1fr;
  }
}

.directory-category-cell {
  width: 120px;
  white-space: nowrap;
}

.directory-category-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
}

.directory-category-select:hover,
.directory-category-select:focus {
  border-color: rgba(0, 0, 0, 0.12);
  background: #fffaf3;
  outline: none;
}

.directory-list {
  margin-top: 8px;
}

.directory-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.directory-table thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.directory-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 14px;
}

.directory-table tbody tr:last-child td {
  border-bottom: none;
}

.directory-table .directory-actions {
  text-align: right;
  width: 1px;
  white-space: nowrap;
}

.directory-cell-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
}

.directory-cell-input:hover,
.directory-cell-input:focus {
  border-color: rgba(0, 0, 0, 0.12);
  background: #fffaf3;
  outline: none;
}

.directory-legend {
  margin-top: 12px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .directory-add {
    grid-template-columns: 1fr;
  }
}

/* ===== Закрытие смены — модал с поэтапными вопросами ===== */

.shift-closure-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.shift-closure-modal {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shift-closure-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}

.shift-closure-label {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.3;
}

.shift-closure-input {
  font-size: 22px;
  font-weight: 700;
  text-align: right;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  background: #fffaf3;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

.shift-closure-input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
  background: #ffffff;
}

.shift-closure-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.shift-closure-actions button {
  padding: 9px 18px;
  font-size: 14px;
  border-radius: 10px;
}

/* Итоговое окно */
.shift-closure-summary {
  max-width: 480px;
}

.shift-closure-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.shift-closure-summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fffaf3;
  border-radius: 8px;
  font-size: 14px;
}

.shift-closure-summary-label {
  color: var(--muted);
}

.shift-closure-summary-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
}

.shift-closure-summary-totals {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.shift-closure-summary-totals li {
  background: #efe2d0;
}

.shift-closure-summary-actions {
  margin-top: 8px;
}

/* Шаг «Кто во сколько ушёл» */
.shift-departures-modal {
  max-width: 480px;
}

.shift-closure-subtitle {
  margin-top: 6px;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shift-departures-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.shift-departures-empty {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  background: #fffaf3;
  border-radius: 10px;
}

.shift-departure-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #fffaf3;
  border-radius: 10px;
  border: 1px solid var(--line);
  transition: opacity 0.2s;
}

.shift-departure-row.shift-departure-saving {
  opacity: 0.6;
  pointer-events: none;
}

.shift-departure-name {
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 14px;
}

.shift-departure-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.shift-departure-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 2px 4px;
}

.shift-departure-arrow {
  background: transparent;
  color: var(--brand-dark);
  border: 0;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
}

.shift-departure-arrow:hover {
  background: #efe2d0;
}

.shift-departure-hours {
  min-width: 56px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
  font-size: 14px;
}

.shift-closure-departures-summary li {
  background: #fffaf3;
}

/* Шаг «Проданная ремеселка» */
.craft-sales-modal {
  max-width: 560px;
}

.craft-sale-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr auto;
  gap: 8px;
  align-items: stretch;
}

.craft-sale-brand,
.craft-sale-payment,
.craft-sale-amount {
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  background: #fffaf3;
  color: var(--brand-dark);
  font-family: inherit;
}

.craft-sale-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.craft-sale-brand:focus,
.craft-sale-amount:focus,
.craft-sale-payment:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
  background: #ffffff;
}

.craft-sale-add {
  padding: 0 16px;
  font-size: 14px;
  border-radius: 10px;
}

.craft-sale-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.craft-sale-list-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.craft-sale-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.craft-sale-empty {
  padding: 12px 14px;
  background: #fffaf3;
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.craft-sale-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}

.craft-sale-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.craft-sale-row-brand {
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.craft-sale-row-payment {
  font-size: 12px;
  color: var(--muted);
}

.craft-sale-row-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
  font-size: 15px;
}

.craft-sale-row-remove {
  background: transparent;
  color: var(--muted);
  border: 0;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.craft-sale-row-remove:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.craft-sale-row-existing {
  background: #efe2d0;
  border-style: dashed;
}

.craft-sale-row-existing .craft-sale-row-payment {
  font-style: italic;
  color: var(--brand-dark);
}

.craft-sale-row-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .craft-sale-form {
    grid-template-columns: 1fr;
  }
}

/* ===== Список всех позиций накладных ===== */

.invoice-items-toolbar {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

.invoice-items-panel {
  margin-top: 10px;
  padding: 12px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.invoice-items-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 12px;
  font-family: inherit;
}

.invoice-items-search:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}

.invoice-items-groups {
  display: grid;
  gap: 12px;
}

.invoice-items-group {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
}

.invoice-items-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}

.invoice-items-group-head h3 {
  margin: 0;
  font-size: 15px;
  color: var(--brand-dark);
}

.invoice-items-group-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.invoice-items-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.invoice-items-group-list li {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 12px;
  font-size: 13px;
  padding: 4px 2px;
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
}

.invoice-items-group-list li:first-child {
  border-top: none;
}

/* Каноническая группа похожих позиций — заголовок (с раскрывашкой и сводкой
   цены) + скрытое тело со списком сырых строк. */
.invoice-items-canon { display: block; padding: 0; border-top: 1px dashed rgba(0, 0, 0, 0.06); }
.invoice-items-canon:first-child { border-top: none; }
.invoice-items-canon-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 4px 2px;
}
.invoice-items-canon-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.invoice-items-canon-toggle:hover { background: #f3f4f6; }
.invoice-items-canon-count { font-weight: 700; }
.invoice-items-canon-summary {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--brand-dark);
}
.invoice-items-canon-body {
  list-style: none;
  margin: 4px 0 6px 28px;
  padding: 0;
  display: grid;
  gap: 4px;
}
.invoice-items-canon-body li {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 12px;
  font-size: 12.5px;
  padding: 3px 2px;
  border-top: 1px dotted rgba(0, 0, 0, 0.06);
}
.invoice-items-canon-body li:first-child { border-top: none; }

.invoice-items-name {
  color: var(--brand-dark);
}

.invoice-items-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
  text-align: right;
  min-width: 80px;
}

.invoice-items-qty {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.invoice-items-date {
  white-space: nowrap;
  font-size: 12px;
}

@media (max-width: 720px) {
  .invoice-items-group-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Кнопка «Добавить в заявки» в строках */
.invoice-items-group-list li {
  grid-template-columns: 1fr auto auto auto auto auto;
}

.invoice-items-unit-price {
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 90px;
  white-space: nowrap;
  color: var(--brand-dark);
  font-weight: 600;
}

.invoice-items-unit-price-ai {
  color: #7c3aed;
  border-bottom: 1px dotted rgba(124, 58, 237, 0.6);
}

/* === Накладные: переключатель «Список / Месяц» + месячная сетка ========== */

.invoices-view-mode {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
  margin: 12px 0 8px;
}

.invoices-view-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-dark);
  cursor: pointer;
  border-right: 1px solid var(--line);
}

.invoices-view-btn:last-child { border-right: none; }
.invoices-view-btn:hover { background: rgba(217, 119, 6, 0.08); }
.invoices-view-btn.active { background: var(--brand); color: #ffffff; }

.invoices-month-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.invoices-month-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-dark);
  text-transform: capitalize;
  min-width: 130px;
  text-align: center;
}

.invoices-month-scroll {
  overflow: auto;
  max-width: 100%;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.invoices-month-grid {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.invoices-month-grid th,
.invoices-month-grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 4px 6px;
  text-align: center;
  background: #ffffff;
}

.invoices-month-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffaf3;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.invoices-month-corner,
.invoices-month-name {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fffaf3;
  text-align: left;
  min-width: 160px;
  max-width: 220px;
  font-weight: 700;
}

.invoices-month-name { background: #ffffff; z-index: 1; }
.invoices-month-corner { z-index: 4; }

.invoices-month-day { min-width: 56px; }

.invoices-month-weekday {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  background: #fffaf3;
}

.invoices-month-weekend { background: #fdf6e8 !important; }

.invoices-month-cell {
  padding: 4px 6px;
  text-align: right;
}

.invoices-month-money {
  font-weight: 600;
  color: var(--brand-dark);
  cursor: pointer;
}

.invoices-month-money:hover {
  background: #fff4dd !important;
}

.invoices-month-rowtotal {
  background: #fffaf3;
  font-weight: 700;
  min-width: 96px;
  text-align: right;
}

.invoices-month-grand {
  background: #ffe7c2 !important;
  color: var(--brand-dark);
  font-weight: 800;
}

.invoices-month-total-head {
  background: #ffe7c2 !important;
  color: var(--brand-dark);
}

.invoices-month-footer .invoices-month-name,
.invoices-month-footer td {
  background: #ffe7c2;
  font-weight: 800;
  color: #000000;
}

.invoices-month-footer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #000000;
}

.invoices-cell-modal { max-width: 480px; }

.invoices-cell-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.invoices-cell-list li {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.invoices-cell-photo {
  text-decoration: none;
}

.invoice-items-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.invoice-items-controls .invoice-items-search {
  flex: 1 1 220px;
  margin: 0;
}

.invoice-items-normalize-status {
  font-size: 12px;
}

.invoice-items-add-btn {
  background: transparent;
  color: var(--brand-dark);
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.invoice-items-add-btn:hover {
  border-color: var(--brand);
  background: #fffaf3;
  color: var(--brand);
}

@media (max-width: 720px) {
  .invoice-items-group-list li {
    grid-template-columns: 1fr;
  }
  .invoice-items-add-btn {
    justify-self: end;
  }
}

/* ===== Модал «Добавить в заявки» ===== */

.invoice-add-modal {
  max-width: 520px;
}

.invoice-add-hint {
  font-size: 12px;
  margin: 0 0 8px;
}

.invoice-replace-picker .invoice-replace-search {
  width: 100%;
  margin-bottom: 8px;
}

.invoice-replace-list {
  max-height: 320px;
  overflow-y: auto;
}

.invoice-replace-empty,
.invoice-replace-more {
  padding: 8px 4px;
  font-size: 13px;
}

.invoice-replace-old {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-add-matches {
  list-style: none;
  margin: 6px 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.invoice-add-match-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.invoice-add-match-row-existing {
  background: #ececec;
  border-color: rgba(0, 0, 0, 0.12);
  filter: grayscale(0.4);
}

.invoice-add-match-row-existing .invoice-add-match-name,
.invoice-add-match-row-existing .invoice-add-match-full,
.invoice-add-match-row-existing .invoice-add-match-supplier {
  color: rgba(0, 0, 0, 0.45) !important;
}

.invoice-add-match-row-existing button {
  background: #cfcfcf;
  color: rgba(0, 0, 0, 0.55);
  cursor: not-allowed;
}

.invoice-add-match-existing-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #9ca3af;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.invoice-add-match-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.invoice-add-match-name {
  font-weight: 700;
  color: var(--brand-dark);
}

.invoice-add-match-full {
  font-size: 12px;
}

.invoice-add-match-supplier {
  font-size: 12px;
}

.invoice-add-match-row button {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.invoice-add-form {
  display: grid;
  gap: 8px;
  margin: 6px 0 12px;
}

.invoice-add-field {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: center;
}

.invoice-add-field-label {
  font-size: 13px;
  color: var(--brand-dark);
  font-weight: 600;
}

.invoice-add-input {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: #fffaf3;
  font-family: inherit;
}

.invoice-add-input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
  background: #ffffff;
}

@media (max-width: 540px) {
  .invoice-add-field {
    grid-template-columns: 1fr;
  }
}

/* ===== Важное: реакции и баннеры ===== */

.important-item {
  transition: opacity 0.2s, background 0.2s, filter 0.2s;
}

.important-item-reacted {
  opacity: 0.55;
  filter: grayscale(0.7);
  background: #ececec;
}

.important-item-reacted h3,
.important-item-reacted p {
  color: rgba(0, 0, 0, 0.55);
}

.important-separator {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.important-reactions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.important-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(217, 119, 6, 0.08);
  color: var(--brand-dark);
  border: 1px solid rgba(217, 119, 6, 0.18);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.important-reaction:hover {
  background: rgba(217, 119, 6, 0.16);
  border-color: rgba(217, 119, 6, 0.34);
}

.important-reaction.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.important-reaction-emoji {
  font-size: 16px;
  filter: grayscale(0.25) opacity(0.85);
}

.important-reaction.active .important-reaction-emoji {
  filter: none;
}

.important-reaction-count {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  opacity: 0.85;
}

/* Сводка реакций (только цифры) на вкладке «Важное» */
.important-reactions-summary {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.important-reactions-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  font-size: 13px;
  color: var(--brand-dark);
}

.important-reactions-summary-item.empty {
  opacity: 0.5;
}

.important-reactions-summary-item.mine {
  background: rgba(217, 119, 6, 0.18);
  color: var(--brand-dark);
  font-weight: 700;
}

.important-reactions-summary-item .important-reaction-emoji {
  font-size: 14px;
  filter: grayscale(0.25) opacity(0.85);
}

.important-reactions-hint {
  font-size: 12px;
}

/* Виджет «Важные обновления» на «Сегодня»: серый стиль для сообщений с моей реакцией */
.today-important-item-reacted {
  opacity: 0.6;
  filter: grayscale(0.6);
  background: #ececec;
}

.today-important-item-reacted h3,
.today-important-item-reacted p {
  color: rgba(0, 0, 0, 0.55);
}

/* Баннеры просроченных непрочитанных */

.expired-banners {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
}

/* === Полноэкранный «баннер» при входе для активных Важных сообщений ===== */

.important-banner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.important-banner-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 28px;
  width: min(560px, 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 6px solid var(--brand);
}

.important-banner-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  font-weight: 800;
}

.important-banner-title {
  margin: 0;
  font-size: 22px;
  color: var(--brand-dark);
}

.important-banner-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.important-banner-date {
  margin: 0;
  font-size: 12px;
}

.important-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.important-banner-react {
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--brand-dark);
}

.important-banner-react:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.important-banner-react:disabled {
  opacity: 0.6;
  cursor: progress;
}

.important-banner-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

/* Подпись «🔔 Баннер» рядом с заголовком в списке Важных. */
.important-banner-flag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fff4dd;
  color: var(--brand-dark);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
  border: 1px solid var(--line);
}

/* Чекбокс в форме «Важное». */
.important-banner-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}
/* Глобальное правило для input даёт width:100% и большой padding, из-за чего
   чекбокс растягивается и текст уезжает. Здесь возвращаем нативные размеры. */
.important-banner-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
}

.expired-banner {
  background: #fde7c2;
  border: 1px solid #d97706;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.18);
  display: grid;
  gap: 8px;
  transition: opacity 0.2s, transform 0.2s;
}

.expired-banner-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.expired-banner-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.expired-banner-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand-dark);
}

.expired-banner-date {
  font-size: 12px;
  color: var(--muted);
}

.expired-banner-title {
  margin: 0;
  font-size: 17px;
  color: var(--brand-dark);
}

.expired-banner-body {
  margin: 0;
  color: #2c1f10;
}

.expired-banner-dismiss {
  justify-self: end;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 10px;
}

/* ===== Дела на сегодня — виджет ===== */

.task-form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.task-form input[name="title"] {
  flex: 1 1 140px;
  min-width: 0;
}

.task-due-input {
  width: 90px;
  text-align: center;
}

/* Чекбокс «Регулярно» в форме «Дела на сегодня». */
.task-recurring-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

.task-recurring-days {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fffaf3;
  margin: 0;
}

.task-recurring-days legend {
  /* legend оставляем для доступности, визуально не нужен */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.task-recurring-days label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

/* Класс на случай, если кому-то понадобится скрыть текст для скринридеров */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Метка «🔁 Регулярно» в карточке задачи. */
.task-recurring-flag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fff4dd;
  color: var(--brand-dark);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin-left: 6px;
  white-space: nowrap;
}

.task-text {
  flex: 1 1 auto;
}

.task-due {
  margin-left: auto;
  font-size: 12px;
  color: var(--brand-dark);
  font-weight: 700;
  white-space: nowrap;
}

.item.task-carried {
  background: rgba(220, 38, 38, 0.10);
  border-left: 3px solid #dc2626;
}

/* ===== Шаг визарда «Невыполненные дела» ===== */

.unfinished-tasks-modal {
  max-width: 520px;
}

.unfinished-tasks-list {
  display: grid;
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.unfinished-tasks-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  background: #fffaf3;
  border-radius: 10px;
}

.unfinished-task-banner {
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  display: grid;
  gap: 8px;
  transition: background 0.2s, border-color 0.2s;
}

.unfinished-task-banner.done {
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.4);
}

.unfinished-task-banner.carried {
  background: rgba(220, 38, 38, 0.10);
  border-color: rgba(220, 38, 38, 0.4);
}

.unfinished-task-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.unfinished-task-title {
  font-weight: 700;
  color: var(--brand-dark);
}

.unfinished-task-due {
  font-weight: 700;
  font-size: 12px;
  color: var(--brand-dark);
}

.unfinished-task-carried {
  font-size: 12px;
  color: #dc2626;
  font-weight: 600;
}

.unfinished-task-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.unfinished-task-done,
.unfinished-task-undone {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.unfinished-task-done {
  background: #16a34a;
  color: #ffffff;
}

.unfinished-task-done.active {
  outline: 2px solid #14532d;
  outline-offset: 2px;
}

.unfinished-task-undone {
  background: #dc2626;
  color: #ffffff;
}

.unfinished-task-undone.active {
  outline: 2px solid #7f1d1d;
  outline-offset: 2px;
}

/* ===== Шаг «Наличка в кассе» ===== */

.cash-register-modal {
  max-width: 460px;
}

.cash-register-hint {
  background: #f3efe7;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed rgba(0, 0, 0, 0.08);
}

.cash-register-hint-formula {
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.cash-register-hint-result {
  margin-top: 2px;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 14px;
}

.cash-register-hint-result strong {
  color: #000000;
  font-weight: 800;
}

.cash-register-fill {
  align-self: flex-start;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
}

/* Кнопки загрузки на «Сегодня» */
.today-actions .button-like {
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 10px;
  cursor: pointer;
}

.today-actions .button-like.is-loading {
  opacity: 0.6;
  cursor: wait;
}

/* Диалог выбора способа оплаты */
.payment-choice-modal {
  max-width: 380px;
}

.payment-choice-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment-choice-btn {
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  background: #fffaf3;
  color: var(--brand-dark);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.payment-choice-btn:hover {
  background: #efe2d0;
  border-color: var(--brand);
}

.payment-choice-btn.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* ===== Аналитика: подвкладки ===== */

/* Стиль активного — как у основных вкладок (.tab) и чипсов ТТК: заливка
   оранжевым + белый текст. Это единый визуальный язык «активной кнопки»
   в приложении. */
.analytics-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.analytics-subtab {
  flex: 0 0 auto;
  color: var(--brand-dark);
  background: rgba(255, 250, 243, 0.74);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.analytics-subtab:hover {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.analytics-subtab.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.analytics-subtab.active:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.analytics-subpanel {
  min-height: 120px;
}

.analytics-subpanel:empty::before {
  display: block;
  content: "Раздел в разработке.";
  color: var(--muted);
  font-size: 13px;
  padding: 16px 0;
}

/* === Аналитика → Смены =================================================== */

.analytics-shifts-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.analytics-shifts-date {
  font-size: 14px;
  padding: 6px 8px;
}

.analytics-shifts-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.analytics-shifts-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.analytics-shifts-total-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.analytics-shifts-total-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

.analytics-shifts-transfer {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.analytics-shifts-grid {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  font-size: 13px;
}

.analytics-shifts-grid thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.analytics-shifts-grid tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.analytics-shifts-grid tbody tr:last-child td {
  border-bottom: none;
}

.analytics-shifts-hours-input {
  width: 80px;
  padding: 4px 6px;
  font-variant-numeric: tabular-nums;
}

.analytics-shifts-salary {
  font-weight: 700;
  color: var(--brand-dark);
}

.analytics-shifts-legend {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.4;
}

.user-rate-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.user-rate-label select {
  padding: 4px 6px;
  font-variant-numeric: tabular-nums;
}

/* Переключатель режима [День · Месяц] */
.analytics-shifts-mode {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
  margin-bottom: 12px;
}

.analytics-shifts-mode-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-dark);
  cursor: pointer;
  border-right: 1px solid var(--line);
}

.analytics-shifts-mode-btn:last-child {
  border-right: none;
}

.analytics-shifts-mode-btn:hover {
  background: rgba(217, 119, 6, 0.08);
}

.analytics-shifts-mode-btn.active {
  background: var(--brand);
  color: #ffffff;
}

/* Подпись текущего месяца между стрелками */
.analytics-shifts-month-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-dark);
  text-transform: capitalize;
  min-width: 130px;
  text-align: center;
}

/* Месячная сетка: горизонтальный скролл, sticky-колонка имени, sticky-шапка. */
.analytics-shifts-month-scroll {
  overflow: auto;
  max-width: 100%;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.analytics-shifts-month-grid {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.analytics-shifts-month-grid th,
.analytics-shifts-month-grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 4px 6px;
  text-align: center;
  background: #ffffff;
}

.analytics-shifts-month-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffaf3;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.analytics-shifts-month-corner,
.analytics-shifts-month-name,
.analytics-shifts-month-totals-label {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fffaf3;
  text-align: left;
  min-width: 140px;
  max-width: 200px;
  font-weight: 700;
}

.analytics-shifts-month-name {
  background: #ffffff;
  z-index: 1;
}

/* Угловая ячейка должна перекрывать и стики-шапку, и стики-колонку */
.analytics-shifts-month-corner {
  z-index: 4;
}

.analytics-shifts-month-day {
  min-width: 56px;
}

.analytics-shifts-month-weekday {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  background: #fffaf3;
}

.analytics-shifts-month-day-total {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

.analytics-shifts-month-day-total.muted {
  color: rgba(0, 0, 0, 0.25);
}

.analytics-shifts-month-weekend {
  background: #fdf6e8 !important;
}

.analytics-shifts-month-cell {
  padding: 2px 4px;
}

.analytics-shifts-month-empty {
  color: rgba(0, 0, 0, 0.25);
}

/* === Модалка «Списания» в визарде закрытия смены ========================= */

.writeoffs-hint {
  margin: 4px 0 12px;
  font-size: 12px;
}

.writeoffs-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.writeoffs-row {
  display: grid;
  grid-template-columns: 1fr 90px 36px 110px 30px;
  gap: 6px;
  align-items: center;
}

.writeoffs-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
}

.writeoffs-name {
  text-align: left;
}

.writeoffs-qty,
.writeoffs-total {
  text-align: right;
}

.writeoffs-unit {
  font-size: 12px;
  text-align: center;
}

.writeoffs-remove {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
}

.writeoffs-remove:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.writeoffs-add {
  margin-top: 8px;
  align-self: flex-start;
}

.writeoffs-sum {
  margin-top: 8px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .writeoffs-row {
    grid-template-columns: 1fr 70px 30px 90px 28px;
  }
}

/* Ячейка-стоимость: показывает ЗП за день. Рендер read-only (часы правятся
   в дневном виде или во вкладке «График»). */
.analytics-shifts-month-money {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
  color: var(--brand-dark);
  cursor: help;
}

.analytics-shifts-month-rowtotal {
  background: #fffaf3;
  font-weight: 700;
  min-width: 60px;
}

.analytics-shifts-month-rowtotal-money {
  color: var(--brand-dark);
  min-width: 90px;
}

.analytics-shifts-month-grand {
  background: #ffe7c2 !important;
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 12px;
}

.analytics-shifts-month-fot {
  font-size: 10px;
  font-weight: 600;
}

.analytics-shifts-month-total-head {
  background: #ffe7c2 !important;
  color: var(--brand-dark);
}

/* Подвальные строки итогов в месячной таблице. */
.analytics-shifts-month-footer-row .analytics-shifts-month-name,
.analytics-shifts-month-footer-row td {
  background: #fffaf3;
}

.analytics-shifts-month-footer-row:first-of-type th,
.analytics-shifts-month-footer-row:first-of-type td {
  border-top: 2px solid var(--brand);
}

.analytics-shifts-month-footer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

/* «Итого ЗП» — выделяем как итог: жирный чёрный текст. */
.analytics-shifts-month-footer-salary .analytics-shifts-month-name,
.analytics-shifts-month-footer-salary td {
  background: #ffe7c2;
  font-weight: 800;
  color: #000000;
}

.analytics-shifts-month-footer-salary .analytics-shifts-month-footer-label {
  color: #000000;
}

/* Сумма за месяц в правой клетке «Итого ЗП» — тоже чёрная. */
.analytics-shifts-month-footer-salary .analytics-shifts-month-rowtotal-money {
  color: #000000;
}

.analytics-shifts-month-footer-writeoffs .analytics-shifts-month-money {
  color: #b91c1c;
}

/* === Аналитика → Накладные: сводка по поставщикам ======================== */

.analytics-invoices-table {
  margin-top: 8px;
  overflow-x: auto;
}

.analytics-invoices-grid {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  font-size: 13px;
}

.analytics-invoices-grid thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.analytics-invoices-grid tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.analytics-invoices-grid tbody tr:last-child td {
  border-bottom: none;
}

.analytics-invoices-supplier {
  font-weight: 700;
  color: var(--brand-dark);
}

.analytics-invoices-money {
  text-align: right;
  white-space: nowrap;
}

.analytics-invoices-debt {
  color: #b91c1c;
  font-weight: 700;
}

.analytics-invoices-total td {
  background: #ffe7c2;
  font-weight: 800;
  color: #000000;
  border-top: 2px solid var(--brand);
}

.analytics-invoices-action {
  text-align: right;
  white-space: nowrap;
}

.analytics-invoices-pay-btn {
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.analytics-invoices-pay-btn:hover {
  background: #15803d;
}

.analytics-invoices-pay-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* === Аналитика → Себестоимости =========================================== */

.analytics-costs-section {
  margin-bottom: 22px;
}

.analytics-costs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 6px;
}

.analytics-costs-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--brand-dark);
}

.analytics-costs-ack-all {
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.analytics-costs-ack-all:hover {
  background: #15803d;
}

.analytics-costs-ack-all:disabled {
  opacity: 0.6;
  cursor: progress;
}

.analytics-costs-grid {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  font-size: 13px;
}

.analytics-costs-grid thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.analytics-costs-grid tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.analytics-costs-grid tbody tr:last-child td {
  border-bottom: none;
}

.analytics-costs-name {
  font-weight: 700;
  color: var(--brand-dark);
}

.analytics-costs-money {
  text-align: right;
  white-space: nowrap;
}

.analytics-costs-input-cell {
  text-align: right;
}

.analytics-costs-input {
  width: 80px;
  padding: 4px 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analytics-costs-allowed {
  width: 60px;
}

.analytics-costs-pct {
  margin-left: 4px;
  font-size: 12px;
}

/* Превышение лимита: красная подсветка строки + цифра фудкоста красным. */
.analytics-costs-exceeded td {
  background: #fef2f2;
}

.analytics-costs-exceeded .analytics-costs-name,
.analytics-costs-debt {
  color: #b91c1c;
  font-weight: 800;
}

.analytics-costs-cost-partial {
  color: #ca8a04;
  cursor: help;
}

.analytics-costs-action {
  text-align: center;
  width: 36px;
}

.analytics-costs-ack-one {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.55);
}

.analytics-costs-ack-one:hover {
  border-color: #16a34a;
  color: #16a34a;
}

/* === Аналитика → Списания =================================================== */

.analytics-writeoffs-table {
  margin-top: 8px;
  overflow-x: auto;
}

.analytics-writeoffs-grid {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  font-size: 13px;
}

.analytics-writeoffs-grid thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.analytics-writeoffs-grid tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

.analytics-writeoffs-grid tbody tr:last-child td {
  border-bottom: none;
}

.analytics-writeoffs-date {
  white-space: nowrap;
  color: var(--muted);
}

.analytics-writeoffs-name {
  color: var(--brand-dark);
  font-weight: 600;
}

.analytics-writeoffs-qty {
  white-space: nowrap;
  text-align: right;
  min-width: 80px;
}

.analytics-writeoffs-money {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  color: #b91c1c; /* списание = «расход», такой же красный, как в месячной таблице смен */
}

.analytics-writeoffs-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.analytics-writeoffs-person {
  display: inline-block;
  background: #fffaf3;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border-left: 3px solid var(--brand);
}

.analytics-writeoffs-total td {
  background: #ffe7c2;
  font-weight: 800;
  color: #000000;
  border-top: 2px solid var(--brand);
}

.ttk-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.ttk-controls input[type="search"] {
  min-width: 220px;
}

.ttk-section-toggle {
  display: inline-flex;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
}

.ttk-section-toggle:empty {
  display: none;
}

.ttk-section-btn {
  background: transparent;
  color: var(--brand-dark);
  border: none;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border-right: 1px solid var(--line);
}

.ttk-section-btn:last-child {
  border-right: none;
}

.ttk-section-btn:hover {
  background: rgba(217, 119, 6, 0.08);
}

.ttk-section-btn.active {
  background: var(--brand);
  color: #ffffff;
}

.ttk-subcategories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.ttk-chip {
  background: #ffffff;
  color: var(--brand-dark);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.ttk-chip:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.ttk-chip.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.ttk-form-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.ttk-form-card[hidden] {
  display: none;
}

.ttk-form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.5fr 1fr 0.7fr;
}

.ttk-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 13px;
}

.ttk-field-wide {
  flex: 1 1 auto;
}

.ttk-field span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ttk-field input,
.ttk-field select,
.ttk-field textarea {
  font-weight: 500;
  color: var(--text);
}

.ttk-field textarea {
  min-height: 80px;
  resize: vertical;
}

.ttk-form-actions {
  display: flex;
  gap: 10px;
}

.ttk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.ttk-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(69, 45, 25, 0.06);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.ttk-card:hover {
  box-shadow: 0 12px 30px rgba(69, 45, 25, 0.12);
}

.ttk-card.expanded {
  box-shadow: 0 16px 36px rgba(69, 45, 25, 0.18);
}

.ttk-card-bar {
  border-top: 4px solid #0891b2;
}

.ttk-card-kitchen {
  border-top: 4px solid #d97706;
}

.ttk-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  outline: none;
}

.ttk-card-header:focus-visible {
  background: rgba(139, 94, 52, 0.08);
}

.ttk-card-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.ttk-card-header-left h3 {
  margin: 0;
  font-size: 16px;
  color: var(--brand-dark);
}

.ttk-card-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ttk-card-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ttk-card-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ttk-yield-chip {
  background: rgba(139, 94, 52, 0.1);
  color: var(--brand-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ttk-card-arrow {
  color: var(--brand-dark);
  font-size: 16px;
  transition: transform 0.2s ease;
}

.ttk-card.expanded .ttk-card-arrow {
  transform: rotate(180deg);
}

.ttk-card-body {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}

.ttk-card.expanded .ttk-card-body {
  display: flex;
}

.ttk-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ttk-block .eyebrow {
  margin: 0;
  font-size: 11px;
  color: var(--brand-dark);
}

.ttk-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 14px;
}

.ttk-ingredient-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.ttk-ingredient-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fffaf3;
  border-radius: 10px;
  overflow: hidden;
}

.ttk-ingredient-table th,
.ttk-ingredient-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ttk-ingredient-table thead th {
  background: rgba(139, 94, 52, 0.1);
  color: var(--brand-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ttk-ingredient-table tbody tr:last-child td {
  border-bottom: 0;
}

.ttk-ingredient-name {
  font-weight: 700;
  color: var(--brand-dark);
}

.ttk-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ttk-card-actions button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 10px;
}

.ttk-card-meta {
  margin: 0;
  font-size: 12px;
}

@media (max-width: 720px) {
  .ttk-form-row {
    grid-template-columns: 1fr;
  }

  .ttk-grid {
    grid-template-columns: 1fr;
  }
}


/* === ТТК: редактор ингредиентов === */

.ttk-ingredients-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ttk-ingredients-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ttk-ingredients-title {
  font-weight: 600;
}

.ttk-ingredients-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.ttk-ingredients-hint {
  font-size: 12px;
}

.ttk-ingredients-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ttk-ing-row {
  display: grid;
  /* Колонок столько же, сколько размеров (--ttk-qty-cols), И столько же
     колонок «Себес» — одна на размер. Атрибут управляется JS.
     Ячейка «Кол-во» компактная: достаточно для «250 мл»+единицы рядом. */
  grid-template-columns:
    minmax(180px, 1fr)
    repeat(var(--ttk-qty-cols, 1), 110px)
    repeat(var(--ttk-qty-cols, 1), 90px)
    32px;
  gap: 6px;
  align-items: center;
}

.ttk-ing-head {
  font-size: 12px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Сетка перестраивается через переменную --ttk-qty-cols, которую выставляет JS */
.ttk-ingredients-rows[data-cols="1"] { --ttk-qty-cols: 1; }
.ttk-ingredients-rows[data-cols="2"] { --ttk-qty-cols: 2; }
.ttk-ingredients-rows[data-cols="3"] { --ttk-qty-cols: 3; }

.ttk-ing-input {
  width: 100%;
  box-sizing: border-box;
}

/* «Кол-во» в строке = инпут + единица справа в одной grid-ячейке. */
.ttk-ing-qty-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.ttk-ing-qty-input {
  flex: 1 1 auto;
  min-width: 0;
}

.ttk-ing-qty-unit {
  flex: 0 0 auto;
  font-size: 12px;
  white-space: nowrap;
}

.ttk-ing-qty-unit[hidden] {
  display: none;
}

.ttk-ing-cell-price {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

/* Шапка «Себес» — отдельная ячейка на каждый размер: маленькая подпись
   сверху + итог под ней. */
.ttk-ing-cost-head {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.ttk-ing-cost-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(0, 0, 0, 0.55);
  line-height: 1;
}

.ttk-ing-cost-total {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark);
  line-height: 1.2;
}

.ttk-ing-cost-total.muted {
  color: rgba(0, 0, 0, 0.4);
  font-weight: 500;
}

/* Ячейка себестоимости в строке-ингредиенте (на каждый размер). */
.ttk-ing-cell-cost-row {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

.ttk-ing-cell-actions {
  text-align: center;
}

.ttk-ing-row-remove,
.ttk-ing-size-remove {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.55);
}

.ttk-ing-row-remove:hover,
.ttk-ing-size-remove:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.ttk-ing-size-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ttk-ing-size-input {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  font-weight: 600;
}

.ttk-ingredients-add-row {
  align-self: flex-start;
}

@media (max-width: 720px) {
  .ttk-ing-row {
    grid-template-columns: 1fr;
  }
  .ttk-ing-cell-price {
    text-align: left;
  }
}

/* === ТТК → Наименования === */

.ttk-names-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.ttk-names-add {
  margin-bottom: 0;
}

.ttk-names-table {
  width: 100%;
  border-collapse: collapse;
}

.ttk-names-table th,
.ttk-names-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ttk-names-table th {
  font-weight: 600;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.6);
}

.ttk-names-table tbody tr:hover {
  background: rgba(217, 119, 6, 0.05);
}

.ttk-names-price {
  white-space: nowrap;
}

.ttk-names-price-date {
  font-size: 12px;
}

.ttk-names-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ttk-names-legend {
  font-size: 13px;
  line-height: 1.4;
}

#ttk-names-toggle.active {
  background: #d97706;
  color: #fff;
}

@media (max-width: 720px) {
  .ttk-names-table thead {
    display: none;
  }
  .ttk-names-table,
  .ttk-names-table tbody,
  .ttk-names-table tr,
  .ttk-names-table td {
    display: block;
    width: 100%;
  }
  .ttk-names-table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    padding: 8px 0;
  }
  .ttk-names-table td {
    border-bottom: none;
    padding: 4px 0;
  }
  .ttk-names-actions {
    justify-content: flex-start;
  }
}

/* === Важное, дела: подвкладки и админ-задачи ============================== */

.important-subpanel {
  margin-top: 6px;
}

.recurring-item {
  border-left: 4px solid var(--brand);
  padding: 8px 12px;
}

.admin-tasks-form {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fffaf3;
  border-radius: 12px;
}

.admin-tasks-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-tasks-form-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* Промежуток между «Цвет» и «Срок» — чтобы сразу видно, что это разные поля. */
.admin-tasks-form-row .admin-tasks-form-spacer {
  margin-left: 16px;
}

.admin-tasks-recurring-toggle {
  cursor: pointer;
}

/* Раньше .admin-tasks-days был стилем <select multiple>, теперь это
   fieldset с чекбоксами и весь layout берётся из .task-recurring-days. */

.admin-tasks-section-title {
  margin: 16px 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-dark);
}

.admin-tasks-month {
  margin: 8px 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.admin-task-item {
  padding: 8px 12px;
  background: #fffaf3;
  border-radius: 8px;
  margin-bottom: 6px;
  border-left: 4px solid var(--brand);
}

.admin-task-item-done {
  opacity: 0.85;
}

.admin-task-overdue {
  color: #b91c1c;
  font-weight: 700;
}

/* Виртуальные карточки «Заказать товары» / «Себестоимости» — кликабельны
   целиком (без отдельной кнопки), счётчик-чип в заголовке. */
.admin-task-virtual {
  cursor: pointer;
  transition: background 0.12s, transform 0.06s;
}

.admin-task-virtual:hover {
  background: #fff4dd;
}

.admin-task-virtual:active {
  transform: scale(0.997);
}

.admin-task-virtual:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.admin-task-virtual-chip {
  display: inline-block;
  min-width: 22px;
  padding: 1px 8px;
  margin-left: 4px;
  background: #16a34a;
  color: #ffffff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.admin-task-virtual-chip-danger {
  background: #b91c1c;
}

/* Окно «Задачи управляющей» на «Сегодня» — над остальными карточками. */
.today-admin-tasks-card {
  margin-bottom: 12px;
}

.today-admin-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today-admin-task-item {
  padding: 8px 12px;
  background: #fffaf3;
  border-radius: 8px;
  border-left: 4px solid var(--brand);
}

.today-admin-task-yellow { background: #fef9c3; }
.today-admin-task-orange { background: #fed7aa; }
.today-admin-task-red    { background: #fecaca; }
.today-admin-task-overdue {
  background: #fecaca;
  border-left-color: #b91c1c !important;
}

/* Аналитика → Платежи. Внешний вид близок к analytics-writeoffs (правые
   колонки с ₽ — табличные цифры, итоговая строка — в фирменном тоне). */
.analytics-payments-heading {
  margin: 16px 0 8px;
  font-size: 18px;
}
.analytics-payments-section {
  margin-top: 16px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.analytics-payments-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.analytics-payments-section-title {
  margin: 0;
  font-size: 16px;
}
.analytics-payments-section-range {
  font-size: 13px;
}
.analytics-payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.analytics-payments-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 8px 10px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}
.analytics-payments-table thead th:nth-child(2),
.analytics-payments-table thead th:nth-child(3),
.analytics-payments-table thead th:nth-child(4) {
  text-align: right;
}
.analytics-payments-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.analytics-payments-table tbody tr:last-child td { border-bottom: none; }
.analytics-payments-name {
  color: var(--brand-dark);
  font-weight: 600;
}
.analytics-payments-num {
  text-align: right;
  white-space: nowrap;
}
.analytics-payments-money {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
}
.analytics-payments-total-row td {
  background: #ffe7c2;
  font-weight: 800;
  color: #000000;
  border-top: 2px solid var(--brand);
}
.analytics-payments-action {
  text-align: right;
  white-space: nowrap;
}
.analytics-payments-action button {
  padding: 4px 10px;
  font-size: 12px;
}
.analytics-payments-action .secondary,
.analytics-payments-action .danger {
  padding: 4px 10px;
  font-size: 12px;
}

/* Бейдж «✓ Выплачено DD.MM.YYYY» в шапке периода (Аванс/Основная). */
.analytics-payments-paid-badge {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #86efac;
}
.analytics-payments-section-head { display: flex; align-items: center; gap: 12px; }
/* Лёгкая визуальная отметка по всей секции, когда период оплачен. */
.analytics-payments-section-paid {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

/* Форма добавления займа: компактная сетка из 5 inputs + кнопки. */
.loans-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.7fr 0.7fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
.loans-form input {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.loans-form button[type="submit"] {
  padding: 6px 14px;
  font-size: 13px;
}
.loans-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.loans-input:hover { border-color: var(--line); }
.loans-input:focus {
  border-color: var(--brand);
  outline: none;
  background: #fffaf3;
}
.loans-suffix { margin-left: 4px; font-size: 12px; }

/* Карточка «Платежи» на «Сегодня» — даём ей собственный отступ
   и заголовок над содержимым (контент рендерится тем же
   renderPaymentsContent, что и в Аналитике). */
.today-payments-card { grid-column: 1 / -1; }
.today-payments-card h3 { margin-bottom: 8px; }
.today-payments-content { display: block; }

/* Карточка «Выгрузить фото накладных» — Иван, с 1 июля. На всю ширину,
   рядом с задачами Ивана и платежами. */
.today-photo-archive-card { grid-column: 1 / -1; }
.today-photo-archive-card h3 { margin-bottom: 8px; }
.today-photo-archive-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.today-photo-archive-actions .button-like {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  background: var(--brand);
  color: #ffffff;
  font-weight: 600;
}
.today-photo-archive-actions .button-like:hover { background: var(--brand-dark); }

/* Виртуальная задача «Завтра срок оплаты» в «Дела на сегодня». В отличие
   от чекбоксных задач — без чекбокса (нельзя «выполнить»), мягкий
   акцент-фон, иконка карты слева. */
.task-virtual {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff7ed;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  font-size: 13px;
  cursor: default;
}
.task-virtual .task-virtual-icon { font-size: 16px; }
.task-payment-tomorrow .task-text { font-weight: 500; }

/* Баннер «Срок оплаты сегодня» (Главный администратор). Список платежей
   рендерится плоским <ul>; итоговая сумма — отдельной строкой ниже. */
.payments-due-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.payments-due-total {
  font-weight: 800;
  color: #000000;
}
