:root {
  --primary: #0B4F9C;
  --primary-dark: #073467;
  --primary-light: #e6f0fa;
  --accent: #10B981;
  --accent-dark: #059669;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --danger: #EF4444;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  padding-bottom: 90px;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(11, 79, 156, 0.15);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  max-width: 650px;
  margin: 0 auto;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.68rem;
  opacity: 0.85;
  line-height: 1.1;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .status-badge #systemStatusText {
    display: none;
  }
  .status-badge {
    padding: 6px;
    border-radius: 50%;
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22C55E;
  box-shadow: 0 0 8px #22C55E;
}

/* Header Controls */
.btn-menu-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-menu-toggle:active {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0.92);
}

.header-icon-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background 0.2s;
  flex-shrink: 0;
}

.header-icon-btn:active {
  background: rgba(255, 255, 255, 0.35);
}

/* Navigation Drawer (Side Menu) */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  display: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.open {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: white;
  z-index: 1001;
  box-shadow: 6px 0 30px rgba(0, 0, 0, 0.3);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 22px 18px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-brand {
  display: flex;
  flex-direction: column;
}

.drawer-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.drawer-close:active {
  background: rgba(255, 255, 255, 0.35);
}

.drawer-sap-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(34, 197, 94, 0.1);
  color: #15803D;
  border-bottom: 1px solid rgba(34, 197, 94, 0.2);
}

.drawer-menu-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.drawer-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin: 8px 10px 6px 10px;
}

.drawer-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 3px;
  transition: all 0.15s;
}

.drawer-item:hover {
  background: #F1F5F9;
}

.drawer-item:active {
  background: #E2E8F0;
  transform: scale(0.98);
}

.drawer-item.active {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
}

.drawer-item.active .drawer-title {
  color: var(--primary);
  font-weight: 800;
}

.drawer-icon {
  font-size: 1.3rem;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-text {
  flex: 1;
}

.drawer-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.drawer-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #F8FAFC;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
}

/* Desktop Top Tab Bar */
.tab-bar {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 12px;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  text-align: center;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: #F8FAFC;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  background: #EEF2F6;
  color: var(--text-main);
  border-color: #CBD5E1;
}

.tab-btn.active {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(11, 79, 156, 0.35);
}

/* Modern Bottom Navigation Dock (Mobile Primary Navigation) */
.bottom-dock-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  height: calc(56px + env(safe-area-inset-bottom, 0px));
}

.dock-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  color: #64748B;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
  min-width: 0;
  max-width: 16.66%;
}

.dock-icon-wrapper {
  width: 32px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-bottom: 1px;
  transition: all 0.15s ease;
}

.dock-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.dock-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
  padding: 0 1px;
}

.dock-btn:active .dock-icon {
  transform: scale(0.88);
}

.dock-btn.active {
  color: var(--primary);
}

.dock-btn.active .dock-icon-wrapper {
  background: var(--primary-light);
}

.dock-btn.active .dock-label {
  font-weight: 800;
  color: var(--primary);
}

.dock-icon-wrapper.pulse-badge {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: white;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.dock-btn.active .dock-icon-wrapper.pulse-badge {
  background: linear-gradient(135deg, #1D4ED8, #0B4F9C);
  box-shadow: 0 3px 10px rgba(11, 79, 156, 0.45);
}

/* Responsive Menu Switch: Mobile = Bottom Dock, Desktop = Top Tabs */
@media (max-width: 768px) {
  .tab-bar {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .bottom-dock-bar {
    display: none !important;
  }
  body {
    padding-bottom: 30px;
  }
  .tab-bar {
    display: flex;
    justify-content: center;
    position: sticky;
    top: 60px;
    z-index: 90;
  }
}

/* Dashboard Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, #0B4F9C, #1E40AF);
  color: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(11, 79, 156, 0.2);
}

.hero-greeting {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 0.82rem;
  opacity: 0.88;
  margin-top: 3px;
}

.hero-logo-badge {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.18);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.kpi-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-icon {
  font-size: 1.1rem;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Quick Actions Grid */
.quick-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-action-card:hover {
  border-color: #CBD5E1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.quick-action-card:active {
  transform: scale(0.98);
}

.quick-action-card.action-new-inv {
  border: 1.5px solid rgba(37, 99, 235, 0.3);
  background: linear-gradient(to right, #FFFFFF, rgba(37, 99, 235, 0.04));
}

.quick-action-card.action-cust-pay {
  border: 1.5px solid rgba(124, 58, 237, 0.3);
  background: linear-gradient(to right, #FFFFFF, rgba(124, 58, 237, 0.04));
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.quick-action-info {
  flex: 1;
}

.quick-action-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
}

.quick-action-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.quick-action-arrow {
  font-size: 1.1rem;
  color: #94A3B8;
  font-weight: 700;
}

/* Main Container */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* Section Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

/* Search and Inputs */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.search-box {
  position: relative;
}

.search-input, .text-input, .select-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  background: #FAFAFA;
}

.search-input:focus, .text-input:focus, .select-input:focus {
  border-color: var(--primary);
  background: #FFFFFF;
}

.btn-browse-customers {
  width: 100%;
  padding: 10px 12px;
  background: var(--primary-light);
  border: 1px solid rgba(11, 79, 156, 0.2);
  color: var(--primary-dark);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  transition: all 0.2s;
}

.btn-browse-customers:active {
  background: #d4e6f9;
}

/* Search Dropdown / Autocomplete */
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 340px;
  overflow-y: auto;
  z-index: 50;
  margin-top: 4px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.suggestion-item {
  padding: 12px 14px;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:active, .suggestion-item:hover {
  background: var(--primary-light);
}

.suggestion-main {
  font-weight: 600;
  font-size: 0.9rem;
}

.suggestion-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.suggestion-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

/* Selected Customer Card */
.selected-customer-box {
  background: var(--primary-light);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.customer-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.customer-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.change-btn {
  background: white;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Customer Quick Products List */
.customer-products-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.quick-product-card {
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* Card 1 (Even rows: #1, #3, #5...): Clean White with SAP Blue Accent Stripe */
.quick-product-card.card-regular {
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-left: 6px solid #0070F2;
}

/* Card 2 (Odd rows: #2, #4, #6...): Soft Slate/Ice Tint with Slate Accent Stripe */
.quick-product-card.card-alt {
  background: #F1F5F9;
  border: 1.5px solid #94A3B8;
  border-left: 6px solid #475569;
}

/* Card when quantity > 0: High-visibility Emerald Green highlight */
.quick-product-card.has-qty {
  background: #ECFDF5 !important;
  border: 2px solid #10B981 !important;
  border-left: 6px solid #059669 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2) !important;
}

/* Index Pill Badge (#1, #2...) */
.product-index-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.product-index-pill.pill-regular {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.product-index-pill.pill-alt {
  background: #E2E8F0;
  color: #334155;
  border: 1px solid #CBD5E1;
}

.quick-product-card.has-qty .product-index-pill {
  background: #A7F3D0;
  color: #065F46;
  border: 1px solid #6EE7B7;
}

.quick-product-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.quick-product-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  flex: 1;
}

.quick-product-price {
  text-align: right;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  flex-shrink: 0;
}

/* Bottom Quantity Bar: Visually enclosed inside the card so it cannot be mistaken for the next item! */
.quick-product-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.quick-product-card.has-qty .quick-product-bottom {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.quick-product-qty-info {
  display: flex;
  flex-direction: column;
}

/* Stepper Component */
.stepper-container {
  display: inline-flex;
  align-items: center;
  background: white;
  border: 1.5px solid #94A3B8;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.stepper-btn {
  width: 40px;
  height: 38px;
  background: #E2E8F0;
  border: none;
  font-size: 1.3rem;
  font-weight: 800;
  color: #1E293B;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.15s;
}

.stepper-btn:hover {
  background: #CBD5E1;
}

.stepper-btn:active {
  background: #94A3B8;
}

.stepper-input {
  width: 55px;
  height: 38px;
  border: none;
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  color: #0F172A;
  outline: none;
  background: white;
}

/* Custom Added Items */
.line-item-card {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.line-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.line-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.delete-btn {
  color: var(--danger);
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

.line-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.line-field label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 600;
}

.line-field input, .line-field select {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: right;
  background: white;
}

/* Add Item Button */
.btn-add-item {
  width: 100%;
  padding: 12px;
  background: white;
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.btn-add-item:active {
  background: var(--primary-light);
}

/* Totals Summary */
.summary-box {
  background: #F1F5F9;
  border-radius: 10px;
  padding: 12px 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.summary-row.grand-total {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  border-top: 1px solid #CBD5E1;
  padding-top: 8px;
  margin-top: 6px;
  margin-bottom: 0;
}

/* Big Action Button (Sticky Footer) */
.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  z-index: 95;
  display: flex;
  justify-content: center;
}

.footer-inner {
  max-width: 600px;
  width: 100%;
}

.btn-submit {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:disabled {
  background: #94A3B8;
  box-shadow: none;
  cursor: not-allowed;
}

/* Modal for Product Catalog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  background: white;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-close {
  background: #E2E8F0;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
}

.product-list {
  overflow-y: auto;
  flex: 1;
}

.product-item, .modal-product-item {
  padding: 14px 12px;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}

.product-item:active, .modal-product-item:active {
  background: var(--primary-light);
}

.stock-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: #E0F2FE;
  color: #0369A1;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 2px;
}

.special-price-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: #FEF3C7;
  color: #B45309;
  border-radius: 4px;
  font-weight: 700;
  margin-top: 2px;
}

/* History Card */
.history-card {
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.history-sub {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pdf-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

/* Responsive Desktop Improvements */
@media (min-width: 768px) {
  .container {
    max-width: 840px;
    padding: 24px 20px;
  }
  .app-header {
    padding: 16px 32px;
  }
  .modal-sheet {
    max-width: 700px !important;
    margin: 30px auto;
    border-radius: 16px !important;
  }
  .modal-overlay {
    align-items: center !important;
  }
  .lock-keypad {
    max-width: 320px;
  }
}

.btn-card-action {
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, opacity 0.15s;
}
.btn-card-action:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-period {
  border: 1.5px solid var(--border);
  background: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-period.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(11, 79, 156, 0.2);
}

/* Supplier Payments Styles */
.supplier-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid #D97706;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.1s, box-shadow 0.1s;
}

.supplier-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.open-invoice-card {
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s;
}

.open-invoice-card.selected {
  border-color: #059669;
  background: #F0FDF4;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12);
}

.open-invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.open-invoice-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.open-invoice-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px dashed #E2E8F0;
  border-bottom: 1px dashed #E2E8F0;
}

.open-invoice-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2px;
}

/* Sign-in screen */
.lock-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0B4F9C 0%, #073467 50%, #041E3D 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.lock-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lock-brand .lock-logo-icon {
  font-size: 2.6rem;
  margin-bottom: 6px;
}

.lock-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0B4F9C;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.lock-subtitle {
  font-size: 0.82rem;
  color: #64748B;
  margin-bottom: 20px;
}

.lock-footer {
  font-size: 0.72rem;
  color: #94A3B8;
  border-top: 1px solid #E2E8F0;
  padding-top: 12px;
}


/* Role visibility complements, and never replaces, server authorization. */
[hidden], #protectedApp[hidden] { display: none !important; }
body:not([data-user-role="Administrator"]) [data-permission="admin"],
body:not([data-user-role="Administrator"]):not([data-user-role="Accountant"]) [data-permission="finance"],
body:not([data-user-role="Administrator"]):not([data-user-role="Accountant"]):not([data-user-role="Sales"]) [data-permission="sales"] { display: none !important; }
.account-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.account-form .form-label { margin: 4px 0 0; }
.account-form .text-input { width: 100%; box-sizing: border-box; font-size: 16px; }
.account-form .btn-submit { margin-top: 8px; }
.account-status { min-height: 1.4em; margin: 8px 0; font-size: .85rem; line-height: 1.45; color: #0B4F9C; overflow-wrap: anywhere; }
#loginStatus { color: #9F1239; }
.account-help { margin: 0; color: var(--text-muted); font-size: .8rem; line-height: 1.5; }
.account-settings { overflow-y: auto; max-height: 90vh; max-height: 90dvh; }
.account-identity { font-weight: 700; overflow-wrap: anywhere; }
.account-section { padding: 10px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.account-section h2 { font-size: 1rem; margin-bottom: 12px; }
.account-section h3 { font-size: .95rem; margin: 20px 0 12px; }
.account-user-list { display: grid; gap: 12px; }
.account-user-card { display: flex; flex-direction: column; gap: 10px; background: #F1F5F9; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.account-user-card strong { overflow-wrap: anywhere; }
.account-user-card .form-label { display: flex; flex-direction: column; gap: 6px; }
.account-enabled { display: flex; gap: 8px; align-items: center; font-size: .85rem; }
.account-user-card .text-input { width: 100%; font-size: 16px; box-sizing: border-box; }
.account-logout { width: 100%; color: #B91C1C; }
.access-notice { position: fixed; top: 12px; left: 16px; right: 16px; z-index: 20000; background: #FFF1F2; color: #9F1239; border: 1px solid #FDA4AF; padding: 14px; border-radius: 10px; box-shadow: 0 4px 16px #0002; }
@media (max-height: 520px) { .lock-screen-overlay { align-items: flex-start; } .lock-card { margin: 12px 0; } }
