/* ── Cashbox Page ── */
.cashbox-page {
  min-height: 100%;
}

.cb-page-header {
  margin-bottom: var(--space-md);
}

.cashbox-stat-card[data-filter] {
  cursor: pointer;
}

.cashbox-stat-card.is-active-filter {
  box-shadow: 0 0 0 2px var(--color-brand);
}

.cb-mobile-list {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
}

.cb-mobile-list.is-visible {
  display: flex;
}

.cb-mobile-card {
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.cb-mobile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

.cb-mobile-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.cashbox-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.cashbox-header-row .page-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-title-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.page-title-back:hover {
  background: var(--color-hover);
  color: var(--color-text-primary);
}

.page-title-back svg {
  width: 20px;
  height: 20px;
}

.cashbox-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Action Buttons ── */
.btn-cash-in,
.btn-cash-out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-bn);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-cash-in svg,
.btn-cash-out svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-cash-in {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.btn-cash-in:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-cash-out {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-cash-out:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* ── Date Range Picker ── */
.cashbox-date-range {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
  min-width: 240px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cashbox-date-range:hover {
  border-color: #d1d5db;
}

.cashbox-date-range:focus-within {
  border-color: var(--color-active-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.cashbox-date-range-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.cashbox-date-range-label {
  font-family: var(--font-en);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
  pointer-events: none;
}

.cashbox-date-range-inputs {
  position: absolute;
  inset: 0;
  opacity: 0;
  display: flex;
}

.cashbox-date-range-inputs input {
  flex: 1;
  height: 100%;
  cursor: pointer;
}

/* ── Summary Cards ── */
.cashbox-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.cashbox-stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  min-height: 88px;
}

.cashbox-stat-card.is-balance {
  background: #eff6ff;
  border-color: #dbeafe;
}

.cashbox-stat-card.is-in {
  background: #f0fdf4;
  border-color: #dcfce7;
}

.cashbox-stat-card.is-out {
  background: #fef2f2;
  border-color: #fecaca;
}

.cashbox-stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cashbox-stat-label {
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.cashbox-stat-value {
  font-family: var(--font-en);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-deep);
  letter-spacing: -0.02em;
}

.cashbox-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cashbox-stat-card.is-balance .cashbox-stat-icon {
  background: #dbeafe;
  color: #2563eb;
}

.cashbox-stat-card.is-in .cashbox-stat-icon {
  background: #dcfce7;
  color: #16a34a;
}

.cashbox-stat-card.is-out .cashbox-stat-icon {
  background: #fecaca;
  color: #dc2626;
}

.cashbox-stat-icon svg {
  width: 24px;
  height: 24px;
}

/* ── Table Meta ── */
.cashbox-table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.cashbox-table-meta span {
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.cashbox-table-meta strong {
  font-family: var(--font-en);
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ── Transaction Table ── */
.cashbox-table {
  width: 100%;
  border-collapse: collapse;
}

.cashbox-table thead th {
  padding: 14px var(--space-md);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: linear-gradient(180deg, #fffbeb, #fff8e1);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-bn);
}

.cashbox-table thead th:last-child {
  text-align: right;
}

.cashbox-table tbody td {
  padding: 14px var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
  font-family: var(--font-bn);
}

.cashbox-table tbody tr:last-child td {
  border-bottom: none;
}

.cashbox-table tbody td:last-child {
  text-align: right;
  font-family: var(--font-en);
  font-weight: 600;
}

.cashbox-table .is-cash-in {
  color: #16a34a;
  font-weight: 600;
}

.cashbox-table .is-cash-out {
  color: #dc2626;
  font-weight: 600;
}

.cashbox-table .cell-note {
  color: var(--color-text-muted);
}

.cashbox-table .cell-datetime {
  font-family: var(--font-bn);
  white-space: nowrap;
}

/* ── Loading ── */
.cashbox-page.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Toast ── */
.cashbox-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 10px 20px;
  background: var(--color-text-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 300;
  pointer-events: none;
}

.cashbox-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.cashbox-toast.is-error {
  background: #dc2626;
}

.cashbox-empty-state {
  display: none;
}

.cashbox-empty-state.is-visible {
  display: flex;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .cashbox-stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  #cashboxTableCard { display: none !important; }
  .cb-mobile-list.is-visible { display: flex; }
}

@media (max-width: 768px) {
  .cb-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .cb-header-actions {
    width: 100%;
  }

  .cb-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .btn-cash-in,
  .btn-cash-out {
    flex: 1;
    justify-content: center;
  }

  .cashbox-date-range {
    flex: 1;
    min-width: 0;
  }

  #cashboxTableCard {
    display: none !important;
  }

  .cb-mobile-list.is-visible {
    display: flex;
  }
}
