/* ═══════════════════════════════════════════════
   screens/history.css — вынесено из screens.css (аудит п.8)
════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   ЭКРАН: ИСТОРИЯ
───────────────────────────────────────────── */
.history-filters {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: var(--space-md);
  scrollbar-width: none;
}

.history-filters::-webkit-scrollbar { display: none; }

.history-filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--color-white);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.history-filter-chip--active {
  background: var(--color-dark);
  color: var(--color-white);
}

.history-date-group {
  margin-bottom: var(--space-md);
}

.history-date-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 4px;
  margin-bottom: 6px;
}

/* ─────────────────────────────────────────────
   ЭКРАН: ИСТОРИЯ (kassa two-axis)
───────────────────────────────────────────── */

.screen-history {
  background: #1a1a1a;
}

.hist-history-root {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: 0;
}

.hist-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hist-hdr {
  background: #1a1a1a;
  padding: max(48px, calc(env(safe-area-inset-top) + 32px)) 0 0;
  flex-shrink: 0;
}

.hist-hdr--skeleton {
  padding: 48px var(--space-lg) var(--space-md);
}

/* Навигация месяца — одна симметричная строка */
.hist-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px 10px;
}

.hist-nav-row--hidden {
  display: none !important;
}

.hist-month-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  min-width: 0;
}

.hist-month-center svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.hist-nav-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.hist-round-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.hist-round-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

.hist-round-btn--disabled,
.hist-round-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.hist-round-btn--dark {
  background: rgba(0, 0, 0, 0.06);
  color: #1a1a1a;
}

.hist-search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 0;
}

.hist-search-field__ico {
  display: flex;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.hist-search-field__inp {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.hist-search-field__inp::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* Фильтры: типы + разделитель + доп. чипы и «+» */
.hist-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  padding: 4px 16px 8px;
}

.hist-filters-row__types {
  display: flex;
  flex: 1 1 220px;
  gap: 4px;
  min-width: 0;
}

.hist-type-chip {
  flex: 1;
  padding: 6px 4px;
  border-radius: 12px;
  font-size: 12px;
  font-family: var(--font-family);
  text-align: center;
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #d4d4d4;
}

.hist-type-chip--on {
  background: #ffc72c;
  color: #1a1a1a;
  font-weight: 500;
}

.hist-filters-row__vsep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
  flex-shrink: 0;
}

.hist-filters-row__extra-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  flex: 1 1 96px;
  justify-content: flex-end;
}

.hist-filters-row__extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  justify-content: flex-end;
}

.hist-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  border: 0.5px solid rgba(255, 199, 44, 0.4);
  background: rgba(255, 199, 44, 0.16);
  color: #ffc72c;
  font-family: var(--font-family);
}

.hist-filter-chip__x {
  display: flex;
  align-items: center;
  line-height: 0;
  color: #ffc72c;
}

.hist-add-dot {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  border: 0.5px dashed rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}

.hist-add-dot:active {
  background: rgba(255, 255, 255, 0.06);
}

/* Сводка (раскрывающаяся) */
.hist-saldo-wrap {
  margin: 0 16px 10px;
}

.hist-saldo2 {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  overflow: hidden;
}

.hist-saldo2__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-family);
}

.hist-saldo2__lbl {
  font-size: 11px;
  color: #888;
  letter-spacing: 0.3px;
}

.hist-saldo2__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hist-saldo2__val {
  font-size: 15px;
  font-weight: 500;
}

.hist-saldo2__val--pos {
  color: #4ade80;
}

.hist-saldo2__val--neg {
  color: #ff5e5e;
}

.hist-saldo2__chev-wrap {
  color: #888;
  display: flex;
  transition: transform 0.25s ease;
}

.hist-saldo2--open .hist-saldo2__chev-wrap {
  transform: rotate(180deg);
}

.hist-saldo2__detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.22s ease;
  border-top: 0.5px solid transparent;
}

.hist-saldo2--open .hist-saldo2__detail {
  max-height: 120px;
  opacity: 1;
  border-top-color: rgba(255, 255, 255, 0.08);
}

.hist-saldo2__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 10px;
}

.hist-saldo2__row:first-child {
  padding-top: 10px;
}

.hist-saldo2__sub-lbl {
  font-size: 12px;
  color: #888;
}

.hist-saldo2__sub-val {
  font-size: 14px;
  font-weight: 500;
}

.hist-saldo2__sub-val--inc {
  color: #4ade80;
}

.hist-saldo2__sub-val--exp {
  color: #ff5e5e;
}

/* Тело — светлый блок */
.hist-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f4f4f0;
  border-radius: 18px 18px 0 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.hist-body.hist-body--loading .hist-list {
  padding-top: 16px;
}

.hist-list {
  padding: var(--space-md) var(--space-lg) 24px;
}

.hist-list .op-row {
  cursor: pointer;
  border-bottom-color: #e5e5e0;
}

.hist-day-block {
  margin-bottom: 4px;
}

.hist-day-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 4px 8px;
}

.hist-day-hdr__left {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  letter-spacing: 0.5px;
}

.hist-day-hdr__cnt {
  font-size: 11px;
  color: #999;
}

.hist-day-cards {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}

.op-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 0.5px solid #ececea;
  cursor: pointer;
  font-family: var(--font-family);
}

.op-card:last-child {
  border-bottom: none;
}

.op-card__tile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.op-card__body {
  flex: 1;
  min-width: 0;
}

.op-card__title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.25;
}

.op-card__sub {
  margin-top: 1px;
  font-size: 12px;
  color: #888;
  line-height: 1.3;
}

.op-card__amt {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
}

.op-card__amt--inc {
  color: #2d8a3f;
}

.op-card__amt--exp {
  color: #c43838;
}

.op-card__amt--xfer {
  color: #666;
}

.op-row__rub {
  font-weight: 600;
  opacity: 0.85;
}

/* Пустое состояние */
.hist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  text-align: center;
  padding: 24px 16px;
}

.hist-empty__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid #c5c4be;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: #888;
}

.hist-empty__text {
  font-size: 14px;
  color: #555;
  margin-bottom: 4px;
}

.hist-empty__sub {
  font-size: 12px;
  color: #999;
  margin-bottom: 14px;
}

.hist-empty__reset {
  padding: 8px 14px;
  border-radius: 14px;
  background: #1a1a1a;
  border: none;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

/* Bottomsheet выбора фильтра */
.hist-filter-sheet__title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--color-dark);
}

.hist-filter-section__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.hist-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.hist-filter-opt {
  padding: 7px 14px;
  border-radius: 16px;
  background: #f0f0f5;
  color: #0a0a0f;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
}

.hist-filter-opt--active {
  background: #ffdd2d;
  color: #1a1a1a;
}

.hist-filter-empty {
  font-size: 13px;
  color: var(--color-muted);
}

/* Bottomsheet: добавить фильтр (2 шага) */
.hist-fs {
  text-align: left;
  padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
}

.hist-fs-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #ddd;
  margin: 8px auto 12px;
}

.hist-fs-head,
.hist-fs-head2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 0.5px solid #ececea;
}

.hist-fs-head2 {
  gap: 8px;
}

.hist-fs-title {
  font-size: 16px;
  font-weight: 500;
  color: #1a1a1a;
}

.hist-fs-title--center {
  flex: 1;
  text-align: center;
}

.hist-fs-close {
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: #666;
  display: flex;
}

.hist-fs-back {
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: #1a1a1a;
}

.hist-fs-reset {
  border: none;
  background: transparent;
  font-size: 14px;
  color: #0066ff;
  cursor: pointer;
  padding: 4px;
  min-width: 72px;
  text-align: right;
}

.hist-fs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: none;
  border-bottom: 0.5px solid #ececea;
  background: #fff;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  text-align: left;
}

.hist-fs-row__meta {
  color: #888;
  font-size: 14px;
}

.hist-fs-list {
  max-height: 52vh;
  overflow-y: auto;
  padding: 8px 0 72px;
}

.hist-fs-check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
}

.hist-fs-apply {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  width: calc(100% - 32px);
  margin: 12px 16px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: #ffc72c;
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* Модалка выбора месяца */
.hist-modal {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.hist-modal.hidden {
  display: none;
}

.hist-mp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.hist-mp-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 1;
}

.hist-mp-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #ddd;
  margin: 8px auto 4px;
}

.hist-mp-year {
  text-align: center;
  font-size: 14px;
  color: #888;
  padding: 4px 0 8px;
}

.hist-mp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 16px 16px;
}

.hist-mp__cell {
  height: 40px;
  border-radius: 8px;
  border: none;
  background: #f4f4f0;
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
  cursor: pointer;
}

.hist-mp__cell--on {
  background: #ffc72c;
  color: #1a1a1a;
}

.hist-mp__cell:disabled {
  opacity: 0.3;
  cursor: default;
}

.hist-mp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
  gap: 12px;
  border-top: 0.5px solid #ececea;
  padding-top: 12px;
}

.hist-mp-year-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
}

.hist-mp-today {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: #f4f4f0;
  font-size: 14px;
  cursor: pointer;
}

/* Bottomsheet: детали операции */
.bs-op-hero--in {
  background: rgba(34, 197, 94, 0.12);
}

.bs-op-hero--out {
  background: rgba(239, 68, 68, 0.1);
}

.bs-op-hero--xfer {
  background: rgba(96, 165, 250, 0.12);
}

.bs-op-hero {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.bs-op-hero__sign {
  font-size: 20px;
  font-weight: 900;
}

.bs-op-hero__amount {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
  flex: 1;
}

.bs-op-hero__dir {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: capitalize;
}

.bs-op-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bs-op-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 0.5px solid var(--color-border);
}

.bs-op-field:last-child {
  border-bottom: none;
}

.bs-op-field__lbl {
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 500;
}

.bs-op-field__val {
  font-size: 14px;
  color: var(--color-dark);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}
