:root { --primary: #0f172a; --accent: #3b82f6; --bg: #f8fafc; --text: #334155; --border: #e2e8f0; }
  * { box-sizing: border-box; font-family: 'Inter', sans-serif; }
  body { margin: 0; background: var(--bg); color: var(--text); }
  
  /* Views & Modules */
  .view { display: none; }
  .view.active { display: block; }
  .module { display: none; height: 100%; overflow: hidden; }
  .module.active { display: block; }
  
  #location-select {
    background-color: #fffbeb; 
    border: 1px solid #fbbf24;
    font-weight: 600;
  }
/* Custom Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.modal-content { background: white; padding: 25px; border-radius: 8px; width: 100%; max-width: 320px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: popIn 0.15s ease-out; }
.modal-content h3 { margin-top: 0; margin-bottom: 5px; color: var(--primary); }
.modal-content input { text-align: left; font-size: 16px; margin-bottom: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; margin: 0; }
@keyframes popIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  /* Toast Notifications */
  #toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
  .toast { min-width: 250px; padding: 1.2rem; border-radius: 6px; color: white; font-size: 14px; font-weight: 600; line-height: 1.5; white-space: pre-line; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translateX(120%); animation: slideIn 0.3s forwards, fadeOut 0.3s forwards 4.7s; cursor: pointer; }
  .toast-success { background: #10b981; }
  .toast-error { background: #ef4444; }
  .toast-info { background: #3b82f6; }
  @keyframes slideIn { to { transform: translateX(0); } }
  @keyframes fadeOut { to { opacity: 0; transform: translateX(120%); } }


  .form-validation-summary {
    display: none;
    margin: 10px 0 4px;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
  }
  .form-validation-summary.visible { display: block; }
  input.field-invalid, select.field-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
  }

  /* Buttons & Inputs */
input, select { 
  width: 100%; 
  height: 46px; /* Matches Clover field height */
  padding: 0 12px; 
  box-sizing: border-box; 
  margin: 0.5rem 0; 
  border: 1px solid var(--border); 
  border-radius: 4px; 
  font-size: 14px;
}
  button { width: 100%; padding: 0.75rem; background: var(--accent); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 14px;}
  button:hover { background: #2563eb; }
  button:disabled { background: #94a3b8; cursor: not-allowed; }
  
  .btn-primary { background: var(--accent); color: white; }
  .btn-secondary { background: #e2e8f0; color: #334155; border: 1px solid #cbd5e1; }
  .btn-secondary:hover { background: #cbd5e1; }
  .btn-small { width: auto; padding: 0.4rem 1rem; margin-left: 10px; }

  /* Number Input Formatting (Removes arrows & right-aligns) */
  input[type="number"], .price-input {
    text-align: right;
    -webkit-appearance: none;
    -moz-appearance: textfield;
  }
  input[type="number"]::-webkit-outer-spin-button,
  input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  /* Cart Remove Button Link Style */
  .remove-btn-link {
    background: none !important;
    color: #ef4444 !important;
    border: none !important;
    padding: 0 !important;
    font-size: 12px !important;
    text-decoration: underline;
    cursor: pointer;
    width: auto !important;
    font-weight: 400 !important;
  }
  .remove-btn-link:hover { color: #dc2626 !important; }

  /* Layout */
  #main-view { display: flex; height: 100vh; }
  .sidebar { width: 220px; background: var(--primary); color: white; padding: 2rem 1rem; flex-shrink: 0;}
  .sidebar h2 { margin-top: 0; margin-bottom: 2rem; text-align: center; }
  .sidebar ul { list-style: none; padding: 0; margin: 0; }
  .sidebar li { padding: 1rem; cursor: pointer; border-bottom: 1px solid #1e293b; border-radius: 4px;}
  .sidebar li:hover { background: #1e293b; }
  
  .content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  .top-bar { display: flex; justify-content: space-between; align-items: center; background: white; padding: 1rem 2rem; border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
  .top-bar select { width: auto; margin: 0 0 0 10px; padding: 0.4rem; }

  /* Login */
  .login-card { max-width: 400px; margin: 100px auto; padding: 2rem; background: white; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

  /* POS Module */
  #pos-view { padding: 2rem; }
  .split-layout {
  display: flex;
  gap: 1.25rem;
  height: 100%;
  align-items: stretch;
}

.inventory-pane,
.cart-pane {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Gives inventory about 55% and cart about 45% */
.inventory-pane {
  flex: 1.25 1 0;
}

.cart-pane {
  flex: 1 1 0;
  min-width: 520px;
}

#cart-items {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 1rem;
}

/* Smaller screens, keep it usable instead of smashing the cart */
@media (max-width: 1100px) {
  .split-layout {
    flex-direction: column;
    overflow-y: auto;
  }

  .inventory-pane,
  .cart-pane {
    min-width: 100%;
  }

  #cart-items {
    max-height: 360px;
  }
}
  
  .inventory-pane h3, .cart-pane h3 { margin-top: 0; margin-bottom: 1rem; }
  #inventory-search { margin-bottom: 1rem; }
  #inventory-list { flex: 1; overflow-y: auto; padding-right: 10px; }
  #cart-items { flex: 1; overflow-y: auto; margin-bottom: 1rem; }
  
  .item-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
  .item-row:last-child { border-bottom: none; }
  .price-input { width: 80px; padding: 0.4rem; margin: 0; }
  
  .totals p { margin: 0.5rem 0; display: flex; justify-content: space-between; }
  .totals h3 { margin: 1rem 0; display: flex; justify-content: space-between; border-top: 2px solid var(--primary); padding-top: 1rem;}

  /* Estimates Module */
  #estimates-view { padding: 2rem; overflow-y: auto; }
  .estimates-wrapper { display: flex; gap: 2rem; align-items: flex-start; overflow-x: auto; padding-bottom: 1rem; }
  .estimate-col { flex: 1; min-width: 280px; background: white; padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
  
  .estimate-col h3 { font-size: 16px; color: var(--primary); margin: 0; }
  .estimate-col button[onclick^="clearEst"] { border-radius: 4px; transition: all 0.2s ease; }
  .estimate-col button[onclick^="clearEst"]:hover { background: #e2e8f0 !important; color: #0f172a !important; }
  
  .est-input-row, .est-add-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 1rem; }
  .est-input-row input { width: 120px; margin: 0; }
  .est-add-row input[type="text"] { margin: 0; flex: 1; }
  .est-add-row button { width: auto; min-width: 40px; margin: 0; }
  
  .est-items-container { flex: 1; min-height: 150px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0.5rem; margin-bottom: 1rem; overflow-y: auto;}
  .est-item { display: flex; justify-content: space-between; font-size: 13px; padding: 0.4rem 0; border-bottom: 1px solid #e2e8f0; }
  .est-item:last-child { border-bottom: none; }
  
  .est-totals-box { border-top: 2px solid var(--primary); padding-top: 1rem; }
  .est-total-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-weight: 600; }
  .est-total-row.highlight { color: var(--accent); font-size: 1.1em; }

  /* History & Admin Modules */
  #transactions-view, #admin-view { padding: 2rem; overflow-y: auto; }
  .history-wrapper, .admin-wrapper { background: white; padding: 2rem; border-radius: 8px; border: 1px solid var(--border); height: 100%; display: flex; flex-direction: column; }
  .history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
  .history-header h2 { margin: 0; }
  .history-header input { width: 300px; margin: 0; }
  
  .table-container { flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; }
  .data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
  .data-table th { background: var(--bg); padding: 1rem; position: sticky; top: 0; border-bottom: 2px solid var(--border); }
  .data-table td { padding: 1rem; border-bottom: 1px solid var(--border); }
  
  /* Utilities */
  .loader { display: none; border: 4px solid #f3f3f3; border-top: 4px solid var(--accent); border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; margin: 10px auto; }
  @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

  /* Prevent split payment controls from crushing the Current Cart list */
.cart-pane {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Do not let the cart list collapse into a tiny strip */
#cart-items {
  flex: 0 0 auto !important;
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  border-bottom: 1px solid #e2e8f0;
}

/* Keep totals and checkout controls from fighting the cart item area */
.totals,
.payment-controls {
  flex-shrink: 0;
}

/* Make split payment preview more compact */
#split-payment-container {
  padding: 10px !important;
  margin-bottom: 8px !important;
}

#split-payment-container input,
#split-payment-container select {
  min-height: 34px;
}

#split-payment-container > div:last-child {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
  row-gap: 4px;
}

#split-payment-container > div:last-child > div {
  margin: 0 !important;
}

/* Keep the final card total line full width */
#split-payment-container > div:last-child > div:last-child {
  grid-column: 1 / -1;
}

.cart-pane.split-active #cart-items {
  min-height: 220px;
  max-height: 320px;
}

.cart-pane.split-active {
  padding-bottom: 12px;
}

/* Open Orders / Saved Cards */
.open-orders-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1.25rem;
  height: 100%;
}

.open-orders-pane,
.open-order-pay-pane {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-y: auto;
  min-width: 0;
}

.selected-open-order-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  color: #475569;
}

.open-order-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
}

.open-order-card:hover {
  background: #f8fafc;
}

.open-order-card.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.saved-card-row {
  border: 1px solid #e2e8f0;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fff;
}


.save-card-consent-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.save-card-consent-row input {
  width: auto;
  margin: 0;
}

#open-orders-view {
  padding: 2rem;
  overflow: hidden;
}

#open-orders-view.active {
  display: block;
}

.open-orders-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1.25rem;
  height: 100%;
}

.open-orders-pane,
.open-order-pay-pane {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-y: auto;
  min-width: 0;
}

.clover-field {
  background: #fff;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px;
}

.save-card-consent-note {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 8px;
}

@media (max-width: 1100px) {
  .open-orders-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

/* Secure Clover card field layout cleanup */
.open-card-box {
  background: #f8fafc;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  margin-top: 10px;
}

.open-card-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 5px 0;
}

/* Universal Secure Clover Field Layout */
.clover-field {
  height: 46px !important;
  min-height: 46px !important;
  max-height: 46px !important;
  width: 100% !important;
  background: #fff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px !important;
  padding: 0 !important; /* Kills the dead zone */
  margin: 0 !important;
  overflow: hidden !important;
  display: block !important;
}

/* Forces iframe to fill the entire box making it fully clickable */
.clover-field iframe {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  border: 0 !important;
  overflow: hidden !important;
  display: block !important;
}

.open-card-box > div[style*="display:flex"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px !important;
  margin-top: 10px !important;
}

.open-card-box > div[style*="display:flex"] > div {
  min-width: 0;
}

@media (max-width: 900px) {
  .open-card-box > div[style*="display:flex"] {
    grid-template-columns: 1fr;
  }
}
.open-order-card {
  transition: background 0.15s ease, border-color 0.15s ease;
}

.open-order-card strong {
  word-break: break-word;
}

.selected-open-order-box {
  color: #0f172a;
}

.card-vault-layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1.25rem;
  height: 100%;
}

.card-vault-pane {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-y: auto;
  min-width: 0;
}

@media (max-width: 1100px) {
  .card-vault-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}
/* Quick Pay / Kiosk Mode */
.quickpay-shell {
  min-height: 100vh;
  padding: 18px;
  background: #f8fafc;
}

.quickpay-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin: 80px auto;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.quickpay-topbar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quickpay-topbar select {
  width: auto;
  min-width: 220px;
  margin: 0;
}

.quickpay-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  height: calc(100vh - 95px);
}

.quickpay-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-y: auto;
}

.quickpay-order-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
}

.quickpay-order-card:hover {
  background: #f8fafc;
}

.quickpay-order-card.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.quickpay-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 1100px) {
  .quickpay-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .quickpay-topbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .quickpay-topbar select,
  .quickpay-topbar button {
    width: 100% !important;
  }
}
