/* ==========================================================================
   LLD Restaurant - Mobile Expense Management System
   Modern Mobile-First Culinary Design Tokens & Responsive Layout
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #0b0f17;
  --bg-card: #131a26;
  --bg-card-sub: #1a2332;
  --bg-input: #0e1420;
  
  --border-subtle: #222f42;
  --border-focus: #f59e0b;
  
  --brand-primary: #f59e0b;
  --brand-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --brand-glow: rgba(245, 158, 11, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --color-emerald: #10b981;
  --color-emerald-bg: rgba(16, 185, 129, 0.12);
  --color-rose: #f43f5e;
  --color-rose-bg: rgba(244, 63, 94, 0.12);
  --color-cyan: #06b6d4;
  --color-cyan-bg: rgba(6, 182, 212, 0.12);
  --color-amber: #f59e0b;
  
  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.3);
  
  /* Typography */
  --font-family: 'Prompt', 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Hide native number input arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.nav-item * {
  pointer-events: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-dark);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* ==================== APP HEADER ==================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 10px var(--brand-glow);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-tag {
  font-size: 10px;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: var(--brand-primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-emerald);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-emerald);
  box-shadow: 0 0 8px var(--color-emerald);
  animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

/* ==================== P&L LIVE BANNER STRIP (ซ่อนแถบบน ไม่ต้องแสดง) ==================== */
.pnl-strip {
  display: none !important;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #131a26 0%, #0e1420 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.pnl-col {
  display: flex;
  flex-direction: column;
}

.pnl-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pnl-val {
  font-size: 15px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
}

.pnl-divider {
  font-size: 16px;
  color: var(--text-dim);
  font-weight: 300;
}

.profit-col {
  position: relative;
  text-align: right;
}

.margin-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-emerald);
  background: var(--color-emerald-bg);
  padding: 1px 5px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 1px;
}

.text-cyan { color: var(--color-cyan); }
.text-rose { color: var(--color-rose); }
.text-emerald { color: var(--color-emerald); }

/* ==================== MAIN CONTENT & TABS ==================== */
.app-main {
  flex: 1;
  padding: 16px 16px 90px 16px;
  overflow-y: auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== TAB 1: QUICK ENTRY COMPONENTS ==================== */

/* Smart Voice Chat Card (ช่อง Chat ด้านบนสุด) */
.voice-chat-card {
  background: linear-gradient(145deg, #161f2e 0%, #0f1622 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(245, 158, 11, 0.12);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.voice-chat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ea580c 100%);
}

.chat-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.chat-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-ai-icon {
  font-size: 20px;
  background: rgba(245, 158, 11, 0.15);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  display: block;
  letter-spacing: -0.2px;
}

.chat-subtitle {
  font-size: 10.5px;
  color: var(--text-dim);
  display: block;
}

.btn-voice-mic {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--brand-primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-voice-mic:active {
  transform: scale(0.92);
}

.btn-voice-mic.listening {
  background: var(--color-rose);
  color: #fff;
  border-color: var(--color-rose);
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.6);
  animation: pulseAnim 1s infinite;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.chat-input {
  width: 100%;
  background: #090d14;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 34px 11px 12px;
  color: #fff;
  font-size: 13.5px;
  font-family: var(--font-family);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.chat-input::placeholder {
  color: var(--text-dim);
  font-size: 12px;
}

.chat-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  display: none;
}

.btn-chat-send {
  background: var(--brand-gradient);
  color: #0b0f17;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: 42px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 10px var(--brand-glow);
  transition: all 0.15s ease;
}

.btn-chat-send:active {
  transform: scale(0.94);
}

/* Parse Feedback Card */
.chat-parse-feedback {
  margin-top: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  animation: fadeIn 0.2s ease-out;
}

.feedback-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.feedback-badge-row span {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
}

.fb-tag {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.fb-amt {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  font-family: 'Kanit', sans-serif;
}

.fb-cat {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
}

.fb-qty {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.fb-hint {
  font-size: 11px;
  color: var(--color-emerald);
  margin: 0;
  line-height: 1.4;
}

/* Example Chips */
.chat-example-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.example-chip-hint {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.ex-chip {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.ex-chip:active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  transform: scale(0.95);
}

/* Amount Hero Card */
.amount-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.amount-hero-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-gradient);
}

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

.amount-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.clear-btn {
  font-size: 12px;
  color: var(--brand-primary);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.1);
  transition: all 0.15s;
}

.clear-btn:active {
  transform: scale(0.95);
  background: rgba(245, 158, 11, 0.2);
}

.amount-display-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 0;
}

.currency-symbol {
  font-size: 32px;
  font-weight: 600;
  color: var(--brand-primary);
  font-family: 'Kanit', sans-serif;
}

.amount-input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 44px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  width: 100%;
  max-width: 280px;
  text-align: left;
}

.amount-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* Quick Increment Row */
.quick-inc-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.btn-inc {
  flex: 1;
  min-width: 58px;
  background: var(--bg-card-sub);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-inc:active {
  transform: scale(0.92);
  background: var(--brand-primary);
  color: #000;
  border-color: var(--brand-primary);
}

/* Form Sections */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.section-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* Quick Tags Grid */
.quick-tags-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.quick-tag-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-tag-btn:active, .quick-tag-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--brand-primary);
  transform: scale(0.97);
}

.quick-tag-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.quick-tag-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quick-tag-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-tag-hint {
  font-size: 10px;
  color: var(--text-dim);
}

/* Category Pills Row */
.category-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.cat-pill.active {
  background: var(--brand-primary);
  color: #0b0f17;
  border-color: var(--brand-primary);
  font-weight: 600;
}

/* Slip Uploader Box */
.slip-uploader-box {
  background: var(--bg-input);
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s;
}

.slip-uploader-box.has-slip {
  border-style: solid;
  border-color: var(--color-emerald);
}

.slip-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.slip-camera-icon {
  font-size: 32px;
}

.slip-prompt {
  font-size: 12px;
  color: var(--text-muted);
}

.slip-btn-group {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.btn-slip-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-slip-action.btn-camera {
  background: var(--brand-gradient);
  color: #000;
  font-weight: 600;
}

.btn-slip-action.btn-gallery {
  background: var(--bg-card-sub);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-slip-action:active {
  transform: scale(0.96);
}

/* Slip Preview */
.slip-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preview-img-wrapper {
  position: relative;
  width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.preview-img-wrapper img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  display: flex;
  gap: 8px;
  justify-content: center;
}

.preview-action-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s;
}

.preview-action-btn.view {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  backdrop-filter: blur(4px);
}

.preview-action-btn.remove {
  background: var(--color-rose);
  color: #fff;
}

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

.slip-filesize {
  font-size: 11px;
  color: var(--color-emerald);
}

/* Payment Method & Meta Controls */
.sub-form-row {
  margin-bottom: 12px;
}

.input-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.payment-method-row {
  display: flex;
  gap: 8px;
}

.pay-radio {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.pay-radio input {
  display: none;
}

.pay-radio.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  font-weight: 600;
}

.sub-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.custom-select, .custom-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
}

.custom-select:focus, .custom-input:focus {
  border-color: var(--brand-primary);
}

/* Submit Action Button */
.submit-action-box {
  margin-top: 10px;
}

.btn-primary-submit {
  width: 100%;
  padding: 16px;
  background: var(--brand-gradient);
  color: #0b0f17;
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--brand-glow);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-submit:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px var(--brand-glow);
}

.btn-primary-submit .btn-subtext {
  font-size: 14px;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* ==================== TAB 2: ANALYTICS & P&L ==================== */
.analytics-header {
  margin-bottom: 16px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.date-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.filter-chip.active {
  background: var(--brand-primary);
  color: #0b0f17;
  font-weight: 600;
  border-color: var(--brand-primary);
}

.pnl-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.pnl-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--color-emerald);
}

.pnl-stat-card.loss::before {
  background: var(--color-rose);
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

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

.status-badge-lg {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.status-badge-lg.profit {
  background: var(--color-emerald-bg);
  color: var(--color-emerald);
}

.status-badge-lg.loss {
  background: var(--color-rose-bg);
  color: var(--color-rose);
}

.stat-net-amount {
  font-size: 38px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  color: var(--color-emerald);
  margin-bottom: 6px;
}

.pnl-stat-card.loss .stat-net-amount {
  color: var(--color-rose);
}

.stat-margin-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.stat-comparison-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-item .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.progress-track {
  height: 7px;
  background: var(--bg-card-sub);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill.sales {
  background: var(--color-cyan);
  height: 100%;
  border-radius: var(--radius-pill);
}

.progress-fill.expense {
  background: var(--color-rose);
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

/* Category Breakdown */
.analytics-section {
  margin-bottom: 16px;
}

.sub-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.breakdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.breakdown-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-icon {
  font-size: 18px;
}

.breakdown-name {
  font-size: 13px;
  color: var(--text-main);
}

.breakdown-right {
  text-align: right;
}

.breakdown-amount {
  font-size: 13px;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  color: var(--text-main);
}

.breakdown-percent {
  font-size: 11px;
  color: var(--text-dim);
}

/* Insights Box */
.insight-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.insight-icon {
  font-size: 20px;
}

.insight-content {
  display: flex;
  gap: 6px;
  color: var(--text-muted);
}

.insight-content strong {
  color: var(--text-main);
}

/* ==================== TAB 3: HISTORY & SLIPS ==================== */
.history-header {
  margin-bottom: 14px;
}

.history-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.count-badge {
  font-size: 11px;
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  color: var(--brand-primary);
  border: 1px solid var(--border-subtle);
}

.search-bar-wrap {
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
}

.search-input:focus {
  border-color: var(--brand-primary);
}

.history-cat-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* Expense Items List */
.expense-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expense-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.1s;
}

.expense-card:active {
  transform: scale(0.99);
}

.expense-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.expense-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.expense-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.expense-tag {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-meta {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.slip-tag-badge {
  color: var(--color-emerald);
  background: var(--color-emerald-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

.expense-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.expense-amount {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  color: var(--color-rose);
}

.btn-card-del {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-card-del:hover {
  color: var(--color-rose);
}

.empty-history {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ==================== TAB 4: EXPORT & INTEGRATIONS ==================== */
.export-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}

.export-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.card-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.btn-copy-line {
  background: #06c755; /* LINE Green */
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

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

.line-preview-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #a7f3d0;
  font-family: var(--font-family);
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-download-csv {
  width: 100%;
  padding: 12px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}

.btn-download-csv:active {
  background: var(--border-subtle);
}

.integration-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.integration-item:last-child {
  border-bottom: none;
}

.int-icon {
  font-size: 24px;
}

.int-info {
  flex: 1;
}

.int-info strong {
  font-size: 13px;
  display: block;
}

.int-info p {
  font-size: 11px;
  color: var(--text-dim);
}

/* ==================== BOTTOM NAV BAR ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: 64px;
  background: rgba(11, 15, 23, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 0;
  transition: all 0.2s;
}

.nav-icon {
  font-size: 20px;
  transition: transform 0.2s;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
}

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

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* ==================== LIGHTBOX MODAL ==================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.modal-body img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* ==================== TOAST NOTIFICATION ==================== */
.toast-bubble {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  z-index: 300;
  white-space: nowrap;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
