:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-dark: #0f1555;
  --secondary: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #a19316;
  --info: #0891b2;

  --background: #f4f7fc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1f2937;
  --muted: #64748b;

  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 15px 35px rgba(15, 23, 42, 0.13);
  --radius: 18px;
  
  /* Focus ring for keyboard */
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.4);
  --focus-ring-offset: 2px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  padding: 25px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.1), transparent 30%),
    linear-gradient(135deg, #f8fbff, var(--background));
  overflow-x: hidden;
}

/* ============================================================
   FOCUS VISIBLE - Keyboard Navigation
   ============================================================ */

/* Show focus only when using keyboard */
*:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to main content link (accessibility) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border-radius: 0 0 8px 8px;
  z-index: 10000;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  width: 100%;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: slideInRight 0.4s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.hide {
  transform: translateX(100%);
  opacity: 0;
}

.toast-success {
  background: var(--success);
  border-left: 4px solid #0b7a33;
}

.toast-error {
  background: var(--danger);
  border-left: 4px solid #991b1b;
}

.toast-warning {
  background: var(--warning);
  border-left: 4px solid #b45309;
}

.toast-info {
  background: var(--info);
  border-left: 4px solid #0e7490;
}

.toast-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-weight: 700;
  font-size: 15px;
}

.toast-message {
  font-weight: 400;
  opacity: 0.9;
  font-size: 13px;
}

.toast-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.toast-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* ============================================================
   HEADER
   ============================================================ */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  margin-bottom: 24px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
}

.hero h1 {
  margin: 0;
  color: var(--primary);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0.3px;
}

.hero p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.hero small {
  display: block;
  margin-top: 5px;
  color: #94a3b8;
  font-size: 12px;
}

.hero-right {
  display: flex;
  align-items: center;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.45);
    opacity: 0.55;
  }
}

/* ============================================================
   CARDS & FORM
   ============================================================ */

.form-card {
  padding: 20px;
  margin-bottom: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-title {
  padding-bottom: 11px;
  margin-bottom: 18px;
  color: var(--primary);
  border-bottom: 2px solid #eef2ff;
  font-size: 18px;
  font-weight: 750;
}

.form-grid {
  display: grid;
  grid-template-columns: 3fr 2fr 1fr;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  margin-bottom: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

/* Customer & Summary Row */
.customer-summary-row {
  display: flex;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 20px;
}

.customer-summary-row .form-card {
  flex: 1 1 auto;
  margin-bottom: 0;
}

/* ============================================================
   INPUTS & SELECTS
   ============================================================ */

label {
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  height: 44px;
  min-width: 0;
  padding: 0 14px;
  color: var(--text);
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9ca3af;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: var(--focus-ring);
}

input:disabled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#payment {
  max-width: 180px;
}

/* ============================================================
   ITEM SECTION
   ============================================================ */

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 15px;
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.form-row > input {
  flex: 1 1 220px;
}

/* ============================================================
   SUMMARY
   ============================================================ */

#summaryRow {
  width: 310px;
  flex: 0 0 310px;
  padding: 17px 20px;
  color: #1f2937;
  background: linear-gradient(135deg, #f1f8e9, #fbfff8);
  border: 1px solid #c5e1a5;
  border-left: 6px solid var(--primary);
  border-radius: 15px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#summaryRow > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(51, 105, 30, 0.15);
}

#summaryRow > div:last-child {
  border-bottom: none;
}

#summaryRow span {
  color: #1e293b;
  font-weight: 800;
}

#summaryRow strong {
  text-align: right;
  min-width: 80px;
}

#prevBalance,
#remainingBalance {
  min-width: 82px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
}

/* ============================================================
   STOCK DISPLAY
   ============================================================ */

.stock-display {
  display: block !important;
  order: 100;
  width: 100%;
  padding: 11px 13px;
  margin-top: 5px;
  color: #166534;
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 650;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  min-height: 42px;
  padding: 0 18px;
  color: #ffffff;
  border: none;
  border-radius: 9px;
  box-shadow: 0 3px 9px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.btn-create {
  background: var(--success);
}

.btn-clear,
.btn-delete {
  background: var(--danger);
}

.btn-add {
  position: relative;
  overflow: hidden;
  background: var(--secondary);
}

.btn-print {
  background: var(--warning);
}

.btn-delete {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
}

#addItemBtn {
  min-width: 140px;
  color: #22222 !important;
  background: var(--secondary) !important;
}

#addItemBtn.loading {
  background: var(--secondary) !important;
  color: transparent !important;
}

#addItemBtn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-add.loading {
  color: transparent;
}

.btn-add.loading::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   INVOICE TABLE
   ============================================================ */

#invoiceTable thead {
  display: table-header-group !important;
  visibility: visible !important;
}

#invoiceTable thead tr {
  display: table-row !important;
}

#invoiceTable th {
  display: table-cell !important;
  visibility: visible !important;
  padding: 12px 10px !important;
  color: #ffffff !important;
  background: #1a237e !important;
  border-bottom: 1px solid #0f172a !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

table {
  width: 100%;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 12px 10px;
  text-align: center;
  border: none;
  border-bottom: 1px solid #e8edf3;
}

th {
  color: #ffffff;
  background: var(--primary);
  font-size: 13px;
  font-weight: 750;
}

tbody tr {
  transition: background 0.18s ease;
}

tbody tr:nth-child(even) {
  background: #fafcff;
}

tbody tr:hover {
  background: #f0f5ff;
}

tbody tr:last-child td {
  border-bottom: none;
}

td[contenteditable="true"] {
  cursor: text;
  font-weight: 650;
}

td[contenteditable="true"]:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -2px;
  background: #eff6ff;
}

td[contenteditable="true"]:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: -2px;
}

/* ============================================================
   FLOATING ACTION MENU
   ============================================================ */

.floating-buttons {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.fab {
  width: 54px;
  height: 54px;
  color: #ffffff;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  font-size: 22px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.fab:hover {
  background: var(--primary-light);
  transform: scale(1.06);
}

.fab:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}

.fab-actions {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.fab-actions.open {
  display: flex;
}

.fab-actions .btn {
  min-width: 150px;
}

#menuBtn.fab {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 54px !important;
  height: 54px !important;
  padding: 0 !important;
  color: #ffffff !important;
  background: #1a237e !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25) !important;
  font-size: 24px !important;
  line-height: 1 !important;
}

#menuBtn.fab:hover {
  background: #3949ab !important;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */

#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(3px);
}

.loading-box {
  min-width: 280px;
  padding: 32px;
  text-align: center;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 17px;
  border: 5px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-box p {
  margin-top: 10px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 750;
}

/* ============================================================
   INVOICE PREVIEW
   ============================================================ */

#invoicePreview {
  margin-top: 30px;
  margin-bottom: 55px;
}

/* ============================================================
   AUTHENTICATION & MAIN MENU
   ============================================================ */

.auth-screen {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, #dbeafe 0, transparent 35%),
    radial-gradient(circle at bottom right, #e0e7ff 0, transparent 35%),
    #f8fafc;
  z-index: 5000;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 38px 34px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(15,23,42,.15);
  text-align: center;
  animation: authAppear .4s ease;
}

@keyframes authAppear {
  from {
    opacity: 0;
    transform: translateY(15px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-logo img {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 8px 25px rgba(0,0,0,.12);
}

.auth-card h1 {
  margin: 18px 0 4px;
  font-size: 30px;
  color: #1a237e;
}

.auth-subtitle {
  margin-bottom: 28px;
  color: #64748b;
  font-size: 14px;
}

.auth-form {
  text-align: left;
}

.auth-form label {
  display: block;
  margin: 14px 0 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  max-width: none;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 14px;
  transition: .2s ease;
}

.auth-form input:focus {
  background: #fff;
  border-color: #2563eb;
  box-shadow: var(--focus-ring);
}

.auth-login-btn {
  width: 100%;
  height: 48px;
  margin-top: 24px;
  border: 0;
  border-radius: 10px;
  background: #1a237e;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}

.auth-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(26,35,126,.25);
}

.auth-login-btn:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.auth-message {
  min-height: 22px;
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.auth-message.error {
  color: #dc2626;
}

.dashboard-lock {
  margin-top: 15px;
  font-size: 36px;
}

.dashboard-login-btn {
  background: #166534;
}

.back-menu-btn {
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: white;
  color: #475569;
  font-weight: 700;
  cursor: pointer;
}

.back-menu-btn:hover {
  background: #f8fafc;
}

/* ============================================================
   MAIN MENU
   ============================================================ */

.main-menu-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background:
    radial-gradient(circle at top left, #dbeafe 0, transparent 35%),
    radial-gradient(circle at bottom right, #e0e7ff 0, transparent 35%),
    #f8fafc;
}

.menu-container {
  width: 100%;
  max-width: 900px;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 45px;
}

.menu-header img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 17px;
}

.menu-header h1 {
  margin: 0;
  text-align: left;
  font-size: 32px;
  color: var(--primary);
}

.menu-header p {
  margin-top: 5px;
  color: #64748b;
}

.menu-welcome {
  text-align: center;
  margin-bottom: 25px;
}

.menu-welcome h2 {
  color: #1e293b;
  margin-bottom: 5px;
}

.menu-welcome p {
  color: #64748b;
}

.menu-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.menu-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 30px;
  min-height: 150px;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  background: white;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(15,23,42,.08);
  transition: .25s ease;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 40px rgba(15,23,42,.14);
  border-color: var(--secondary);
}

.menu-card:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.menu-icon {
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: #eef2ff;
  font-size: 34px;
}

.menu-card h3 {
  margin: 0 0 7px;
  color: #1e293b;
  font-size: 21px;
}

.menu-card p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.logout-main-btn {
  display: block;
  margin: 28px auto 0;
  padding: 11px 25px;
  border: 0;
  border-radius: 10px;
  background: #dc2626;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.logout-main-btn:hover {
  background: #b91c1c;
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard-screen {
  min-height: calc(100vh - 40px);
  padding: 20px;
  max-width: 1200px;
  margin: auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 24px 28px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 25px;
}

.dashboard-header h1 {
  margin: 0;
  text-align: left;
  font-size: 30px;
  color: var(--primary);
}

.dashboard-header p {
  margin-top: 5px;
  color: #64748b;
  font-size: 14px;
}

.dashboard-logout {
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
}

.dashboard-logout:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.dashboard-logout:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* Summary Cards */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.dashboard-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: white;
  padding: 25px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid #eef2f7;
}

.dashboard-card-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: #eef2ff;
  font-size: 28px;
}

.dashboard-card-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-card-content span {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.dashboard-card-content strong {
  color: #0f172a;
  font-size: 26px;
}

/* Dashboard Menu */
.dashboard-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-menu-button {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 20px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 5px 18px rgba(0,0,0,.05);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.dashboard-menu-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
  border-color: #c7d2fe;
}

.dashboard-menu-button:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.dashboard-menu-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dashboard-menu-button > span {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #f1f5f9;
  font-size: 24px;
  flex-shrink: 0;
}

.dashboard-menu-button div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-menu-button strong {
  color: #1e293b;
  font-size: 16px;
}

.dashboard-menu-button small {
  color: #64748b;
  font-size: 13px;
}

/* ============================================================
   MANAGER SCREENS (Customer, Item, Invoice)
   ============================================================ */

.manager-screen {
  width: 100%;
  min-height: 100vh;
  padding: 30px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at top left, #dbeafe 0, transparent 35%),
    radial-gradient(circle at bottom right, #e0e7ff 0, transparent 35%),
    #f8fafc;
}

.manager-header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 25px;
  padding: 22px 26px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.manager-header h2 {
  margin: 0;
  color: #1e3a8a;
  font-size: 25px;
  font-weight: 800;
}

.manager-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 14px;
}

/* Back Button */
.back-btn {
  min-width: 90px;
  height: 42px;
  padding: 0 16px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #334155;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: #f1f5f9;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.back-btn:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* Toolbar */
.manager-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.07);
}

.manager-toolbar input {
  flex: 1;
  height: 44px;
  margin: 0;
  box-sizing: border-box;
}

.primary-btn,
.secondary-btn {
  min-height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.20);
}

.primary-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(37, 99, 235, 0.25);
}

.primary-btn:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.secondary-btn {
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #d1d5db;
}

.secondary-btn:hover {
  background: #e2e8f0;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Manager Table */
#customerListView .table-container,
#itemListView .table-container,
#invoiceListView .table-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.manager-table {
  width: 100%;
  min-width: 800px;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  box-shadow: none;
  border: none;
  border-radius: 16px;
}

.manager-table th {
  padding: 14px 12px;
  color: #ffffff;
  background: #1a237e;
  border: none;
  border-bottom: 1px solid #111827;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.manager-table th:first-child {
  border-top-left-radius: 15px;
}

.manager-table th:last-child {
  border-top-right-radius: 15px;
}

.manager-table td {
  padding: 13px 12px;
  color: #334155;
  background: #ffffff;
  border: none;
  border-bottom: 1px solid #e8edf3;
  font-size: 13px;
  text-align: center;
}

.manager-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.manager-table tbody tr:hover td {
  background: #eff6ff;
}

.manager-table tbody tr:last-child td {
  border-bottom: none;
}

.manager-table .balance-cell {
  color: #166534;
  font-weight: 750;
  white-space: nowrap;
}

/* Action buttons in invoice manager */
.invoice-action-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 12px !important;
}

.table-edit-btn,
.table-view-btn,
.table-delete-btn {
  min-width: 65px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-edit-btn {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.table-edit-btn:hover {
  color: #ffffff;
  background: #2563eb;
  border-color: #2563eb;
}

.table-view-btn {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.table-view-btn:hover {
  color: #ffffff;
  background: #059669;
  border-color: #059669;
}

.table-delete-btn {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.table-delete-btn:hover {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
}

.table-edit-btn:focus-visible,
.table-view-btn:focus-visible,
.table-delete-btn:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* Table states */
.loading-cell,
.empty-cell {
  padding: 40px 20px !important;
  color: #64748b !important;
  background: #ffffff !important;
  text-align: center !important;
  font-size: 14px !important;
}

/* Manager Form */
.manager-form-card {
  width: 100%;
  max-width: 760px;
  margin: 20px auto 40px;
  padding: 28px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

.manager-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid #e2e8f0;
}

.manager-form-header h2 {
  margin: 0;
  color: #1e3a8a;
  font-size: 23px;
  font-weight: 800;
}

.manager-form-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
}

.manager-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 20px;
  row-gap: 7px;
}

.manager-form label {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.manager-form input {
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 0 13px;
  color: #1e293b;
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.manager-form input:hover {
  border-color: #9ca3af;
}

.manager-form input:focus {
  outline: none;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: var(--focus-ring);
}

.manager-form input:disabled {
  color: #64748b;
  background: #f1f5f9;
  cursor: not-allowed;
}

.manager-form .form-note {
  grid-column: 1 / -1;
  margin: 10px 0 5px;
  padding: 11px 13px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
}

.manager-form-buttons {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}

.manager-form-buttons .primary-btn,
.manager-form-buttons .secondary-btn {
  min-width: 130px;
}

/* Manager messages */
.manager-message {
  width: 100%;
  max-width: 1200px;
  min-height: 0;
  margin: 0 auto 15px;
  padding: 0;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 650;
}

.manager-message.success,
.manager-message.error {
  padding: 12px 15px;
  border-radius: 10px;
}

.manager-message.success {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
}

.manager-message.error {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  body {
    padding: 16px;
  }

  .layout-container {
    flex-direction: column;
  }

  .form-section,
  #summaryRow {
    width: 100%;
    flex: 1 1 100%;
  }

  .customer-summary-row {
    flex-direction: column;
  }

  .customer-summary-row #summaryRow {
    width: 100%;
    flex: 1 1 100%;
  }

  .manager-screen {
    padding: 20px 15px;
  }

  .manager-header {
    padding: 18px;
  }

  .manager-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .manager-toolbar input,
  .manager-toolbar .primary-btn {
    width: 100%;
  }

  .manager-form-card {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px 10px;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
    text-align: center;
  }

  .hero-left {
    justify-content: center;
  }

  .hero h1 {
    font-size: 24px;
    text-align: left;
  }

  .hero-right {
    justify-content: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row > input,
  .form-row input,
  .form-row select,
  .form-row button,
  input,
  select,
  #payment {
    width: 100%;
    max-width: 100%;
  }

  .btn {
    width: 100%;
  }

  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 8px 5px;
    font-size: 12px;
  }

  .floating-buttons {
    right: 15px;
    bottom: 15px;
  }

  .dashboard-screen {
    padding: 10px;
  }

  .dashboard-header {
    padding: 18px;
    border-radius: 14px;
  }

  .dashboard-header h1 {
    font-size: 23px;
  }

  .dashboard-cards {
    grid-template-columns: 1fr;
  }

  .dashboard-menu {
    grid-template-columns: 1fr;
  }

  .manager-header {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .manager-header .back-btn {
    width: 100%;
  }

  .manager-form-header {
    flex-direction: column;
    align-items: stretch;
  }

  .manager-form-header .back-btn {
    width: 100%;
  }

  .manager-form {
    grid-template-columns: 1fr;
  }

  .manager-form .form-note,
  .manager-form-buttons {
    grid-column: 1;
  }

  .manager-form-buttons {
    flex-direction: column;
  }

  .manager-form-buttons button {
    width: 100%;
  }

  .manager-form-card {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .manager-header h2 {
    font-size: 21px;
  }

  /* Toast on mobile */
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: 100%;
  }
}

@media (max-width: 650px) {
  .menu-buttons {
    grid-template-columns: 1fr;
  }

  .menu-header {
    flex-direction: column;
    text-align: center;
  }

  .menu-header h1 {
    text-align: center;
    font-size: 26px;
  }

  .menu-card {
    padding: 22px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px 5px;
  }

  .hero {
    padding: 15px;
    border-radius: 15px;
  }

  .hero-left {
    gap: 12px;
  }

  .hero img {
    width: 58px;
    height: 58px;
  }

  .hero h1 {
    font-size: 20px;
  }

  .hero p {
    font-size: 12px;
  }

  .status {
    justify-content: center;
    width: 100%;
  }

  .form-card,
  .form-row {
    padding: 12px;
    border-radius: 13px;
  }

  #summaryRow {
    padding: 13px;
    font-size: 13px;
  }

  .floating-buttons {
    right: 10px;
    bottom: 10px;
  }

  .fab-actions .btn {
    min-width: 140px;
  }

  .auth-card {
    padding: 30px 22px;
  }

  .auth-card h1 {
    font-size: 26px;
  }

  .menu-header {
    margin-bottom: 30px;
  }

  .dashboard-header {
    align-items: flex-start;
    gap: 15px;
  }

  .dashboard-header h1 {
    font-size: 20px;
  }

  .dashboard-card {
    padding: 18px;
  }

  .dashboard-card-content strong {
    font-size: 22px;
  }

  .manager-screen {
    padding: 10px 7px;
  }

  .manager-header {
    padding: 16px;
    border-radius: 14px;
  }

  .manager-toolbar {
    padding: 14px;
    border-radius: 14px;
  }

  .manager-form-card {
    padding: 17px 13px;
  }

  .manager-form-header h2 {
    font-size: 20px;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
  body {
    padding: 0;
    background: #ffffff;
  }

  body * {
    visibility: hidden;
  }

  #invoicePreview,
  #invoicePreview * {
    visibility: visible;
  }

  #invoicePreview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
  }

  .floating-buttons {
    display: none !important;
  }

  .toast-container {
    display: none !important;
  }
}
.item-single-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.item-single-row input#itemName {
  flex: 3;
}

.item-single-row input#itemQty {
  flex: 1;
  min-width: 100px;
}

.item-single-row button#addItemBtn {
  flex: 1;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .item-single-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* =========================================================
   TOP UP / PAYMENT MODAL
   ========================================================= */

.topup-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);

  display: flex;
  align-items: flex-start;
  justify-content: center;

  padding: 70px 20px 20px;

  z-index: 9999;
}

.topup-box {
  width: min(850px, 100%);
  background: #ffffff;

  border-radius: 14px;

  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.25);

  overflow: hidden;

  animation: topUpOpen 0.2s ease;
}

@keyframes topUpOpen {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 18px 22px;

  background: #1a237e;
  color: #ffffff;
}

.topup-header h2 {
  margin: 0;
  font-size: 21px;
}

.topup-header p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.85;
}

.topup-close {
  border: none;
  background: transparent;
  color: #ffffff;

  font-size: 30px;
  line-height: 1;

  cursor: pointer;
}

.topup-table-container {
  padding: 20px;
  overflow-x: auto;
}

.topup-table {
  width: 100%;
  border-collapse: collapse;
}

.topup-table th {
  background: #1A237E;
  padding: 12px;

  text-align: left;

  border: 1px solid #e2e8f0;
}

.topup-table td {
  padding: 10px;

  border: 1px solid #e2e8f0;
}

.topup-table input,
.topup-table select {
  width: 100%;
  box-sizing: border-box;

  padding: 10px 11px;

  border: 1px solid #cbd5e1;
  border-radius: 7px;

  font-size: 14px;

  background: #ffffff;
}

.topup-table input:focus,
.topup-table select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.topup-message {
  min-height: 20px;

  padding: 0 20px;

  font-size: 14px;
  font-weight: 600;
}

.topup-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  padding: 15px 20px 20px;
}

.topup-save-btn,
.topup-cancel-btn {
  border: none;
  border-radius: 7px;

  padding: 10px 18px;

  cursor: pointer;

  font-size: 14px;
  font-weight: 600;
}

.topup-save-btn {
  background: #16a34a;
  color: #ffffff;
}

.topup-cancel-btn {
  background: #e5e7eb;
  color: #111827;
}

.topup-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-payment {
  background: #91247d;
  color: fffff;
}

@media (max-width: 600px) {

  .topup-modal {
    padding: 30px 10px 10px;
  }

  .topup-box {
    width: 100%;
  }

  .topup-table th,
  .topup-table td {
    padding: 7px;
  }

  .topup-header h2 {
    font-size: 18px;
  }

  .topup-buttons {
    flex-direction: column;
  }

  .topup-save-btn,
  .topup-cancel-btn {
    width: 100%;
  }
}

/* =========================================================
   STATEMENT
   ========================================================= */

.statement-box {
  width: min(1000px, 100%);
}

.statement-info {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
}

.statement-info strong {
  margin-right: 6px;
}

.statement-table {
  min-width: 700px;
}

.statement-table th,
.statement-table td {
  white-space: nowrap;
}

.statement-table td {
  font-size: 13px;
}

.statement-payment {
  font-weight: 700;
}

.statement-positive {
  color: #16a34a;
}

.statement-negative {
  color: #dc2626;
}

.statement-empty {
  text-align: center;
  padding: 25px !important;
  color: #64748b;
}

.btn-statement {
  background: #7c3aed;
  color: #ffffff;
}
/* =========================================================
   STATEMENT
   ========================================================= */

.statement-box {
  width: min(1000px, 100%);
}

.statement-info {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
}

.statement-info strong {
  margin-right: 6px;
}

.statement-table {
  min-width: 700px;
}

.statement-table th,
.statement-table td {
  white-space: nowrap;
}

.statement-table td {
  font-size: 13px;
}

.statement-payment {
  font-weight: 700;
}

.statement-positive {
  color: #16a34a;
}

.statement-negative {
  color: #dc2626;
}

.statement-empty {
  text-align: center;
  padding: 25px !important;
  color: #64748b;
}

.btn-statement {
  background: #7c3aed;
  color: #ffffff;
}