﻿@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700;800&display=swap");

:root {
  --font-heading: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Sleek Dark Mode Palette (Default) */
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  
  --text-primary: #ffffff;
  --text-secondary: #aeaeae;
  --text-muted: #8e8e93;
  
  --accent-primary: #0a84ff; /* Indigo -> Blue */
  --accent-primary-hover: #0064d2;
  --accent-secondary: #ff375f;
  --accent-success: #30d158; /* Emerald -> Green */
  --accent-warning: #ff9f0a; /* Amber -> Orange */
  --accent-danger: #ff453a; /* Red */
  
  --border-color: #1c1c1e;
  --border-color-light: #2c2c2e;
  --glass-bg: rgba(28, 28, 30, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --key-bg: #1c1c1e;
  --key-bg-hover: #2c2c2e;
  --key-bg-active: #3a3a3c;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 15px rgba(10, 132, 255, 0.25);
  --keyboard-bg: #000000;
}

[data-theme="light"] {
  /* Elegant Light Mode Palette */
  --bg-primary: #ffffff;
  --bg-secondary: #f2f2f7;
  --bg-tertiary: #e5e5ea;
  
  --text-primary: #000000;
  --text-secondary: #3a3a3c;
  --text-muted: #8e8e93;
  
  --accent-primary: #007aff;
  --accent-primary-hover: #0056b3;
  --accent-secondary: #ff2d55;
  --accent-success: #34c759;
  --accent-warning: #ff9500;
  --accent-danger: #ff3b30;
  
  --border-color: #e5e5ea;
  --border-color-light: #d1d1d6;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.08);
  
  --shadow-glow: 0 0 15px rgba(0, 122, 255, 0.15);
  --keyboard-bg: #ffffff;
  
  --key-bg: #f2f2f7;
  --key-bg-hover: #e5e5ea;
  --key-bg-active: #d1d1d6;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
}

/* Layout Utilities */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem 0.25rem 1rem;
  background: var(--bg-primary);
  border-bottom: none;
  z-index: 10;
}

.btn-share-app {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-light);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-share-app:active {
  background: var(--bg-tertiary);
  transform: scale(0.96);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  height: 28px;
  width: 28px;
  object-fit: contain;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
}

.status-indicator.offline {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.tab-content-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.tab-pane {
  display: none;
  flex: 1;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
  flex: 1;
  animation: fadeIn 0.25s ease-out;
}

/* Bottom Navigation Bar */
.bottom-nav {
  height: auto;
  min-height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 0.75rem;
  gap: 3px;
  border: none;
  background: none;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
  transition: transform 0.2s;
}

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

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

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


/* Auth Screen Styles */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}
.auth-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  outline: none;
}
.auth-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}
.auth-view {
  display: none;
  flex-direction: column;
  gap: 1rem;
}
.auth-view.active {
  display: flex;
}
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  width: 100%;
}
.google-btn:hover {
  background: #f9fafb;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.google-btn svg {
  width: 18px;
  height: 18px;
}
.auth-link {
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  align-self: flex-end;
  transition: color 0.2s;
}
.auth-link:hover {
  color: var(--accent-primary-hover);
}
.auth-info-box {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 1rem;
  text-align: left;
}

/* Profile Tab Styles */
.profile-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: fadeIn 0.25s ease-out;
  padding-bottom: 1rem;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-primary-hover), #7c3aed);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color-light);
}

.btn-success {
  background-color: var(--accent-success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: transparent;
  color: var(--accent-danger);
  border: 1px solid var(--accent-danger);
}

.btn-danger:hover {
  background-color: var(--accent-danger);
  color: white;
}

/* Form Fields */
.input-field {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  outline: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.input-field:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 1rem;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.close-btn:hover {
  color: var(--text-primary);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 1. Calculator Styles */
.calculator-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  justify-content: space-between;
}

.calc-top-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 1;
  min-height: 0;
  overflow: hidden;
}

.calc-display-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  overflow-y: auto;
  min-height: 120px;
}

.calc-current-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.25rem 1rem;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
  padding: 0.25rem 0;
}

.calc-math-preview {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-family: monospace;
}

.calc-total-result {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: monospace;
}

.calc-cart-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.cart-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.cart-item-details {
  display: flex;
  flex-direction: column;
}

.cart-item-name {
  font-weight: 700;
  color: var(--text-primary);
}

.cart-item-math {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.cart-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-item-total {
  font-weight: 800;
  color: var(--accent-success);
  font-family: monospace;
}

.cart-item-remove {
  color: var(--accent-danger);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  padding: 4px;
}

/* Input Fields Grid (Focus targets) */
.calc-fields-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: clamp(0.3rem, 1.5vh, 0.5rem) 1rem;
  flex-shrink: 0;
}

.calc-fields-row-group {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1.2fr;
  gap: 0.5rem;
}

.calc-field-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: clamp(4px, 1.2vh, 7px) 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.calc-field-box.amount-box {
  background: rgba(0, 0, 0, 0.08);
  cursor: default;
  border-style: dashed;
  border-color: var(--border-color);
}

.calc-field-box.amount-box .calc-field-value {
  color: var(--accent-success);
  font-weight: 700;
}

.calc-name-box-full {
  width: 100%;
}

.calc-field-box.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.calc-field-label {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}

.calc-field-value {
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 800;
  color: var(--text-primary);
  outline: none;
  border: none;
  background: transparent;
  width: 100%;
  font-family: monospace;
}

/* Name field is now full width */

/* Keypad Section */
.keyboard-section {
  background-color: var(--keyboard-bg);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem 0 max(0.75rem, env(safe-area-inset-bottom)) 0; /* Full-width borders and dividers */
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

.keypad-grid-container {
  display: grid;
  grid-template-columns: 3fr 1.2fr;
  gap: 0.5rem;
}

/* Utility bar grouped Clock, Ruler, Radical icons on left and Backspace on right */
.numpad-utility-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.25rem 1rem 0.5rem 1rem;
}

.utility-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 50%;
}

.utility-btn:active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

[data-theme="light"] .utility-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

.utility-btn.backspace-btn {
  margin-left: auto; /* Push backspace to the far right */
}

.keyboard-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-color-light);
  margin: 0; /* Full width */
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center; /* Center buttons horizontally */
  align-items: center; /* Center buttons vertically */
  gap: clamp(0.5rem, 2vh, 0.85rem);
  padding: 0 1rem;
}

.keypad-btn {
  background: var(--key-bg);
  border: none;
  color: var(--text-primary);
  font-size: clamp(1.35rem, 4.5vw, 1.7rem);
  font-weight: 700; /* Sleek elegant font like screenshot */
  border-radius: 50%;
  width: clamp(48px, 12.5vw, 68px); /* Slightly larger for 3-column layout */
  height: clamp(48px, 12.5vw, 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s ease, filter 0.1s ease;
  font-family: var(--font-body);
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
}



.keypad-btn.op-mul {
  background: var(--accent-warning) !important;
  color: #ffffff !important;
  font-weight: 600;
}

.keypad-btn.op-mul:active {
  filter: brightness(0.85);
}

.keypad-btn:active {
  background: var(--key-bg-active);
}

.keypad-btn.op-clear,
.keypad-btn.op-all-clear {
  color: #ff453a !important; /* Red text for C/AC */
  background: var(--key-bg);
}

.keypad-btn.op-equal {
  background: #4a4a4a !important; /* Medium grey checkout */
  color: #ffffff !important;
  font-weight: 500;
}

.keypad-btn.op-equal:active {
  background: #5a5a5a !important;
}

.keypad-btn.op-add {
  background: var(--key-bg); /* Use same standard background as other operators */
  color: var(--text-primary);
  font-weight: 400;
}

.keypad-btn.op-add:active {
  background: var(--key-bg-active);
}

/* Presets side block */
.presets-column {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 190px;
  overflow-y: auto;
}

.preset-pill {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.preset-pill:active {
  background: var(--border-color);
}

/* Action Keys */
.action-keys-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding: 0 1rem;
}

.action-btn {
  flex: 1;
  padding: clamp(0.65rem, 2vh, 1rem);
  font-size: clamp(0.9rem, 3.5vw, 1.05rem);
  font-weight: 800;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  min-height: clamp(44px, 7vh, 56px);
  touch-action: manipulation;
}

.action-btn.next {
  background: #ffcc00; /* Brand Yellow */
  color: #000000;
  box-shadow: 0 4px 10px rgba(255, 204, 0, 0.2);
}

.action-btn.next:active {
  background: #e6b800;
}

.action-btn.done {
  background: var(--accent-success);
  color: white;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.action-btn.done:active {
  filter: brightness(0.85);
}

/* 2. Dashboard Styles */
.dashboard-pane {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  overflow-y: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: monospace;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value.profit {
  color: var(--accent-success);
}

.dashboard-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}

.dashboard-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.search-container {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  padding-left: 2.2rem;
}

.invoices-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.invoice-item-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}

.invoice-item-card:hover {
  border-color: var(--border-color-light);
}

.invoice-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-id-line {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.invoice-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.invoice-items-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.invoice-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.invoice-total-amount {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent-success);
  font-family: monospace;
}

.invoice-actions {
  display: flex;
  gap: 6px;
}

.invoice-action-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.invoice-action-btn:active {
  background: var(--border-color-light);
}

.invoice-action-btn.delete {
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.15);
  background: rgba(239, 68, 68, 0.02);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
  padding: 3rem 1rem;
  text-align: center;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.01);
}

/* 3. Settings Styles */
.settings-pane {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: 100%;
  overflow-y: auto;
}

.settings-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.settings-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.settings-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Custom Switches */
.switch-control {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-tertiary);
  transition: .2s;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-primary);
  transition: .2s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--accent-primary);
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* Margin controls */
.margin-control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.margin-input {
  width: 70px;
  text-align: center;
  font-weight: 700;
}

/* Toast Notifications styling overlay */
.toast-container {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.3s ease-out forwards;
  margin-bottom: 6px;
}

.toast.success {
  border-color: var(--accent-success);
  background: rgba(16, 185, 129, 0.08);
}

.toast.error {
  border-color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.08);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Receipt View Layout */
.receipt-paper {
  background: white;
  color: black;
  font-family: "Courier New", Courier, monospace;
  padding: 1.5rem 1rem;
  width: 100%;
  box-shadow: 0 0 10px rgba(0,0,0,0.15);
  font-size: 0.85rem;
  line-height: 1.4;
}

.receipt-header {
  text-align: center;
  margin-bottom: 1rem;
}

.receipt-logo {
  height: 40px;
  margin-bottom: 4px;
}

.receipt-title {
  font-size: 1.25rem;
  font-weight: bold;
}

.receipt-divider {
  border-top: 1px dashed black;
  margin: 0.5rem 0;
}

.receipt-info-row {
  display: flex;
  justify-content: space-between;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
}

.receipt-table th {
  border-bottom: 1px dashed black;
  text-align: left;
  font-weight: bold;
}

.receipt-table td, .receipt-table th {
  padding: 4px 0;
}

.receipt-totals {
  margin-top: 0.5rem;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.receipt-totals-row {
  display: flex;
  justify-content: space-between;
}

.receipt-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
}

/* Print styles override */
@media print {
  body, .app-container {
    background: white !important;
    color: black !important;
    max-width: 100% !important;
    border: none !important;
    height: auto !important;
    overflow: visible !important;
  }
  .app-header, .bottom-nav, .tab-content-container, .modal-overlay {
    display: none !important;
  }
  .print-only-container {
    display: block !important;
    width: 100% !important;
  }
}

.print-only-container {
  display: none;
}

/* Cart running total header */
.calc-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1.5px solid var(--border-color);
}

.cart-count-badge {
  font-size: 0.85rem;
}

/* Grand Total POS Screen */
.grand-total-screen {
  background: linear-gradient(145deg, #0d1f3c 0%, #1a2d4a 60%, #0f2a3d 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-xl);
  padding: clamp(0.6rem, 2.5vh, 1.25rem) 1.25rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(16, 185, 129, 0.12), inset 0 1px 0 rgba(255,255,255,0.04);
  margin: clamp(0.35rem, 1.5vh, 0.75rem) 1rem clamp(0.25rem, 1vh, 0.5rem) 1rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.grand-total-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(16,185,129,0.5), transparent);
}
.grand-total-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.03) 3px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
}
.grand-total-screen:active {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 28px rgba(16, 185, 129, 0.22), inset 0 1px 0 rgba(255,255,255,0.04);
}
.grand-total-left {
  display: flex;
  flex-direction: column;
  gap: 0px;
}
.grand-total-screen .screen-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: rgba(16,185,129,0.65);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1px;
}
.grand-total-screen .screen-value {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  color: #4ade80;
  font-family: 'Outfit', monospace;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.35);
  letter-spacing: -2px;
}
.grand-total-screen .screen-value .currency-symbol {
  font-size: clamp(1.25rem, 5vw, 2rem);
  margin-right: 1px;
  opacity: 0.75;
  letter-spacing: 0;
}
.grand-total-screen .screen-subtext {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(148,163,184,0.8);
  display: flex;
  align-items: center;
  gap: 5px;
}
.grand-total-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 1;
}
.grand-total-badge {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  color: #4ade80;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: monospace;
  letter-spacing: 0.5px;
}
.grand-total-tap-hint {
  font-size: 0.65rem;
  color: rgba(148,163,184,0.5);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

[data-theme="light"] .grand-total-screen {
  background: linear-gradient(145deg, #0f2d20 0%, #1a3d2b 60%, #0d2a1c 100%);
}

/* ===== Responsive: compact screen (short phones) ===== */
@media screen and (max-height: 640px) {
  .grand-total-screen {
    margin: 0.35rem 0.75rem 0.25rem 0.75rem;
    padding: 0.55rem 1rem;
  }
  .grand-total-screen .screen-value {
    font-size: clamp(1.75rem, 7.5vw, 2.5rem);
    margin-bottom: 2px;
  }
  .grand-total-screen .screen-label {
    font-size: 0.55rem;
    margin-bottom: 0;
  }
  .grand-total-screen .screen-subtext {
    font-size: 0.65rem;
  }
  .grand-total-badge {
    font-size: 0.68rem;
    padding: 3px 8px;
  }
  .grand-total-tap-hint {
    font-size: 0.58rem;
  }
  .calc-fields-grid {
    padding: 0.25rem 0.75rem;
    gap: 0.25rem;
  }
  .calc-field-box {
    padding: 3px 8px;
  }
  .calc-field-label {
    font-size: 0.52rem;
  }
  .calc-field-value {
    font-size: 0.95rem;
  }
  .keyboard-section {
    padding: 0.35rem 0 max(0.5rem, env(safe-area-inset-bottom)) 0;
    gap: 0.3rem;
  }
  .numpad-grid {
    gap: 0.22rem;
    padding: 0 0.75rem;
  }
  .numpad-utility-bar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .keypad-btn {
    font-size: 1.25rem;
  }
  .action-keys-row {
    margin-top: 0.15rem;
    padding: 0 0.75rem;
  }
  .action-btn {
    padding: 0.6rem;
    min-height: 40px;
    font-size: 0.88rem;
  }
}

@media screen and (max-height: 500px) {
  .grand-total-screen .screen-value {
    font-size: 1.6rem;
  }
  .grand-total-screen {
    padding: 0.4rem 0.75rem;
    margin: 0.25rem 0.75rem;
  }
  .keypad-btn {
    font-size: 1.1rem;
  }
  .action-btn {
    min-height: 36px;
    padding: 0.5rem;
    font-size: 0.82rem;
  }
}


/* Input fields inline backspace button */
.calc-field-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.calc-field-input-row .calc-field-value {
  flex: 1;
  min-width: 0;
}

.btn-field-backspace {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.1s ease;
}

.btn-field-backspace:active {
  color: var(--accent-danger);
  transform: scale(0.9);
}

.calc-field-box.active .btn-field-backspace {
  display: flex;
}

/* 4x4 grid double-height multiply and cart key styling */
.keypad-btn.double-height {
  grid-row: span 2;
  height: 100%;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 40px;
}

.keypad-btn.op-cart {
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent-primary);
}

.keypad-btn.op-cart:active {
  background: rgba(10, 132, 255, 0.25);
  transform: scale(0.96);
}

[data-theme="light"] .keypad-btn.op-cart {
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent-primary);
}

[data-theme="light"] .keypad-btn.op-cart:active {
  background: rgba(0, 122, 255, 0.2);
}

/* PWA Install Button Header styling */
.btn-install-app {
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: none; /* Hidden by default, shown by JS prompt availability */
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-install-app:active {
  background: var(--accent-primary-hover);
  transform: scale(0.96);
}

/* Settings Sub-page navigation system */
.settings-sub-page {
  display: none;
  flex-direction: column;
  animation: slideIn 0.25s cubic-bezier(0.1, 0.76, 0.55, 0.94);
  height: 100%;
}

.settings-sub-page.active {
  display: flex;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.settings-tiles-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.settings-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s;
}

.settings-tile:active {
  background: var(--bg-tertiary);
  transform: scale(0.98);
}

.settings-tile-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Diverse colors for icons to look extremely premium */
.icon-profit {
  background: rgba(48, 209, 88, 0.12);
  color: var(--accent-success);
}
.icon-printer {
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent-primary);
}
.icon-theme {
  background: rgba(255, 159, 10, 0.12);
  color: var(--accent-warning);
}
.icon-support {
  background: rgba(191, 90, 242, 0.12);
  color: #bf5af2;
}
.icon-reset {
  background: rgba(255, 69, 58, 0.12);
  color: var(--accent-danger);
}

.settings-tile-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.settings-tile-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-tile-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.settings-tile-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.sub-page-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.25rem 1rem 0.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  position: relative;
}

.sub-page-back {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}

.sub-page-back:active {
  opacity: 0.6;
}

.sub-page-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  pointer-events: none;
  font-family: var(--font-heading);
}

/* Dashboard Charts Subpage Styling */
.dashboard-sub-page {
  display: none;
  flex-direction: column;
  height: 100%;
  animation: slideIn 0.25s cubic-bezier(0.1, 0.76, 0.55, 0.94);
}

.dashboard-sub-page.active {
  display: flex;
}

.dashboard-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.pane-title-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.btn-dashboard-charts {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-light);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-dashboard-charts:active {
  background: var(--bg-tertiary);
  transform: scale(0.96);
}

.date-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  margin-bottom: 1rem;
  gap: 12px;
}

.filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-select {
  max-width: 150px;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 12px;
  border: 1px solid var(--border-color-light);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.chart-type-tabs {
  display: flex;
  gap: 6px;
  padding: 0 1rem;
  margin-bottom: 1rem;
}

.chart-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-light);
  color: var(--text-secondary);
  padding: 8px 6px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chart-tab-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

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

.chart-container-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin: 0 1rem 1.5rem 1rem;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ==========================================================================
   PREMIUM FEATURES & PRICING
   ========================================================================== */
.pricing-card:hover {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}
.pricing-card.selected {
  border-color: var(--accent-primary) !important;
  background: rgba(99, 102, 241, 0.05) !important;
}
.pricing-card.selected .pricing-card-badge {
  visibility: visible !important;
}

.premium-lockscreen {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.premium-badge-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 0.5px;
}
