/* ==========================================================================
   BÁNH MÌ TRÂM PHẠM - MOBILE APP DESIGN SYSTEM
   Modern, tactile, responsive with 0% accidental zoom on mobile devices
   ========================================================================== */

:root {
  --bg-app: #f4f2ec;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8f7f2;
  --bg-card-hover: #fcfbfa;
  
  --primary: #123023;
  --primary-light: #1c4433;
  --primary-soft: #eaf1ed;
  
  --accent: #d97706;
  --accent-light: #f59e0b;
  --accent-soft: #fef3c7;
  --accent-crust: #b45309;

  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e0f2fe;

  --text-primary: #17211b;
  --text-secondary: #57655d;
  --text-muted: #8d9891;
  --border: #e6e3da;
  --border-light: #efede6;

  --radius-xs: 8px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 26px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(18, 48, 35, 0.04);
  --shadow-md: 0 8px 24px rgba(18, 48, 35, 0.07);
  --shadow-lg: 0 14px 40px rgba(18, 48, 35, 0.10);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

/* Chống thu phóng triệt để trên Mobile */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overscroll-behavior-y: none;
}

/* Ngăn iOS auto-zoom khi focus ô nhập: luôn tối thiểu 16px */
input, select, textarea, button {
  font-family: inherit;
  font-size: 16px;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

/* ==========================================================================
   APP SHELL & LAYOUT
   ========================================================================== */
.app-container {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-app);
}

.main-content {
  flex: 1;
  padding: 16px 16px 120px;
}

/* App Top Header (Đã ẩn theo yêu cầu) */
.app-header {
  display: none !important;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1c4433 0%, #0e271c 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 14px rgba(18, 48, 35, 0.2);
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-action-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 17px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.header-action-btn:active {
  transform: scale(0.94);
  background: var(--bg-surface-subtle);
}

/* ==========================================================================
   DATE & WEEK SWITCHER (Hàng chọn ngày trong tuần)
   ========================================================================== */
.week-strip-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.week-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.week-badge-settle {
  background: var(--accent-soft);
  color: var(--accent-crust);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.week-days-scroll {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.day-pill .dow {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.day-pill .dom {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 2px 0 1px;
  white-space: nowrap;
}

.day-pill .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
}

.day-pill.active {
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(18, 48, 35, 0.25);
  transform: translateY(-2px);
}

.day-pill.active .dow,
.day-pill.active .dom {
  color: #ffffff;
}

.day-pill.active .dot {
  background: var(--accent-light);
}

.day-pill.has-data:not(.active) .dot {
  background: var(--success);
}

.day-pill.is-sunday {
  border-color: rgba(217, 119, 6, 0.25);
}

.day-pill.is-sunday .dow {
  color: var(--accent-crust);
}

.day-pill.is-sunday.active {
  background: var(--accent);
}

/* ==========================================================================
   SESSION SELECTOR (Buổi Sáng / Chiều)
   ========================================================================== */
.session-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.session-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-surface-subtle);
  padding: 5px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.session-tab {
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.session-tab.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.session-tab:active {
  transform: scale(0.97);
}

.session-tab .badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary);
}

/* Banner thông báo ngày Chủ Nhật */
.sunday-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  color: #92400e;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sunday-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 15px;
}

.sunday-banner-desc {
  font-size: 13px;
  line-height: 1.4;
  color: #78350f;
}

/* ==========================================================================
   CARDS & SECTIONS
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title h2,
.card-title b {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
}

/* Nhập bánh mì nhập hàng (vỏ bánh mì) */
.import-strip {
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f9ed 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.import-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* ==========================================================================
   BREAD CRUST PROMINENT PANEL (Vỏ bánh mì lấy về từ lò)
   ========================================================================== */
.bread-crust-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.bread-crust-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bread-crust-head b {
  font-size: 14px;
  color: #166534;
  display: flex;
  align-items: center;
  gap: 6px;
}

.crust-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.crust-stat-box {
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.crust-stat-box .stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.crust-stat-box .stat-num {
  font-size: 18px;
  font-weight: 900;
  color: #166534;
}

.crust-stat-box.remaining-box {
  background: #dcfce7;
  border-color: #4ade80;
}

.crust-stat-box.remaining-box.is-empty {
  background: #fee2e2;
  border-color: #f87171;
}

.crust-stat-box.remaining-box.is-empty .stat-num {
  color: #b91c1c;
}

.crust-warning-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 12px;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.crust-danger-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 12px;
  color: #b91c1c;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.import-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.import-input-wrap {
  position: relative;
  flex: 1;
}

.import-input {
  width: 100%;
  border: 2px solid #86efac;
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 40px;
  font-size: 18px;
  font-weight: 800;
  color: #166534;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

.import-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.import-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

.quick-presets {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.preset-chip {
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #15803d;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:active {
  background: #dcfce7;
  transform: scale(0.95);
}

.btn-save-crust {
  width: 100%;
  margin-top: 12px;
  background: #166534;
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.25);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-save-crust:active {
  transform: scale(0.97);
  background: #14532d;
}

.btn-save-crust:disabled {
  opacity: 0.5;
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

/* ==========================================================================
   QUICK CASH-IN (Mờ & Có khóa để tránh chạm nhầm)
   ========================================================================== */
.quick-cash-box {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px dashed #f59e0b;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  transition: all 0.25s ease;
}

.quick-cash-box.is-locked {
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border-light);
  opacity: 0.75;
}

.quick-cash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.quick-cash-head b {
  font-size: 14px;
  color: var(--accent-crust);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-toggle-lock {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn-toggle-lock:active {
  transform: scale(0.95);
}

.quick-cash-box.is-locked .quick-cash-input-wrap,
.quick-cash-box.is-locked .convert-preview {
  display: none !important;
}

.quick-cash-lock-notice {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
  padding: 2px 0 4px;
}

.quick-cash-box:not(.is-locked) .quick-cash-lock-notice {
  display: none !important;
}

.quick-cash-input-wrap {
  position: relative;
  display: flex;
  gap: 8px;
}

.quick-cash-input {
  flex: 1;
  border: 2px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  background: #ffffff;
  outline: none;
}

.quick-cash-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.btn-convert {
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
  transition: transform 0.15s ease;
}

.btn-convert:active {
  transform: scale(0.95);
}

.convert-preview {
  margin-top: 10px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid #fde68a;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.convert-preview strong {
  color: var(--accent-crust);
  font-size: 14px;
}

/* ==========================================================================
   CRUST STOCK STATUS BAR ABOVE COUNTERS
   ========================================================================== */
.crust-stock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
}

.crust-stock-bar .stock-remaining {
  color: #15803d;
}

.crust-stock-bar .stock-remaining.is-empty {
  color: #b91c1c;
}

.save-btn:disabled,
.save-btn.is-disabled {
  opacity: 0.55;
  background: #94a3b8 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* ==========================================================================
   PRODUCT CARDS & COMPACT 1-ROW COUNTERS (Ổ 15K, 20K, 25K)
   ========================================================================== */
.sale-grid-compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
}

.product-card-compact {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 4px 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-card-compact:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(18, 48, 35, 0.12);
}

.product-compact-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.counter-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  width: 100%;
  background: var(--bg-surface-subtle);
  padding: 3px 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.counter-compact button {
  width: 32px;
  height: 38px;
  min-width: 28px;
  border-radius: var(--radius-xs);
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s ease, background 0.1s ease;
  user-select: none;
}

.counter-compact button:active {
  transform: scale(0.92);
  background: var(--primary-soft);
}

.counter-compact button:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.counter-compact input {
  width: 100%;
  min-width: 0;
  height: 38px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
  outline: none;
  padding: 0;
  -moz-appearance: textfield;
}

.counter-compact input::-webkit-outer-spin-button,
.counter-compact input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ==========================================================================
   SESSION & DAY BREAKDOWN SUMMARY (Chi tiết buổi & cả ngày)
   ========================================================================== */
.session-breakdown-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-item {
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.breakdown-item.current-active {
  background: #f0fdf4;
  border-color: #86efac;
}

.breakdown-item.breakdown-day-total {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
}

.breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.breakdown-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.breakdown-title .pill-current {
  font-size: 10px;
  font-weight: 700;
  background: #166534;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.breakdown-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.breakdown-total strong {
  color: var(--primary);
}

.breakdown-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-qty {
  font-size: 11px;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid var(--border-light);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tag-qty strong {
  color: var(--primary);
  font-weight: 800;
}

.tag-qty.day-tag {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #1e293b;
}

.tag-qty.day-tag strong {
  color: #0f172a;
}

/* ==========================================================================
   TOTAL CARDS & SUMMARY
   ========================================================================== */
.total-card {
  background: linear-gradient(135deg, #123023 0%, #1e4d39 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 10px 30px rgba(18, 48, 35, 0.2);
  margin-bottom: 12px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #a7d3bf;
  text-transform: uppercase;
}

.total-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-top: 4px;
}

.total-secondary-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.total-secondary-card span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
}

.total-secondary-card strong {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

/* Action Button (Save) */
.save-btn {
  width: 100%;
  height: 54px;
  background: linear-gradient(135deg, #123023 0%, #1a4230 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(18, 48, 35, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-top: 8px;
}

.save-btn:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(18, 48, 35, 0.2);
}

/* ==========================================================================
   METRICS GRID (Thu - Chi - Lợi nhuận)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.metric-card.highlight {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.metric-card.accent {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
}

.metric-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

.metric-card.highlight .metric-label {
  color: #15803d;
}

.metric-card.accent .metric-label {
  color: var(--accent-crust);
}

.metric-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 6px;
  display: block;
}

.metric-card.highlight .metric-val {
  color: #14532d;
}

.metric-card.accent .metric-val {
  color: #78350f;
}

/* ==========================================================================
   WEEKLY TIMELINE LIST (Lịch sử tuần & Quyết toán)
   ========================================================================== */
.timeline-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
  border-radius: var(--radius-sm);
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-row:active {
  background: var(--bg-surface-subtle);
}

.timeline-date-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d1d5db;
}

.timeline-dot.active {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

.timeline-dot.sunday {
  background: var(--accent);
}

.timeline-info b {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
}

.timeline-info small {
  font-size: 12px;
  color: var(--text-muted);
}

.timeline-amount {
  text-align: right;
}

.timeline-amount strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.timeline-amount small {
  font-size: 11px;
  color: var(--text-muted);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  touch-action: manipulation;
  flex-shrink: 0;
}

.btn-action-icon:hover {
  opacity: 0.9;
}

.btn-action-icon:active {
  transform: scale(0.92);
}

.btn-action-icon.edit {
  color: #2563eb;
  background: #eff6ff;
  border-color: #dbeafe;
}

.btn-action-icon.delete {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fee2e2;
}

.btn-action-icon svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.form-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.timeline-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.form-group {
  margin-bottom: 14px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 15px;
  color: var(--text-primary);
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="date"].form-control {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background-color: #ffffff;
  padding: 0 12px;
  line-height: 46px;
}

select.form-control {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2357655d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 48, 35, 0.1);
}

textarea.form-control {
  height: 80px;
  padding: 10px 14px;
  resize: vertical;
}

/* ==========================================================================
   BOTTOM APP NAVIGATION
   ========================================================================== */
.bottom-nav {
  position: fixed;
  z-index: 100;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-inner {
  pointer-events: auto;
  width: 100%;
  max-width: 540px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(220, 218, 210, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 4px 6px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  color: var(--text-muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.nav-icon {
  font-size: 21px;
  line-height: 1;
  margin-bottom: 3px;
  filter: grayscale(40%);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  filter: none;
  transform: scale(1.12);
}

.nav-item.active .nav-label {
  font-weight: 800;
}

.nav-item:active {
  transform: scale(0.92);
}

/* ==========================================================================
   ALERTS, BADGES & NOTICES
   ========================================================================== */
.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-crust);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-success {
  background: var(--success-soft);
  color: var(--success);
}

/* ==========================================================================
   TOAST NOTIFICATIONS (Thông báo nổi tự ẩn sau vài giây)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: calc(100% - 32px);
  max-width: 440px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.12);
  animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: currentColor;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  opacity: 0.75;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: opacity 0.15s ease;
  line-height: 1;
}

.toast-close:hover {
  opacity: 1;
}

.toast-success {
  background: #14532d;
  color: #ffffff;
  border: 1.5px solid #22c55e;
}

.toast-danger,
.toast-error {
  background: #991b1b;
  color: #ffffff;
  border: 1.5px solid #ef4444;
}

.toast-warning {
  background: #92400e;
  color: #ffffff;
  border: 1.5px solid #f59e0b;
}

.toast-info {
  background: #1e293b;
  color: #ffffff;
  border: 1.5px solid #64748b;
}

.toast.is-hiding {
  opacity: 0 !important;
  transform: translateY(-24px) scale(0.94) !important;
  pointer-events: none !important;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.locked-badge {
  background: #f3f4f6;
  color: #4b5563;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Auth Center Screen */
.center-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #f4f2ec 0%, #e8e4d8 100%);
}

.auth-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

/* Dialog Modal */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  width: min(460px, 92vw);
  margin: auto;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(18, 48, 35, 0.4);
  backdrop-filter: blur(4px);
}

.dialog-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
}