/* ═══════════════════════════════════════════════════════════════
   MobileInvoicePro – Glassmorphism POS (Full)
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --glass-bg:     rgba(255,255,255,0.07);
  --glass-bg2:    rgba(255,255,255,0.12);
  --glass-border: rgba(255,255,255,0.15);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.4);
  --blur:         blur(18px);
  --primary:      #7c3aed;
  --primary-glow: rgba(124,58,237,0.45);
  --accent:       #06b6d4;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --text:         #f1f5f9;
  --text-muted:   rgba(241,245,249,0.55);
  --border:       rgba(255,255,255,0.12);
  --radius:       16px; --radius-sm: 10px;
  --sidebar-w:    230px; --font: 'Cairo', system-ui, sans-serif;
  --header-h:     72px;
}
html { scroll-behavior: smooth; }
body { font-family:var(--font); background:linear-gradient(135deg,#0f0c29 0%,#302b63 45%,#24243e 100%); min-height:100vh; color:var(--text); overflow-x:hidden; display:flex; flex-direction:column; }

/* Blobs */
.bg-blobs { position:fixed; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
.blob { position:absolute; border-radius:50%; filter:blur(120px); opacity:0.45; mix-blend-mode:screen; }
.blob-1 { width:600px;height:600px;background:radial-gradient(circle, rgba(124, 58, 237, 0.4) 0%, rgba(124, 58, 237, 0) 70%); top:-200px;right:-150px; animation:float1 25s ease-in-out infinite alternate; }
.blob-2 { width:500px;height:500px;background:radial-gradient(circle, rgba(6, 182, 212, 0.35) 0%, rgba(6, 182, 212, 0) 70%); bottom:-150px;left:-100px; animation:float2 30s ease-in-out infinite alternate; }
.blob-3 { width:450px;height:450px;background:radial-gradient(circle, rgba(236, 72, 153, 0.3) 0%, rgba(236, 72, 153, 0) 70%); top:30%;left:30%; animation:float3 28s ease-in-out infinite alternate; }
@keyframes float1 { 0%{transform:translate(0,0) scale(1)} 50%{transform:translate(80px,60px) scale(1.15)} 100%{transform:translate(-40px,30px) scale(0.9)} }
@keyframes float2 { 0%{transform:translate(0,0) scale(1)} 50%{transform:translate(-60px,80px) scale(0.85)} 100%{transform:translate(40px,-40px) scale(1.1)} }
@keyframes float3 { 0%{transform:translate(0,0) scale(1)} 50%{transform:translate(50px,-80px) scale(1.2)} 100%{transform:translate(-50px,40px) scale(0.95)} }

/* Layout */
.app-header {
  height: var(--header-h);
  width: 100%;
  background: rgba(15, 12, 41, 0.75);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.header-start {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 2;
}
.header-end {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 2;
}
.header-brand-store {
  gap: 0.65rem;
}
.header-brand-project {
  justify-content: flex-end;
  gap: 0.65rem;
}
.header-logout-btn {
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
}
.header-datetime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  padding: 0 0.35rem;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  margin-left: 0.35rem;
}
.header-clock {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
.header-date {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.1rem;
}
.header-user-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  max-width: 140px;
}
.header-user-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}
.header-username {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-store-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}
.header-store-icon.hidden {
  display: none;
}
.header-store-name {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.header-corner-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.header-project-logo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.35);
}
.app-header .header-tagline {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none;
  max-width: min(42%, 520px);
  line-height: 1.2;
  padding: 0 0.5rem;
}

.app-wrapper { position:relative;z-index:1;display:flex;flex:1; }

/* Sidebar */
.sidebar { width:var(--sidebar-w);background:rgba(15,12,41,0.35);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);border-left:1px solid var(--glass-border);display:flex;flex-direction:column;padding:0.8rem 0;position:sticky;top:var(--header-h);height:calc(100vh - var(--header-h));flex-shrink:0; }
.sidebar-brand {
  display: none;
}
.sidebar-brand .brand-logo { width:36px;height:36px;border-radius:8px;object-fit:cover; }
.sidebar-brand .brand-logo.hidden { display:none; }
.sidebar-brand .brand-icon { font-size:1.6rem; }
.sidebar-brand .brand-name { font-size:1rem;font-weight:900;color:var(--text); }
.nav-menu { flex:1;display:flex;flex-direction:column;gap:0.2rem;padding:0.8rem 0.6rem;overflow-y:auto; }
.nav-item { display:flex;align-items:center;gap:0.65rem;padding:0.65rem 0.9rem;border-radius:var(--radius-sm);border:none;background:transparent;color:var(--text-muted);font-family:var(--font);font-size:0.87rem;font-weight:600;cursor:pointer;transition:all 0.2s;text-align:right;width:100%; }
.nav-item:hover  { background:var(--glass-bg);color:var(--text); }
.nav-item.active { background:linear-gradient(135deg,var(--primary),#a855f7);color:#fff;box-shadow:0 4px 18px var(--primary-glow); }
.nav-icon { font-size:1rem;width:20px;text-align:center; }

/* Main */
.main-content { flex:1;padding:1.5rem;overflow-y:auto;max-height:calc(100vh - var(--header-h)); }
.tab-panel { animation:fadeIn 0.25s ease; }
.tab-panel.hidden { display:none !important; }

/* Page header */
.page-header { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:0.75rem;margin-bottom:1.2rem; }
.page-title  { font-size:1.35rem;font-weight:900;display:flex;align-items:center;gap:0.4rem; }

.page-header--dashboard {
  flex-wrap: nowrap;
  align-items: center;
  gap: 1rem;
}
.page-header--dashboard .page-title { flex-shrink: 0; }
.page-header--dashboard .filter-bar--inline {
  flex: 1;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
}
.page-header--dashboard #dashDatePreset {
  min-width: 160px;
  flex-shrink: 0;
}

/* Filter bar */
.filter-bar { display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap; }
.filter-bar--inline { flex-wrap: nowrap; overflow-x: auto; }
.filter-bar input[type="date"],
.filter-bar select { padding:0.45rem 0.7rem;background:rgba(255,255,255,0.08);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text);font-family:var(--font);font-size:0.82rem;outline:none; }
.filter-bar input[type="date"]::-webkit-calendar-picker-indicator { filter:invert(1);opacity:0.6; }

/* Stats grid */
.stats-grid { display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:0.9rem;margin-bottom:1.2rem; }
.stat-card { background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius);padding:1.1rem 1.2rem;-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);box-shadow:var(--glass-shadow);transition:transform 0.2s;position:relative;overflow:hidden; }
.stat-card:hover { transform:translateY(-2px); }
.stat-icon  { font-size:1.6rem;margin-bottom:0.3rem; }
.stat-label { font-size:0.75rem;font-weight:600;color:var(--text-muted);margin-bottom:0.2rem; }
.stat-value { font-size:1.5rem;font-weight:900; }
.stat-value.accent  { color:var(--accent); }
.stat-value.success { color:var(--success); }
.stat-value.warning { color:var(--warning); }
.stat-value.danger  { color:var(--danger); }

.payment-methods-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.5rem;
}
.payment-method-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pm-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.pm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.pm-dot--cash { background-color: var(--warning); }
.pm-dot--visa { background-color: var(--accent); }
.pm-dot--bank { background-color: var(--success); }
.pm-val {
  font-weight: 700;
  color: var(--text);
}

/* Mini stats row */
.stats-mini-grid { display:flex;flex-wrap:wrap;gap:0.6rem;margin-bottom:1rem; }
.stats-bar-with-export {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.stats-bar-with-export .stats-mini-grid { margin-bottom: 0; flex: 1; }
.btn-export-excel { white-space: nowrap; flex-shrink: 0; }
.stat-mini { background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius-sm);padding:0.5rem 1rem;font-size:0.82rem;-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur); }
.stat-mini strong { color:var(--accent);margin-right:0.25rem; }

/* Card */
.card { background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius);padding:1.3rem 1.4rem;-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);box-shadow:var(--glass-shadow); }
.card+.card { margin-top:1rem; }
.section-title { font-size:0.95rem;font-weight:700;margin-bottom:0.9rem;display:flex;align-items:center;gap:0.4rem; }

/* Form controls */
.form-group { display:flex;flex-direction:column;gap:0.3rem;margin-bottom:0.9rem; }
.form-group label { font-size:0.78rem;font-weight:700;color:var(--text-muted); }
input[type="text"],input[type="number"],input[type="tel"],input[type="url"],input[type="email"],select,textarea {
  width:100%;padding:0.6rem 0.9rem;background:rgba(255,255,255,0.08);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text);font-family:var(--font);font-size:0.9rem;outline:none;transition:border-color 0.2s,box-shadow 0.2s;-webkit-appearance:none;appearance:none;
}
input:focus,select:focus,textarea:focus { border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-glow); }
input::placeholder { color:var(--text-muted); }
select option { background:#302b63;color:var(--text); }
input:disabled { opacity:0.45;cursor:not-allowed; }
.form-row   { display:grid;grid-template-columns:1fr 1fr;gap:0.7rem; }
.form-row-3 { display:grid;grid-template-columns:1fr 1fr 1fr;gap:0.7rem; }

/* Searchable custom dropdown */
.search-select-wrap { position:relative; }
.search-dropdown {
  position:absolute;top:100%;right:0;left:0;z-index:200;
  background:rgba(20,15,55,0.97);border:1px solid var(--border);border-radius:var(--radius-sm);
  max-height:200px;overflow-y:auto;-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  box-shadow:var(--glass-shadow);
}
.search-dropdown.hidden { display:none; }
.dd-item { padding:0.55rem 0.9rem;cursor:pointer;font-size:0.88rem;transition:background 0.15s; }
.dd-item:hover,.dd-item.selected { background:rgba(124,58,237,0.3); }
.dd-empty { padding:0.6rem;color:var(--text-muted);font-size:0.82rem;text-align:center; }

/* Item rows */
.items-header { display:grid;grid-template-columns:1fr 100px 70px 90px 30px 30px;gap:0.4rem;font-size:0.73rem;font-weight:700;color:var(--text-muted);padding:0 0.3rem 0.3rem;text-transform:uppercase;letter-spacing:0.4px; }
.item-row     { display:grid;grid-template-columns:1fr 100px 70px 90px 30px 30px;gap:0.4rem;align-items:center;margin-bottom:0.4rem;animation:fadeIn 0.2s ease; }
.item-row input,.item-row select { padding:0.5rem 0.6rem;font-size:0.85rem; }
.item-line-total { font-weight:700;color:var(--accent);font-size:0.85rem;text-align:center;white-space:nowrap; }
.btn-quick-add { width:28px;height:28px;background:rgba(16,185,129,0.15);border:1px solid var(--success);color:var(--success);border-radius:6px;cursor:pointer;font-size:0.9rem;display:flex;align-items:center;justify-content:center;transition:all 0.2s;flex-shrink:0; }
.btn-quick-add:hover { background:var(--success);color:#fff; }
.btn-remove { width:28px;height:28px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.3);color:var(--danger);border-radius:6px;cursor:pointer;font-size:0.9rem;display:flex;align-items:center;justify-content:center;transition:all 0.2s;flex-shrink:0; }
.btn-remove:hover { background:var(--danger);color:#fff; }

/* Totals */
.totals-box { background:rgba(0,0,0,0.25);border:1px solid var(--border);border-radius:var(--radius-sm);padding:1rem 1.3rem;margin:1rem 0; }
.totals-row { display:flex;justify-content:space-between;font-size:0.9rem;color:var(--text-muted);margin-bottom:0.45rem; }
.totals-row.grand { color:var(--accent);font-size:1.2rem;font-weight:900;padding-top:0.55rem;border-top:1px solid var(--border);margin-bottom:0; }

/* Buttons */
.btn { border:none;border-radius:var(--radius-sm);padding:0.6rem 1.2rem;font-family:var(--font);font-size:0.88rem;font-weight:700;cursor:pointer;transition:all 0.2s;display:inline-flex;align-items:center;gap:0.35rem;white-space:nowrap; }
.btn-primary { background:linear-gradient(135deg,var(--primary),#a855f7);color:#fff;box-shadow:0 4px 16px var(--primary-glow); }
.btn-primary:hover { transform:translateY(-2px);box-shadow:0 8px 24px var(--primary-glow); }
.btn-secondary { background:var(--glass-bg2);border:1px solid var(--border);color:var(--text); }
.btn-secondary:hover { border-color:var(--primary);color:var(--primary); }
.btn-danger  { background:rgba(239,68,68,0.12);border:1px solid var(--danger);color:var(--danger); }
.btn-danger:hover { background:var(--danger);color:#fff; }
.btn-success { background:rgba(16,185,129,0.12);border:1px solid var(--success);color:var(--success); }
.btn-success:hover { background:var(--success);color:#fff; }
.btn-block { width:100%;justify-content:center; }
.btn-sm { padding:0.38rem 0.8rem;font-size:0.8rem; }

/* Data table */
.data-table-wrap { overflow-x:auto; }
.data-table { width:100%;border-collapse:separate;border-spacing:0;font-size:0.85rem; }
.data-table th { background:rgba(255,255,255,0.06);padding:0.55rem 0.8rem;font-weight:700;color:var(--text-muted);text-align:right;border-bottom:1px solid var(--border);font-size:0.74rem;text-transform:uppercase;letter-spacing:0.4px;white-space:nowrap; }
.data-table td { padding:0.55rem 0.8rem;border-bottom:1px solid rgba(255,255,255,0.04);vertical-align:middle; }
.data-table tr:last-child td { border-bottom:none; }
.data-table tbody tr { cursor:pointer;transition:background 0.15s; }
.data-table tbody tr:hover { background:rgba(255,255,255,0.05); }
.td-actions { display:flex;gap:0.35rem; }
.table-topbar { display:flex;justify-content:space-between;align-items:center;margin-bottom:0.8rem;gap:0.6rem; }

/* Badges */
.badge { display:inline-flex;align-items:center;padding:0.18rem 0.55rem;border-radius:20px;font-size:0.72rem;font-weight:700; }
.badge-success { background:rgba(16,185,129,0.15);color:var(--success);border:1px solid rgba(16,185,129,0.3); }
.badge-warning { background:rgba(245,158,11,0.15);color:var(--warning);border:1px solid rgba(245,158,11,0.3); }
.badge-danger  { background:rgba(239,68,68,0.15);color:var(--danger);border:1px solid rgba(239,68,68,0.3); }

/* Top sellers */
.top-seller-row { display:flex;align-items:center;gap:0.75rem;padding:0.6rem 0;border-bottom:1px solid rgba(255,255,255,0.05); }
.top-seller-row:last-child { border-bottom:none; }
.seller-rank { width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:0.78rem;background:var(--glass-bg2);flex-shrink:0; }
.seller-rank.gold   { background:rgba(245,158,11,0.2);color:var(--warning);border:1px solid var(--warning); }
.seller-rank.silver { background:rgba(156,163,175,0.15);color:#9ca3af;border:1px solid #9ca3af; }
.seller-rank.bronze { background:rgba(180,83,9,0.15);color:#cd7f32;border:1px solid #cd7f32; }
.seller-name { flex:1;font-weight:600;font-size:0.88rem; }
.seller-qty  { font-size:0.78rem;color:var(--text-muted);background:var(--glass-bg2);padding:0.15rem 0.5rem;border-radius:20px; }
.seller-rev  { font-weight:700;color:var(--accent);font-size:0.88rem; }

/* Logo upload */
.logo-upload-wrap { display:flex;align-items:center;gap:0.75rem;flex-wrap:wrap; }
.logo-preview { width:60px;height:60px;border-radius:10px;object-fit:cover;border:1px solid var(--border); }
.logo-preview.hidden { display:none; }

/* Modal */
.modal-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.65);z-index:1000;display:flex;align-items:center;justify-content:center;padding:1rem;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);overflow-y:auto; }
.modal-overlay.hidden { display:none; }
.modal { background:rgba(18,12,48,0.95);border:1px solid var(--glass-border);border-radius:var(--radius);padding:1.4rem;width:100%;max-width:460px;max-height:90vh;overflow-y:auto;-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);box-shadow:var(--glass-shadow);animation:fadeIn 0.2s ease; }
.max-width-lg { max-width: 580px; }
.max-width-md { max-width: 500px; }
.max-width-sm { max-width: 360px; }
.max-width-sm { max-width: 360px; }
.modal-title { font-size:1.05rem;font-weight:700;margin-bottom:1.1rem;display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:rgba(18,12,48,0.98);padding-bottom:0.5rem;z-index:1; }
.modal-footer { display:flex;gap:0.6rem;justify-content:flex-end;margin-top:1.1rem;flex-wrap:wrap; }

/* Invoice detail */
.detail-meta { display:grid;grid-template-columns:1fr 1fr;gap:0.4rem 1rem;font-size:0.85rem;margin-bottom:1rem; }
.detail-meta .dm-label { color:var(--text-muted);font-size:0.75rem; }
.detail-meta .dm-value { font-weight:700; }

/* Toast */
.toast { position:fixed;bottom:1.5rem;left:50%;transform:translateX(-50%) translateY(80px);background:rgba(18,12,48,0.95);border:1px solid var(--primary);color:var(--text);padding:0.7rem 1.6rem;border-radius:40px;font-weight:600;font-size:0.87rem;box-shadow:var(--glass-shadow);opacity:0;transition:all 0.32s cubic-bezier(.34,1.56,.64,1);z-index:9999;white-space:nowrap; }
.toast.show    { opacity:1;transform:translateX(-50%) translateY(0); }
.toast.success { border-color:var(--success);color:var(--success); }
.toast.error   { border-color:var(--danger);color:var(--danger); }

/* Empty state */
.empty-state { text-align:center;padding:2.5rem 1rem;color:var(--text-muted);font-size:0.9rem; }
.empty-icon  { font-size:2rem;margin-bottom:0.4rem; }

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

/* ══ PRINT ═══════════════════════════════════════════════════════════════ */
.print-only { display:none; }

/* Invoice document styles — always apply inside #printArea (print) */
#printArea,
#printArea .print-sheet {
  direction: rtl;
  font-family: 'Cairo', Arial, sans-serif;
  color: #111;
  background: #fff;
  overflow: visible;
  max-width: 100%;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
#printArea .print-sheet { padding: 0; }
#printArea .print-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #333;
}
#printArea .print-brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
#printArea .print-logo:not(.hidden) { display: block !important; }
#printArea .print-logo { max-height: 56px; max-width: 120px; object-fit: contain; border-radius: 6px; }
#printArea .print-store-name { font-size: 1.35rem; font-weight: 900; margin: 0; color: #111; }
#printArea .print-doc-type { font-size: 0.85rem; color: #555; margin: 0.15rem 0 0; }
#printArea .print-id-block { text-align: left; }
#printArea .print-id-label { font-size: 0.75rem; color: #666; }
#printArea .print-id-value { font-size: 1.1rem; font-weight: 900; color: #111; }
#printArea .print-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
#printArea .print-meta-cell {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  background: #fafafa;
}
#printArea .print-meta-label { display: block; font-size: 0.72rem; color: #666; margin-bottom: 0.15rem; }
#printArea .print-meta-value { font-weight: 700; font-size: 0.88rem; color: #111; }
#printArea .print-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 0.8rem; }
#printArea .print-table th,
#printArea .print-table td {
  border: 1px solid #bbb;
  padding: 0.4rem 0.55rem;
  text-align: right;
  word-break: break-word;
  overflow-wrap: break-word;
  color: #111;
}
#printArea .print-table thead th { background: #eee; font-weight: 700; }
#printArea .p-total-label { font-weight: 700; text-align: left; color: #111; }
#printArea .p-total-value { font-weight: 900; font-size: 1rem; color: #111; }
#printArea .print-payments { margin-top: 0.75rem; }
#printArea .print-payments-title { font-size: 0.82rem; font-weight: 700; margin-bottom: 0.35rem; color: #111; }
#printArea .print-payments-table { font-size: 0.78rem; width: 100%; }
#printArea .print-footer { text-align: center; color: #555; font-size: 0.78rem; margin-top: 1rem; padding-top: 0.5rem; border-top: 1px solid #ddd; }
#printArea .print-thanks { margin: 0 0 0.75rem; color: #111; }
#printArea .print-issued-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: #111;
}
#printArea .print-barcode-block { margin-top: 0.5rem; text-align: center; }
#printArea .print-barcode { display: block; margin: 0 auto; max-width: 220px; height: 48px; }
#printArea .print-barcode-label { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; margin-top: 0.35rem; direction: ltr; color: #111; }

@media print {
  .bg-blobs, .app-header, .app-wrapper, .app-footer, .sidebar, .main-content, .toast, .modal-overlay { display: none !important; }
  .print-only { display: block !important; position: static; }
  body { background: #fff !important; margin: 0; padding: 0; }
  @page { size: A4; margin: 12mm; }
}

/* Helper styles extracted from inline css */
.margin-top-sm { margin-top: 0.5rem; }
.margin-y-sm { margin: 0.3rem 0 1rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.select-status { max-width: 140px; }
.input-search { max-width: 150px; }
.input-search-long { max-width: 220px; }
.margin-bottom-sm { margin-bottom: 1rem; }
.hidden-file-input { display: none; }
.logo-file-name { color: var(--text-muted); font-size: 0.82rem; }
.input-currency { max-width: 100px; }
.modal-center { text-align: center; }
.emoji-large { font-size: 3rem; margin-bottom: 0.75rem; }
.margin-bottom-xs { margin-bottom: 0.5rem; }
.text-muted { color: var(--text-muted); }
.margin-bottom-md { margin-bottom: 1.5rem; }
.flex-center-gap { display: flex; gap: 0.75rem; justify-content: center; }

/* Debt payment styling */
.debt-pay-box { padding: 0.8rem; margin-top: 1rem; background: rgba(255,255,255,0.04); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.debt-pay-title { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.85rem; }
.flex-row-gap-sm { display: flex; gap: 0.5rem; align-items: center; }
.separator { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }


/* General Utilities */
.hidden { display: none !important; }
.cursor-pointer { cursor: pointer !important; }

/* Date Filter & Presets styling */
.date-range-inputs {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeIn 0.2s ease;
}
.select-preset {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}
.select-preset:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Glassmorphism Unified Footer */
.app-footer {
  padding: 1.5rem;
  background: rgba(15, 12, 41, 0.7);
  border-top: 1px solid var(--glass-border);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  position: relative;
  z-index: 99;
}
.app-footer--gate {
  max-width: 960px;
  width: 100%;
  margin-top: auto;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
}
.app-footer .footer-info p {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}
.app-footer .brand-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}
.app-footer .powered-by {
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Responsive helper visibility utility */
.desktop-only { display: block; }
.mobile-only { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-content { padding: 1.1rem; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media(max-width:768px) {
  .app-header {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.35rem;
    height: auto;
    min-height: var(--header-h);
    padding: 0.6rem 1rem;
  }
  .app-header .header-tagline {
    position: static;
    transform: none;
    order: 3;
    width: 100%;
    max-width: none;
    font-size: 0.75rem;
    padding: 0;
  }
  .header-start { order: 1; }
  .header-end { order: 2; }
  .header-store-name { font-size: 1rem; }
  .header-corner-logo { width: 40px; height: 40px; }
  .header-project-logo { width: 52px; height: 52px; }
  .header-logout-btn { font-size: 0.72rem; padding: 0.35rem 0.55rem; }
  .header-datetime { display: none; }
  .header-user-pill { max-width: 100px; padding: 0.3rem 0.5rem; }
  .header-username { font-size: 0.72rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .app-wrapper { flex-direction:column; }
  .sidebar { width:100%; height:auto;position:static;padding:0.6rem 0; border-left:none; border-bottom:1px solid var(--glass-border); }
  .nav-menu { flex-direction:row;flex-wrap:wrap;padding:0.4rem;gap:0.25rem; }
  .nav-item { flex:1;min-width:70px;min-height:44px;padding:0.45rem;font-size:0.73rem;justify-content:center; }
  .main-content { max-height:none;padding:0.9rem; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header--dashboard { flex-wrap: wrap; }
  .page-header--dashboard .filter-bar--inline { justify-content: flex-start; }
  .page-title { font-size: 1.15rem; }
  .filter-bar, .filter-bar--inline { flex-wrap: wrap; width: 100%; }
  .filter-bar .select-preset,
  .filter-bar .select-status,
  .filter-bar input[type="date"],
  .filter-bar .btn { flex: 1 1 auto; min-width: 0; }
  .date-range-inputs { flex-wrap: wrap; width: 100%; }
  .items-header,.item-row { grid-template-columns:1fr 85px 60px 75px 26px 26px; }
  .form-row,.form-row-3 { grid-template-columns:1fr; }
  .stats-grid { grid-template-columns:1fr 1fr; }
  .stats-mini-grid { flex-direction: column; }
  .stat-mini { width: 100%; }
  .filter-bar { gap:0.35rem; }
  .input-search, .input-search-long, .select-status { max-width: none; width: 100%; }
  .data-table-wrap { overflow-x: auto; }
  .td-actions .btn { min-width: 44px; min-height: 44px; }
  .modal-overlay { align-items: flex-end; padding: 0.5rem; }
  .modal, .max-width-lg, .max-width-md, .max-width-sm { max-width: calc(100vw - 1rem); width: 100%; max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; min-height: 44px; }
  .flex-row-gap-sm { flex-wrap: wrap; }
  .flex-row-gap-sm .btn { flex: 1 1 100%; }
  .detail-meta { grid-template-columns: 1fr; }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  input[type="text"], input[type="number"], input[type="tel"], input[type="email"], select { font-size: 16px; }
  .app-footer { padding: 1rem; font-size: 0.72rem; }
  .app-footer .footer-info p { word-break: break-word; }
}

@media(max-width:480px) {
  .app-header .header-tagline { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .items-header { display: none; }
  .item-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "price qty"
      "total total"
      "add remove";
    gap: 0.35rem;
    padding: 0.6rem;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
  }
  .item-row .prod-search-wrap,
  .item-row .prod-search-input { grid-area: name; }
  .item-row .prod-price { grid-area: price; }
  .item-row .prod-qty { grid-area: qty; }
  .item-row .item-line-total { grid-area: total; text-align: right; }
  .item-row .btn-quick-add { grid-area: add; }
  .item-row .btn-remove { grid-area: remove; }
  #btnSave { position: sticky; bottom: 0.5rem; z-index: 10; }
  .print-meta { grid-template-columns: 1fr 1fr !important; }
  .print-top { flex-direction: column; }
}

/* ══ GATE SCREENS (EULA / Activation / Landing) ═══════════════════════════ */
.gate-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}
.gate-card {
  width: min(440px, 100%);
  background: rgba(15, 12, 41, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  animation: gateFadeIn 0.45s ease;
}
.gate-card--wide {
  width: min(560px, 100%);
  max-height: 70vh;
  overflow-y: auto;
}
.gate-logo {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 0.75rem;
}
.gate-logo--img {
  display: flex;
  justify-content: center;
  align-items: center;
}
.gate-logo-image {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.35);
}
.gate-title {
  font-size: 1.45rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.gate-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.gate-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.gate-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  text-align: center;
}
.eula-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}
.eula-body ul {
  margin: 0.75rem 1.25rem 0 0;
  padding: 0;
}
.eula-body li {
  margin-bottom: 0.45rem;
}
.machine-id-box {
  margin-bottom: 1rem;
}
.machine-id-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.machine-id-value {
  flex: 1;
  display: block;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--accent);
  direction: ltr;
  text-align: left;
}
.landing-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  width: min(1200px, 100%);
  flex: 1;
  align-items: center;
}
.landing-header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 1rem;
  z-index: 10;
}
.landing-header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.landing-logo-img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
}
.landing-logo-text {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}
.btn-lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 0.5rem 1.25rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.btn-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
  transform: translateY(-1px);
}
.landing-container {
  width: 100%;
  max-width: 1200px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.showcase-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: start;
}
.showcase-inner {
  width: 100%;
}
.badge-saas {
  display: inline-block;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.35);
  color: #c084fc;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: pulse 2s infinite alternate;
}
@keyframes pulse {
  from { box-shadow: 0 0 5px rgba(124, 58, 237, 0.2); }
  to { box-shadow: 0 0 15px rgba(124, 58, 237, 0.4); }
}
.showcase-heading {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}
.showcase-tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 2rem;
}
.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.25rem;
}
.chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 1rem;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}
.chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.chip-dot.pink { background: #ec4899; box-shadow: 0 0 8px #ec4899; }
.chip-dot.cyan { background: #06b6d4; box-shadow: 0 0 8px #06b6d4; }
.chip-dot.violet { background: #8b5cf6; box-shadow: 0 0 8px #8b5cf6; }
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem 0;
  width: 100%;
}
.bento-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: start;
}
.bento-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.15), inset 0 1px 1px rgba(255,255,255,0.1);
}
.bento-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bento-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(124, 58, 237, 0.15);
  color: #c084fc;
}
.bento-card:nth-child(2) .bento-icon {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}
.bento-card:nth-child(3) .bento-icon {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}
.bento-card:nth-child(4) .bento-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.bento-svg {
  width: 20px;
  height: 20px;
}
.bento-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.bento-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}
.download-section {
  width: 100%;
}
.btn-download-app {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.2) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 16px;
  padding: 0.85rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: start;
}
.btn-download-app:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.3) 100%);
  border-color: #10b981;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
}
.download-icon {
  font-size: 1.75rem;
}
.download-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.download-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #34d399;
}
.download-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.auth-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.auth-card.glass-auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 2.5rem 2.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: gateFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.auth-card.glass-auth-card .gate-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
  text-align: center;
}
.auth-card.glass-auth-card .gate-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  text-align: center;
}
.login-form .form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.login-form label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.95;
}
.login-form input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}
.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 12px var(--primary-glow);
}
.login-form .btn-primary {
  margin-top: 1.5rem;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 12px;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all 0.3s ease;
}
.login-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}
.landing-guide-card {
  margin-top: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 0.85rem 1.25rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  width: 100%;
}
.landing-guide-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
}
.landing-guide-card__icon {
  font-size: 1.75rem;
}
.landing-guide-card__text {
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.landing-guide-card__text strong {
  color: var(--accent);
  font-size: 0.95rem;
}
.landing-guide-card__text small {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.app-footer.app-footer--gate {
  width: 100%;
  max-width: 1200px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 1.5rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  margin-top: auto;
  text-align: center;
}
html[dir="ltr"] .showcase-panel {
  align-items: flex-start;
  text-align: left;
}
html[dir="ltr"] .btn-download-app,
html[dir="ltr"] .landing-guide-card {
  text-align: left;
}
html[dir="ltr"] .landing-guide-card__text,
html[dir="ltr"] .download-text-wrap {
  text-align: left;
}
.nav-item.hidden {
  display: none !important;
}

/* ══ USER GUIDE ═══════════════════════════════════════════════════════════ */
.guide-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.guide-toc {
  position: sticky;
  top: 1rem;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.guide-toc-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.guide-toc-link {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.guide-toc-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.guide-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.guide-section {
  padding: 1.5rem 1.75rem;
  scroll-margin-top: 1rem;
}
.guide-section-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
  color: var(--text);
}
.guide-list {
  margin: 0.75rem 0 1rem;
  padding-right: 1.25rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.guide-list li {
  margin-bottom: 0.4rem;
}
.guide-list--ordered {
  list-style: decimal;
}
.guide-figure {
  margin: 1rem 0 0;
  text-align: center;
}
.guide-figure img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.2);
}
.guide-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.shortcuts-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}
.shortcuts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.shortcuts-table th,
.shortcuts-table td {
  padding: 0.65rem 0.85rem;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}
.shortcuts-table th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.74rem;
}
.shortcuts-table kbd,
.guide-section kbd {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.06) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 3px solid rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  direction: ltr;
  unicode-bidi: isolate;
}

/* Guide modal (landing screen) */
.guide-modal-overlay {
  z-index: 2500;
  padding: 0.75rem;
}
.guide-modal {
  width: min(1100px, 96vw);
  max-width: min(1100px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.guide-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.guide-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}
.guide-modal-body {
  overflow-y: auto;
  padding: 1rem 1.25rem 1.25rem;
  flex: 1;
  min-height: 0;
}
.guide-modal-body .guide-layout {
  gap: 1rem;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  width: 100%;
}
.guide-modal-body .guide-content {
  min-width: 0;
}
.guide-modal-body .guide-toc {
  position: sticky;
  top: 0;
}
.guide-modal-body .guide-section {
  scroll-margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }
  .guide-toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .guide-toc-title {
    width: 100%;
  }
  .guide-toc-link {
    flex: 1 1 auto;
    text-align: center;
    font-size: 0.78rem;
  }
  .guide-section {
    padding: 1.1rem;
  }
  .guide-modal-overlay {
    padding: 0;
    align-items: stretch;
  }
  .guide-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }
  .guide-modal-body .guide-layout {
    grid-template-columns: 1fr;
  }
  .guide-modal-header {
    padding: 0.85rem 1rem;
  }
  .guide-modal-body {
    padding: 0.75rem 1rem 1rem;
  }
}

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

@media (max-width: 768px) {
  .landing-brand {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  .landing-brand__logo {
    width: 80px;
    height: 80px;
    border-radius: 18px;
  }
  .landing-brand__title {
    font-size: 1.75rem;
  }
  .landing-brand__tagline {
    font-size: 0.9rem;
  }
  .landing-split {
    grid-template-columns: 1fr;
    max-height: none;
    gap: 1rem;
  }
  .showcase-inner {
    min-height: 240px;
    padding: 1.25rem;
  }
  .bento-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .gate-card,
  .gate-card--wide {
    padding: 1.25rem;
  }
  .gate-screen {
    padding: 1rem;
    justify-content: flex-start;
    padding-top: 2rem;
  }
}

.header-tagline .badge {
  font-size: 0.65rem;
  vertical-align: middle;
  margin-right: 0.35rem;
}
.glass-alert {
  position: sticky;
  top: var(--header-h);
  z-index: 99;
  padding: 0.65rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
.glass-alert--warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}
.glass-alert--danger {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
.grace-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(80, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.grace-card {
  width: min(520px, 100%);
  padding: 2rem 1.75rem;
  border-radius: var(--radius);
  border: 2px solid rgba(239, 68, 68, 0.55);
  background: rgba(60, 0, 0, 0.45);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.35);
  text-align: center;
  animation: gateFadeIn 0.4s ease;
}
.grace-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}
.grace-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fecaca;
  margin-bottom: 0.75rem;
}
.grace-message {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #fca5a5;
  margin-bottom: 1.5rem;
}
.activation-meta-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.activation-instruction {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
}
.activation-meta-line {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.5;
}
.activation-meta-line .machine-id-value {
  display: inline-block;
  margin-top: 0.25rem;
  width: 100%;
}
.activation-meta-label {
  font-weight: 600;
  color: var(--text);
}
.activation-meta .btn-secondary {
  width: 100%;
  margin-top: 0.5rem;
}
.license-expiry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.license-expiry-row strong {
  color: var(--accent);
}

@media print {
  .gate-screen { display: none !important; }
  .grace-screen { display: none !important; }
  .glass-alert { display: none !important; }
}

/* Settings tab — side-by-side layout */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.settings-grid .card {
  max-width: none;
  width: 100%;
  margin-top: 0;
}
.settings-grid:has(#userManagementSection.hidden) {
  grid-template-columns: minmax(0, 500px);
}

/* User management (settings) */
.user-mgmt-card {
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
}
.user-mgmt-desc {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.user-add-form {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.user-mgmt-table {
  font-size: 0.85rem;
}
.reset-password-modal {
  max-width: 420px;
}
.reset-password-target {
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

/* ══ MULTI-TENANCY STYLES ═══════════════════════════════════════════════ */

/* Superadmin badge in header */
.superadmin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.5rem;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Tenant badge in header */
.tenant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.45rem;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Tenants table */
.tenants-table .badge-pro        { background: rgba(124,58,237,0.15); color: #a855f7; border: 1px solid rgba(124,58,237,0.3); padding: 0.15rem 0.5rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.tenants-table .badge-enterprise { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); padding: 0.15rem 0.5rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.tenants-table .badge-basic      { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); padding: 0.15rem 0.5rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 20px; }
.status-active   { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.status-inactive { background: rgba(239,68,68,0.10); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }

/* Tenant admin section in modal */
.tenant-admin-section {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  background: rgba(124, 58, 237, 0.07);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-sm);
}

/* Tenants overview wider grid */
.tenants-overview {
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}

/* Super admin body class: wider content area */
body.role-superadmin .sidebar { background: rgba(15, 12, 41, 0.5); }
body.role-superadmin .sidebar::before {
  content: '⚡ SUPER ADMIN';
  display: block;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-align: center;
  color: var(--warning);
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  margin-bottom: 0.3rem;
}

/* Loading animation */
.loading-dots::after {
  content: '...';
  animation: loadingDots 1.2s infinite step-end;
}
@keyframes loadingDots {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
}

/* Btn warning */
.btn-warning { background: rgba(245,158,11,0.12); border: 1px solid var(--warning); color: var(--warning); }
.btn-warning:hover { background: var(--warning); color: #fff; }

/* Text helpers */
.text-end { text-align: left; }
.text-center { text-align: center; }

/* ══ AUDIT LOG STYLES ═══════════════════════════════════════════════════ */
.audit-table { font-size: 0.82rem; }
.audit-table th { font-size: 0.72rem; }
.al-time { color: var(--text-muted); white-space: nowrap; font-size: 0.76rem; }
.al-user { font-weight: 700; color: var(--accent); }
.al-details { font-size: 0.8rem; color: var(--text-muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-path { font-size: 0.72rem; color: var(--text-muted); font-family: monospace; direction: ltr; text-align: left; }
.al-badge { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.12rem 0.45rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.al-create { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.al-delete { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.al-edit   { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.al-pay    { background: rgba(124,58,237,0.12); color: #a855f7; border: 1px solid rgba(124,58,237,0.25); }
.al-info   { background: rgba(6,182,212,0.10); color: var(--accent); border: 1px solid rgba(6,182,212,0.25); }

/* ══ MOBILE IMPROVEMENTS ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Audit log on mobile */
  .audit-table .al-details { max-width: 120px; }
  .audit-table .al-path { display: none; }

  /* Tenant modal on mobile */
  .tenant-admin-section { padding: 0.7rem 0.75rem; }

  /* Tenants overview 2 cols on mobile */
  .tenants-overview { grid-template-columns: 1fr 1fr; }

  /* Invoice detail — stack buttons */
  .debt-pay-box .flex-row-gap-sm { flex-direction: column; }
  .debt-pay-box .flex-row-gap-sm .btn { width: 100%; justify-content: center; }

  /* History action btns */
  .td-actions .btn-secondary { min-width: 36px; }

  /* Audit filters stack */
  #auditLogSection .filter-bar { flex-wrap: wrap; }
  #auditLogSection .filter-bar .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  /* Audit log minimal on small */
  .audit-table .al-time { display: none; }
  .al-badge { padding: 0.08rem 0.3rem; font-size: 0.67rem; }
  .tenants-overview { grid-template-columns: 1fr; }
  
  /* Settings: stack user form */
  .user-add-form .form-row { grid-template-columns: 1fr; }
}

/* Product image upload styling */
.product-image-upload-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
.product-image-preview {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
}
.product-image-file-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

/* Product list thumbnail and dropdown styles */
.prod-list-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.prod-list-thumb-placeholder {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  vertical-align: middle;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.prod-dropdown-thumb {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  margin-left: 0.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.prod-dropdown-thumb-placeholder {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.dd-item-text {
  flex-grow: 1;
}

/* Mobile Bottom Nav Bar */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(20, 18, 30, 0.75);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    padding: 0 10px 10px 10px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
  }
  .mobile-bottom-nav .nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 25%;
    height: 100%;
    padding: 0;
  }
  .mobile-bottom-nav .nav-item:hover,
  .mobile-bottom-nav .nav-item:focus {
    color: var(--accent);
  }
  .mobile-bottom-nav .nav-icon {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
  }
  .mobile-bottom-nav .nav-item:active .nav-icon {
    transform: scale(0.9);
  }
  
  body {
    padding-bottom: 80px !important;
  }
}
