/* ==========================================================================
   Общие элементы: кнопки, чипы, зона загрузки, панель фильтров, окна, всплывающее сообщение.
   ========================================================================== */

/* ---------- Иконки (SVG внутри span.icon) ---------- */
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; fill: currentColor; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: transparent;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn--filled { background: var(--primary); color: var(--on-primary); }
.btn--filled:hover { background: var(--primary); box-shadow: var(--shadow-1); filter: brightness(1.08); }
.btn--outlined { border-color: var(--outline); color: var(--primary); }
.btn--danger { color: var(--error); }
.btn--danger.btn--filled { background: var(--error); color: var(--surface); }
.btn--small { height: 32px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn--small { width: 28px; height: 28px; }
.icon-btn--small .icon { width: 16px; height: 16px; }

/* ---------- Чипы ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-s);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
}
button.chip { cursor: pointer; }
button.chip:hover { background: var(--surface-high); }
.chip[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.chip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--outline)); }
.chip--static { height: 26px; background: var(--surface-high); border-color: transparent; }

/* ---------- Зона загрузки ---------- */
.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 2px dashed var(--outline);
  border-radius: var(--radius-m);
  background: var(--surface-container);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); outline: none; }
.dropzone--over { border-color: var(--primary); background: var(--primary-container); }
.dropzone__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.dropzone__icon .icon { width: 26px; height: 26px; }
.dropzone__text { display: grid; gap: 2px; }
.dropzone__text strong { font-size: 16px; font-weight: 500; }
.dropzone__text span { color: var(--on-surface-variant); }

/* ---------- Панель фильтров ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar__spacer { flex: 1; }
.toolbar select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--on-surface);
  font: inherit;
}

/* ---------- Окна (<dialog>) ---------- */
.dialog {
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--on-surface);
  box-shadow: var(--shadow-3);
  max-height: 92vh;
}
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog--small { width: min(420px, calc(100vw - 32px)); }
.dialog--wide { width: min(980px, calc(100vw - 24px)); }
.dialog__body { padding: 24px; display: grid; gap: 12px; }
.dialog__title { font-size: 20px; font-weight: 500; }
.dialog__text { color: var(--on-surface-variant); }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Всплывающее сообщение ---------- */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  display: grid;
  gap: 4px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: var(--radius-s);
  background: #303033;   /* тёмная плашка в обеих темах */
  color: #f2f0f4;
  box-shadow: var(--shadow-3);
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.snackbar--visible { opacity: 1; transform: translate(-50%, 0); }
.snackbar__line--error { color: #ffb4ab; }

.empty { padding: 48px 0; text-align: center; color: var(--on-surface-variant); }

@media (max-width: 600px) {
  .dropzone { padding: 16px; }
}

/* ---------- Зона загрузки + кнопка «Ввести вручную» ---------- */
.upload { display: flex; gap: 12px; align-items: stretch; }
.upload .dropzone { flex: 1; }
.upload__manual { height: auto; min-width: 150px; border-radius: var(--radius-m); justify-content: center; }
@media (max-width: 600px) {
  .upload { flex-direction: column; }
  .upload__manual { height: 48px; }
}

/* ---------- «Конец дня» отдельно от «Удалить выбранные» ---------- */
.toolbar__divider { align-self: stretch; width: 1px; margin: 4px 14px; background: var(--outline-variant, var(--outline)); }
.btn--end-of-day { border-color: transparent; background: var(--surface-high); color: var(--on-surface-variant); }
.btn--end-of-day:hover:not(:disabled) { color: var(--error); }
.btn--end-of-day:disabled { opacity: .5; cursor: default; }

/* атрибут hidden должен скрывать элемент, даже если у класса задан display */
[hidden] { display: none !important; }
