/* ============================================================
   CAYIA — Global Styles
   Colors: Primary #2563EB | Green #10B981 | Purple #8B5CF6
   Font: Inter (Google Fonts)
============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand tokens ── */
  --primary:    #2563EB;
  --primary-dk: #1D4ED8;
  --green:      #10B981;
  --green-dk:   #059669;
  --purple:     #8B5CF6;
  --orange:     #F59E0B;
  --red:        #EF4444;

  /* ── Surface tokens ── */
  --bg:         #F9FAFB;
  --bg-dark:    #111827;
  --surface:    #FFFFFF;
  --surface2:   #F3F4F6;
  --border:     #E5E7EB;
  --text:       #111827;
  --text-muted: #6B7280;
  --text-secondary: #374151;
  --hover:      rgba(0,0,0,.04);
  --input-bg:   #FFFFFF;

  /* ── Semantic aliases (used by skins) ── */
  --accent:     #2563EB;
  --accent-2:   #8B5CF6;
  --success:    #10B981;
  --success-dk: #059669;
  --error:      #EF4444;
  --warning:    #F59E0B;

  /* ── Sidebar tokens (default = dark sidebar) ── */
  --sidebar-bg:          #111827;
  --sidebar-text:        #9ca3af;
  --sidebar-text-active: #93c5fd;
  --sidebar-active-bg:   rgba(37,99,235,.25);
  --sidebar-hover-bg:    rgba(255,255,255,.06);
  --sidebar-logo-text:   #FFFFFF;
  --sidebar-border:      rgba(255,255,255,.08);

  /* ── Topbar token ── */
  --topbar-bg:  #FFFFFF;

  /* ── Chart palette ── */
  --chart-1:   #2563EB;
  --chart-2:   #10B981;
  --chart-3:   #8B5CF6;
  --chart-4:   #F59E0B;
  --chart-5:   #EF4444;

  /* ── Glow (none by default) ── */
  --glow-primary: none;
  --glow-accent:  none;

  /* ── Logo CSS filter (none = full color, correct for light/dark default) ── */
  --logo-filter: none;

  /* ── Auth & hero gradients ── */
  --auth-gradient:  linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 100%);
  --hero-gradient:  linear-gradient(135deg, #1D4ED8 0%, #7C3AED 100%);

  /* ── Layout constants ── */
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --transition: 200ms ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ---- SCREENS ---- */
.screen { display: none; height: 100vh; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }

/* ============================================================
   AUTH
============================================================ */
#screen-auth {
  align-items: center;
  justify-content: center;
  background: var(--auth-gradient);
  min-height: 100vh;
}

.auth-container {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.auth-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.logo-icon { font-size: 28px; color: var(--primary); }
.logo-text  { font-size: 28px; font-weight: 700; letter-spacing: -1px; }

.auth-tagline {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}
.auth-tagline em { font-style: normal; color: var(--primary); font-weight: 600; }

.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.auth-tab { flex: 1; padding: 10px; border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; transition: var(--transition); }
.auth-tab.active { background: var(--primary); color: white; }

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-note { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 12px; }
.verify-email-box { text-align: center; padding: 12px 0; }
.verify-icon { font-size: 56px; margin-bottom: 16px; }
.verify-email-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.verify-email-box p { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.verify-hint { font-size: 12px !important; color: var(--text-muted); }

/* ============================================================
   ONBOARDING
============================================================ */
#screen-onboarding {
  align-items: center;
  justify-content: center;
  background: var(--auth-gradient);
}

.onboarding-container {
  background: var(--surface);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}

.ob-icon { font-size: 56px; text-align: center; margin-bottom: 16px; }
.onboarding-container h2 { text-align: center; font-size: 24px; margin-bottom: 8px; }
.onboarding-container p { text-align: center; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.onboarding-step.hidden { display: none; }

/* ============================================================
   LICENSE SETUP SCREEN
============================================================ */
.lss-box {
  text-align: center;
  padding: 4px 0 8px;
}
.lss-box h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text, #111827);
}
.lss-box p {
  color: var(--text-muted, #6b7280);
  line-height: 1.65;
  margin-bottom: 14px;
  font-size: 14px;
}
.lss-box.hidden { display: none; }

/* Spinner */
.lss-spinner {
  width: 52px;
  height: 52px;
  border: 5px solid var(--border, #e5e7eb);
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: lss-spin 0.75s linear infinite;
  margin: 8px auto 22px;
}
@keyframes lss-spin { to { transform: rotate(360deg); } }

/* Big emoji icon */
.lss-big-icon {
  font-size: 56px;
  margin-bottom: 14px;
  line-height: 1;
}

/* License key display */
.lss-key-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg, #f8fafc);
  border: 2px solid var(--primary, #2563eb);
  border-radius: 12px;
  padding: 13px 18px;
  margin: 10px 0 16px;
}
.lss-key-row code {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary, #2563eb);
  letter-spacing: 1.5px;
  word-break: break-all;
}
.lss-key-row button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 2px 4px;
  flex-shrink: 0;
  border-radius: 6px;
  transition: background 120ms;
}
.lss-key-row button:hover { background: var(--border, #e5e7eb); }

/* Info note under key */
.lss-note {
  font-size: 12px;
  background: var(--bg, #f8fafc);
  border-left: 3px solid var(--primary, #2563eb);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  text-align: left;
  margin-bottom: 20px;
  color: var(--text-muted, #6b7280);
  line-height: 1.7;
}
.lss-note strong { color: var(--text, #111827); }

/* ============================================================
   APP SHELL — Layout
============================================================ */
#screen-app {
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: left var(--transition);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge-trial {
  background: linear-gradient(135deg, var(--purple), var(--primary));
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.btn-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
  filter: var(--logo-filter, none);
  transition: filter var(--transition);
}
.sidebar-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--sidebar-logo-text);
  letter-spacing: -0.5px;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-logo-text); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); }
.nav-item .nav-arrow { margin-left: auto; font-size: 16px; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-sub { display: none; }
.nav-sub.open { display: block; }
.nav-sub-item {
  display: block;
  padding: 7px 20px 7px 50px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: color var(--transition);
}
.nav-sub-item:hover { color: var(--sidebar-logo-text); }

.sidebar-bottom { padding: 12px 0; border-top: 1px solid var(--sidebar-border); }

/* ── Mobile Bottom Navigation ───────────────────────────── */
.mobile-nav {
  display: none; /* hidden by default, shown on max-width:768px */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface, #fff);
  border-top: 1px solid var(--border, #e2e8f0);
  z-index: 110;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.mnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  min-width: 56px;
  color: var(--text-muted, #94a3b8);
  transition: color 120ms;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
.mnav-item.active { color: var(--primary, #6366f1); }
.mnav-item:active { background: var(--bg, #f1f5f9); }
.mnav-icon { font-size: 20px; line-height: 1; }
.mnav-label { font-size: 10px; font-weight: 500; line-height: 1; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  overflow-y: auto;
  height: calc(100vh - var(--topbar-h));
  padding: 28px;
  transition: margin-left var(--transition);
}

.view { display: none; }
.view.active { display: block; }

/* ============================================================
   FORMS & INPUTS
============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-group small { font-size: 11px; color: var(--text-muted); }
.optional { color: var(--text-muted); font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color var(--transition), background var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
input:disabled { background: var(--bg); color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.check-group { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.check-group input { width: auto; }

.input-with-action { display: flex; gap: 8px; }
.input-with-action input { flex: 1; }

.search-input { padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }

/* ============================================================
   BUTTONS
============================================================ */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 80ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--primary-dk); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.full-width { width: 100%; }
.btn-primary.large { padding: 14px 20px; font-size: 16px; }
.btn-primary.small { padding: 6px 12px; font-size: 12px; }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: rgba(37,99,235,.06); }
.btn-secondary.small { padding: 6px 12px; font-size: 12px; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-ghost.small { padding: 6px 12px; font-size: 12px; }
.btn-ghost.full-width { width: 100%; margin-top: 8px; }

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  line-height: 1;
}
.btn-icon:hover { background: var(--bg); }

.btn-danger {
  background: var(--red);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

/* ============================================================
   VIEW HEADERS
============================================================ */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.view-header h1 { font-size: 24px; font-weight: 700; }
.view-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.view-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-title { font-size: 16px; font-weight: 600; margin: 24px 0 12px; }

/* ============================================================
   DASHBOARD
============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 26px; font-weight: 700; font-family: 'Inter', monospace; margin-bottom: 4px; }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.orange { color: var(--orange); }
.stat-value.blue   { color: var(--primary); }
.stat-delta { font-size: 12px; color: var(--text-muted); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.action-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform 80ms;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.action-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(37,99,235,.12); transform: translateY(-2px); }
.action-icon { font-size: 28px; }

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.chart-card.wide { grid-column: 1 / -1; }

/* Dashboard donut chart tab switcher */
.chart-tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.chart-tab {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms;
  white-space: nowrap;
}
.chart-tab:hover { border-color: var(--primary); color: var(--primary); }
.chart-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Seller picker button */
.seller-pick-btn {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms;
  text-align: center;
}
.seller-pick-btn:hover {
  border-color: var(--primary);
  background: rgba(37,99,235,.06);
  color: var(--primary);
}

.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.activity-icon { font-size: 20px; }
.activity-text { flex: 1; }
.activity-amount { font-weight: 700; }
.activity-amount.pos  { color: var(--green); }
.activity-amount.exp  { color: var(--red); }
.activity-amount.inc  { color: var(--primary); }
.activity-time { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   POS / CASHIER
============================================================ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  height: calc(100vh - var(--topbar-h) - 120px);
}

.pos-left { display: flex; flex-direction: column; gap: 12px; }
.pos-scanner-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-scanner-bar input { flex: 1; min-width: 160px; }

.pos-ai-chat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

/* Row wrapper: avatar + bubble */
.chat-row { display: flex; align-items: flex-start; gap: 10px; }
.chat-row.user-row { flex-direction: row-reverse; }

/* Avatar circle */
.chat-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
  margin-top: 2px;
}
.chat-avatar.ai-avatar   { background: linear-gradient(135deg,#6366f1,#8b5cf6); color:#fff; }
.chat-avatar.user-avatar { background: var(--primary); color:#fff; }

/* Bubble */
.chat-msg {
  max-width: calc(100% - 42px);
  padding: 10px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.65; word-break: break-word;
}
.chat-msg.ai {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-top-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.chat-msg.user {
  background: var(--primary); color: white; border-top-right-radius: 4px;
}
.chat-msg.error { background:#FEE2E2; color:#991B1B; border:1px solid #FECACA; }

/* ── Markdown rendered inside AI messages ── */
.chat-msg.ai p            { margin: 0 0 8px; }
.chat-msg.ai p:last-child { margin-bottom: 0; }
.chat-msg.ai .md-spacer   { height: 4px; }
.chat-msg.ai h1 { font-size:15px; font-weight:700; margin:10px 0 4px; }
.chat-msg.ai h2 { font-size:14px; font-weight:700; margin: 8px 0 4px; }
.chat-msg.ai h3 { font-size:13px; font-weight:600; margin: 6px 0 4px; color:var(--text-muted); }
.chat-msg.ai ul,
.chat-msg.ai ol  { margin:4px 0 8px 4px; padding-left:18px; }
.chat-msg.ai li  { margin-bottom:3px; }
.chat-msg.ai code {
  background:rgba(99,102,241,.1); color:#4338ca;
  padding:1px 5px; border-radius:4px;
  font-family:'Consolas','Fira Mono',monospace; font-size:12px;
}
.chat-msg.ai pre {
  background:#1e1e2e; border-radius:8px;
  padding:12px 14px; margin:8px 0; overflow-x:auto;
}
.chat-msg.ai pre code { background:none; color:#cdd6f4; padding:0; font-size:12px; }
.chat-msg.ai blockquote {
  border-left:3px solid var(--primary); padding:4px 10px;
  margin:6px 0; color:var(--text-muted); font-style:italic;
}
.chat-msg.ai hr     { border:none; border-top:1px solid var(--border); margin:10px 0; }
.chat-msg.ai strong { font-weight:700; }
.chat-msg.ai em     { font-style:italic; }
.chat-msg.ai a      { color:var(--primary); text-decoration:underline; }

/* ── Typing indicator (three bouncing dots) ── */
.typing-indicator { display:flex; align-items:center; gap:5px; padding:12px 14px !important; min-width:56px; }
.typing-indicator span {
  width:7px; height:7px; border-radius:50%;
  background:var(--text-muted);
  animation: md-bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay:.2s; }
.typing-indicator span:nth-child(3) { animation-delay:.4s; }
@keyframes md-bounce {
  0%,60%,100% { transform:translateY(0);   opacity:.35; }
  30%          { transform:translateY(-6px); opacity:1;   }
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.chat-input-row input    { flex: 1; }
.chat-input-row textarea { flex: 1; resize: none; min-height: 44px; }
.chat-input-row button:disabled { opacity: .45; cursor: not-allowed; }

/* Cart */
.pos-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.cart-items { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.cart-item-name { flex: 1; font-weight: 500; }
.cart-item-qty { display: flex; align-items: center; gap: 4px; }
.cart-item-qty button { width: 22px; height: 22px; border: 1px solid var(--border); background: white; border-radius: 4px; cursor: pointer; font-size: 14px; line-height: 1; }
.cart-item-qty span { min-width: 24px; text-align: center; font-weight: 600; }
.cart-item-price { font-weight: 700; min-width: 60px; text-align: right; }
.cart-item-del { color: var(--red); background: none; border: none; cursor: pointer; font-size: 16px; padding: 0 4px; }

.cart-totals { padding: 12px 16px; border-top: 1px solid var(--border); }
.cart-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.cart-row.total { font-size: 18px; font-weight: 700; color: var(--primary); padding-top: 8px; border-top: 1.5px solid var(--border); margin-top: 4px; }

.payment-section { padding: 12px 16px; border-top: 1px solid var(--border); }

/* ============================================================
   INVENTORY TABLE
============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); color: var(--text); }
.data-table th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--hover); }

.stock-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.stock-ok   { background: #D1FAE5; color: #065F46; }
.stock-low  { background: #FEF3C7; color: #92400E; }
.stock-zero { background: #FEE2E2; color: #991B1B; }

.alert-banner {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #78350F;
  display: flex;
  gap: 8px;
}
.alert-banner.hidden { display: none; }
.kicked-banner {
  background: #FEE2E2;
  border: 1px solid #EF4444;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #991B1B;
  line-height: 1.5;
}

/* ============================================================
   RECEIPTS
============================================================ */
.receipt-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.receipt-upload-zone:hover { border-color: var(--primary); background: #EFF6FF; }
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.receipt-manual-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.receipt-manual-section h3 { margin-bottom: 16px; }

.receipts-list { display: flex; flex-direction: column; gap: 8px; }
.receipt-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.receipt-item-vendor { font-weight: 600; flex: 1; }
.receipt-item-cat {
  background: #EFF6FF;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.receipt-item-deductible { color: var(--green); font-size: 11px; font-weight: 600; }
.receipt-item-total { font-weight: 700; font-size: 15px; }
.receipt-item-date { color: var(--text-muted); }

/* ============================================================
   INCOME / TAX
============================================================ */
.tax-banner {
  background: var(--hero-gradient);
  border-radius: var(--radius);
  padding: 24px;
  color: white;
  margin-bottom: 24px;
}
.tax-banner-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.tax-banner p { font-size: 13px; opacity: .8; margin-top: 4px; }
.tax-numbers { display: flex; gap: 24px; flex-wrap: wrap; }
.tax-label { display: block; font-size: 11px; opacity: .75; margin-bottom: 2px; }
.tax-val { font-size: 16px; font-weight: 700; }
.tax-val.total { font-size: 22px; color: #FCD34D; }
.tax-label.total { color: #FCD34D; }

/* ============================================================
   AI ADVISOR
============================================================ */
.ai-mode-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mode-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.mode-pill:hover { border-color: var(--purple); color: var(--purple); }
.mode-pill.active { background: var(--purple); color: white; border-color: var(--purple); }

.ai-mode-desc {
  background: #F5F3FF;
  border: 1px solid #DDD6FE;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #4C1D95;
  margin-bottom: 16px;
  line-height: 1.5;
}

.ai-chat-window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 480px;
}
.ai-chat-window .chat-messages { flex: 1; }
.ai-chat-window .chat-input-row { padding: 12px; border-top: 1px solid var(--border); }

.ai-demo-box {
  background: #EFF6FF;
  border: 1px solid #93C5FD;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.6;
  margin-bottom: 4px;
}

.ai-no-key-warning {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   SETTINGS
============================================================ */
.settings-sections { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.settings-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

.subscription-status { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.sub-tier { background: var(--purple); color: white; padding: 4px 14px; border-radius: 20px; font-weight: 600; font-size: 13px; }
.sub-expiry { color: var(--text-muted); font-size: 13px; }

.pricing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.pricing-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 4px 20px rgba(37,99,235,.15); }
.pricing-badge {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.pricing-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.pricing-price { font-size: 28px; font-weight: 700; color: var(--primary); margin-bottom: 14px; }
.pricing-price span { font-size: 14px; color: var(--text-muted); }
.pricing-features { list-style: none; font-size: 12px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 5px; color: var(--text-muted); }

.test-result { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 8px; }
.test-result.success { background: #D1FAE5; color: #065F46; }
.test-result.error   { background: #FEE2E2; color: #991B1B; }
.test-result.hidden  { display: none; }

/* ============================================================
   MODALS
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  overflow: hidden;
}
.modal.narrow { max-width: 420px; }
.modal.wide   { max-width: 760px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-body.center { text-align: center; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.success-icon { font-size: 56px; margin-bottom: 12px; }
.sale-summary { background: var(--bg); border-radius: var(--radius-sm); padding: 14px; margin: 14px 0; font-size: 14px; line-height: 1.8; }

.ai-assist-banner {
  background: #F5F3FF;
  border: 1px solid #DDD6FE;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ai-assist-banner span { font-size: 12px; font-weight: 600; color: var(--purple); white-space: nowrap; }
.ai-assist-banner input { flex: 1; min-width: 200px; }

.barcode-preview { margin-top: 12px; }
.barcode-preview label { font-size: 13px; font-weight: 500; display: block; margin-bottom: 6px; }
.barcode-preview svg { display: block; }

.barcode-print-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 120px;
}
.barcode-label {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  font-size: 10px;
}
.barcode-label svg { width: 100%; }

/* ============================================================
   TOAST
============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-dark);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 250ms ease;
  max-width: 320px;
}
.toast.success { background: var(--green-dk); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   UTILITIES
============================================================ */
.hidden { display: none !important; }
.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 28px 16px;
}
.empty-state.small { padding: 16px; }

/* ============================================================
   SIDEBAR BACKDROP (mobile overlay to close sidebar on tap-outside)
============================================================ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
  backdrop-filter: blur(1px);
}
/* Only shown on mobile — desktop sidebar is always visible, no overlay needed */
@media (max-width: 768px) {
  .sidebar-backdrop.open { display: block; }
}

/* ============================================================
   SETTINGS TABS
============================================================ */
.settings-tabs-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs-nav::-webkit-scrollbar { display: none; }

.stab {
  flex-shrink: 0;
  padding: 9px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color 120ms, border-color 120ms;
  white-space: nowrap;
}
.stab:hover { color: var(--text); background: var(--bg); }
.stab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ============================================================
   RESPONSIVE — Collapse sidebar on small screens
============================================================ */
/* Desktop sidebar collapse (hamburger click hides sidebar for more space) */
.sidebar.collapsed { transform: translateX(-100%); }
.topbar.sidebar-collapsed  { left: 0; }
.main-content.sidebar-collapsed { margin-left: 0; }

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .main-content { margin-left: 0; padding-bottom: 84px; } /* space for mobile nav + safe area */
  .pos-layout { grid-template-columns: 1fr; height: auto; padding-bottom: 84px; }
  .charts-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stab { padding: 8px 13px; font-size: 12px; }

  /* Mobile bottom nav */
  .mobile-nav { display: flex; }
  #btn-sidebar-toggle { display: inline-block; }

  /* SmartAssist positioned above mobile nav */
  #sa-root { bottom: 76px; right: 12px; }
  .sa-panel { width: calc(100vw - 24px); right: -6px; height: 420px; }
  .sa-panel.sa-expanded { width: calc(100vw - 24px); height: 520px; }

  /* Tables → cards on mobile */
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 6px 4px; }
  .data-table thead { display: none; }
  .data-table tbody tr {
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: var(--surface);
  }
  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light, #eee);
  }
  .data-table tbody td:last-child { border-bottom: none; }
  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 10px;
    margin-right: 8px;
    flex-shrink: 0;
  }

  /* Modals fill screen */
  .modal {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  .modal-content { padding: 16px; }
  .modal-body { max-height: calc(100vh - 140px); }

  /* Forms single column */
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-group { min-width: 0; }
}

/* ── Small phones (iPhone SE, etc.) ───────────────────── */
@media (max-width: 480px) {
  .topbar-title { font-size: 14px; }
  .topbar { padding: 0 10px; height: 50px; }
  .topbar-right { gap: 2px; }
  .sync-badge { padding: 3px 7px; font-size: 10px; }
  .btn-avatar { width: 32px; height: 32px; font-size: 12px; }

  .modal-body { max-height: calc(100vh - 120px); }
  .section-title { font-size: 16px; }
  .card { padding: 12px; }

  /* Single column stats */
  .stats-grid { grid-template-columns: 1fr; }

  /* Smaller mobile nav */
  .mnav-item { padding: 4px 0; }
  .mnav-label { font-size: 9px; }
  .mnav-icon { font-size: 16px; }

  /* Full-width modals on mobile */
  .modal-overlay { padding: 4px; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 16px 16px 8px 8px; max-height: 85vh; }
  .modal.wide { max-width: 100%; }
  .modal-header { padding: 12px 16px; }
  .modal-header h3 { font-size: 14px; }
  .modal-body { padding: 14px 12px; }
  .modal-footer { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }
  .modal-footer button { font-size: 12px; padding: 8px 14px; }

}

/* ── Tablet (between mobile and desktop) ───────────────── */
@media (min-width: 769px) {
  .mobile-nav { display: none; }
  #btn-sidebar-toggle { display: none; }
}

@media print {
  .topbar, .sidebar, .modal-overlay, .mobile-nav { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  body { background: white; }
}

/* ============================================================
   SYNC BADGE
============================================================ */
.sync-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.sync-badge:hover { border-color: var(--primary); color: var(--primary); }
.sync-badge[data-status="connected"] { border-color: var(--green); color: var(--green-dk); }
.sync-badge[data-status="error"]     { border-color: var(--red); color: var(--red); }
.sync-badge[data-status="connecting"]{ border-color: var(--orange); color: var(--orange); }

/* ============================================================
   CHAT HEADER ROW (POS + Advisor clear buttons)
============================================================ */
.chat-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
}
.chat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ============================================================
   AI DIAGNOSTICS PANEL
============================================================ */
.ai-diagnostics {
  margin: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
}
.diagnostics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.diagnostics-body {
  padding: 4px 0;
}
.diagnostics-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
}
.diagnostics-row:last-child { border-bottom: none; }
.diag-label { color: var(--text-muted); }
.diag-value { color: var(--text); font-weight: 500; font-family: monospace; }

/* ============================================================
   PRODUCT BROWSER MODAL
============================================================ */
.product-browser-list { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; }
.browser-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  gap: 12px;
}
.browser-item.out-of-stock { opacity: .55; background: var(--bg); }
.browser-item-info { flex: 1; min-width: 0; }
.browser-item-name { font-weight: 600; font-size: 14px; }
.browser-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.full-width { width: 100%; }

/* ============================================================
   LICENSE / SYNC SETUP
============================================================ */
.license-display {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  color: var(--primary);
  word-break: break-all;
}

/* ============================================================
   SEARCH INPUT UTILITY
============================================================ */
.search-input.full-width { width: 100%; }

/* ============================================================
   ADVISOR LOG PANEL
============================================================ */
.advisor-log-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.advisor-log-entries {
  max-height: 320px;
  overflow-y: auto;
  padding: 0 16px 12px;
}
.log-entry {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.log-entry:last-child { border-bottom: none; }
.log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.log-who { font-weight: 600; font-size: 13px; color: var(--primary); }
.log-time { font-size: 11px; color: var(--text-muted); }
.log-changes { list-style: none; padding: 0; margin: 0; }
.log-changes li { font-size: 12px; color: var(--text-muted); padding: 2px 0; }
.log-changes li::before { content: ''; }

/* ============================================================
   DEVICE PANEL (Settings → Sync & Devices)
============================================================ */
.device-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.device-plan-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.plan-pill { background: rgba(37,99,235,.1); color: var(--primary); font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 99px; }
.primary-badge { background: rgba(245,158,11,.12); color: #b45309; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.device-quota { font-size: 13px; color: var(--text-muted); }
.device-quota strong { color: var(--text); }
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-item { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.device-item.device-current { border-color: var(--primary); background: rgba(37,99,235,.04); }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 13px; font-weight: 600; display: block; }
.device-user { font-size: 12px; color: var(--primary); display: block; margin-top: 1px; }
.device-meta { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }
.btn-kick { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.2); border-radius: var(--radius-sm); padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--transition); }
.btn-kick:hover { background: var(--red); color: #fff; }

/* ============================================================
   NOTIFICATIONS
============================================================ */
.notif-wrapper { position: relative; }
#btn-notifications { position: relative; font-size: 18px; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 99px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.notification-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 9999;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-title { font-size: 13px; font-weight: 700; color: var(--text); }
.notif-actions { display: flex; gap: 6px; }
.btn-ghost-sm {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.notif-list { overflow-y: auto; flex: 1; padding: 6px 0; }
.notif-empty { font-size: 13px; color: var(--text-muted); text-align: center; padding: 20px; }
.notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--hover); }
.notif-read { opacity: 0.6; }
.notif-item-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.notif-who { font-size: 12px; font-weight: 600; color: var(--primary); }
.notif-when { font-size: 11px; color: var(--text-muted); flex-shrink: 0; margin-left: 8px; }
.notif-summary { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.notif-rejoin { border-left: 3px solid #F59E0B; background: rgba(245,158,11,.04); }
.notif-rejoin-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-approve-rejoin {
  flex: 1; background: rgba(16,185,129,.1); color: #065F46;
  border: 1px solid rgba(16,185,129,.3); border-radius: var(--radius-sm);
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background var(--transition);
}
.btn-approve-rejoin:hover { background: #10B981; color: #fff; }
.btn-deny-rejoin {
  flex: 1; background: rgba(239,68,68,.08); color: #991B1B;
  border: 1px solid rgba(239,68,68,.2); border-radius: var(--radius-sm);
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background var(--transition);
}
.btn-deny-rejoin:hover { background: var(--red); color: #fff; }

/* ============================================================
   DASHBOARD — Welcome / Get Started card
============================================================ */
.dash-welcome-card {
  background: linear-gradient(135deg, var(--primary, #2563eb) 0%, var(--purple, #7c3aed) 100%);
  border-radius: 14px;
  padding: 20px 20px 16px;
  color: #fff;
  margin-bottom: 4px;
}
.dwc-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  opacity: 0.95;
}
.dwc-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dwc-step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 150ms;
  width: 100%;
}
.dwc-step:hover { background: rgba(255,255,255,0.28); }
.dwc-num {
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   LANDING VIEWS (Cashier / Management)
============================================================ */
.landing-message {
  text-align: center;
  padding: 48px 24px 32px;
  max-width: 480px;
  margin: 0 auto;
}
.landing-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 16px;
}
.landing-message h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.landing-message p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   RECEIPT UPLOAD — camera button row
============================================================ */
.upload-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

/* ============================================================
   RECEIPT CONFIRMATION MODAL
============================================================ */
.receipt-confirm-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.receipt-preview-col {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.receipt-img-wrap {
  width: 200px;
  min-height: 260px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.receipt-img-wrap img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
.receipt-preview-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
.receipt-ai-badge {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.receipt-fields-col {
  flex: 1;
  min-width: 0;
}
.rc-items-list {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  max-height: 140px;
  overflow-y: auto;
}
.rc-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.rc-item-row:last-child { border-bottom: none; }
.rc-item-desc { flex: 1; color: var(--text); }
.rc-item-qty  { color: var(--text-muted); font-size: 11px; }
.rc-item-price { font-weight: 600; color: var(--text); }

/* ============================================================
   RECEIPT LIST — card style with thumbnail
============================================================ */
.receipt-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.receipt-item:last-child { border-bottom: none; }
.receipt-thumb {
  width: 56px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: zoom-in;
}
.receipt-thumb-placeholder {
  width: 56px;
  height: 70px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.receipt-item-body { flex: 1; min-width: 0; }
.receipt-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.receipt-item-vendor { font-weight: 600; font-size: 14px; color: var(--text); }
.receipt-item-total  { font-weight: 700; font-size: 15px; color: var(--primary); flex-shrink: 0; }
.receipt-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.receipt-item-cat {
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.receipt-item-date  { font-size: 12px; color: var(--text-muted); }
.receipt-item-deductible { font-size: 11px; color: #059669; font-weight: 600; }
.receipt-item-items { font-size: 11px; color: var(--text-muted); }
.receipt-item-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ============================================================
   CAMERA MODAL
============================================================ */
#camera-video {
  width: 100%;
  max-height: 340px;
  border-radius: var(--radius);
  background: #000;
  object-fit: cover;
}

@media (max-width: 640px) {
  .receipt-confirm-layout { flex-direction: column; }
  .receipt-preview-col    { flex: unset; width: 100%; }
  .receipt-img-wrap       { width: 100%; min-height: 180px; }
}

/* ============================================================
   SMART ASSIST — Floating Local AI Chat
============================================================ */

/* ---- Floating Action Button ---- */
#sa-root { position: fixed; bottom: 24px; right: 24px; z-index: 9000; font-family: var(--font, 'Inter', sans-serif); }

.sa-fab {
  width:  56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary, #2563eb), var(--purple, #7c3aed));
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37,99,235,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.sa-fab:hover  { transform: scale(1.08); box-shadow: 0 6px 28px rgba(37,99,235,.5); }
.sa-fab:active { transform: scale(0.96); }
.sa-fab-busy   { animation: sa-pulse 1s ease-in-out infinite; }
@keyframes sa-pulse {
  0%,100% { box-shadow: 0 4px 20px rgba(37,99,235,.4); }
  50%      { box-shadow: 0 4px 32px rgba(37,99,235,.8); }
}

.sa-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid white;
}
.sa-badge.hidden { display: none; }

/* ---- Chat Panel ---- */
.sa-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  height: 520px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 220ms ease, height 220ms ease;
  animation: sa-slide-in 160ms ease;
}
.sa-panel.hidden { display: none; }

/* Expanded mode */
.sa-panel.sa-expanded {
  width:  500px;
  height: 640px;
}
.sa-panel.sa-expanded .sa-quick-chips {
  flex-wrap: wrap;
  max-height: 80px;
}
.sa-panel.sa-expanded .sa-input { font-size: 14px; }
@keyframes sa-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ---- Header ---- */
.sa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary, #2563eb), var(--purple, #7c3aed));
  color: white;
  flex-shrink: 0;
}
.sa-header-left    { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.sa-header-brain   { font-size: 18px; flex-shrink: 0; }
.sa-header-title   { font-size: 15px; font-weight: 700; white-space: nowrap; }
.sa-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sa-local-badge   {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3); white-space: nowrap;
}
.sa-icon-btn {
  background: rgba(255,255,255,.15); border: none; color: white;
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms;
  flex-shrink: 0;
}
.sa-icon-btn:hover { background: rgba(255,255,255,.3); }
/* keep legacy .sa-close working as alias */
.sa-close { background: rgba(255,255,255,.15); border: none; color: white;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center; transition: background 120ms; }
.sa-close:hover { background: rgba(255,255,255,.3); }

/* ---- Messages ---- */
.sa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.sa-messages::-webkit-scrollbar { width: 4px; }
.sa-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sa-msg-row { display: flex; max-width: 92%; }
.sa-msg-user  { align-self: flex-end; justify-content: flex-end; }
.sa-msg-ai    { align-self: flex-start; }

.sa-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.sa-msg-user .sa-bubble {
  background: var(--primary, #2563eb);
  color: white;
  border-bottom-right-radius: 4px;
}
.sa-msg-ai .sa-bubble {
  background: var(--bg, #f8fafc);
  border: 1px solid var(--border, #e5e7eb);
  color: var(--text, #111827);
  border-bottom-left-radius: 4px;
  max-width: 100%;
}

/* ---- Typing indicator ---- */
.sa-typing { display: flex; gap: 5px; align-items: center; padding: 12px 16px; }
.sa-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted, #9ca3af);
  animation: sa-bounce 1.2s ease-in-out infinite;
}
.sa-typing span:nth-child(2) { animation-delay: .2s; }
.sa-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes sa-bounce {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-6px); }
}

/* ---- Quick chips row ---- */
.sa-quick-chips {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.sa-quick-chips::-webkit-scrollbar { display: none; }

/* ---- Input row ---- */
.sa-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.sa-input {
  flex: 1;
  border: 1.5px solid var(--border, #e5e7eb);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  background: var(--bg, #f8fafc);
  transition: border-color 120ms;
}
.sa-input:focus { border-color: var(--primary, #2563eb); }
.sa-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary, #2563eb);
  color: white;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 120ms;
}
.sa-send:hover { background: #1d4ed8; }

/* ---- Chip buttons ---- */
.sa-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border: 1.5px solid var(--primary, #2563eb);
  border-radius: 16px;
  background: transparent;
  color: var(--primary, #2563eb);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
}
.sa-chip:hover { background: var(--primary, #2563eb); color: white; }

/* ---- Response card ---- */
.sa-card {
  font-size: 13px;
  line-height: 1.55;
}
.sa-card p { margin: 0 0 8px; }
.sa-card ul { margin: 6px 0 0 14px; padding: 0; }
.sa-card li { margin-bottom: 3px; }

.sa-total    { font-size: 13px; font-weight: 600; color: var(--text-muted, #6b7280); margin-bottom: 6px; }
.sa-big-num  { font-size: 22px; font-weight: 700; color: var(--primary, #2563eb); margin: 6px 0 10px; }
.sa-highlight { font-size: 14px; font-weight: 600; margin: 4px 0; }
.sa-meta     { font-size: 11px; color: var(--text-muted, #6b7280); margin-top: 6px; }
.sa-note     { font-size: 11px; color: var(--text-muted, #6b7280); margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border, #e5e7eb); }

/* ---- Breakdown rows ---- */
.sa-breakdown { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.sa-breakdown-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 3px 0;
  color: var(--text, #374151);
}
.sa-breakdown-row.sa-warn   { color: #d97706; }
.sa-breakdown-row.sa-danger { color: #dc2626; }
.sa-breakdown-row.sa-pos    { color: #059669; }
.sa-breakdown-row.sa-deduct { color: #059669; }
.sa-breakdown-row.sa-net    { color: var(--primary, #2563eb); font-weight: 600; }
.sa-divider {
  height: 1px; background: var(--border, #e5e7eb);
  margin: 4px 0;
}

/* ---- Tables ---- */
.sa-table {
  width: 100%; border-collapse: collapse;
  font-size: 11px; margin-top: 8px;
}
.sa-table th {
  text-align: left; padding: 5px 6px;
  border-bottom: 2px solid var(--border, #e5e7eb);
  font-weight: 600; color: var(--text-muted, #6b7280);
  white-space: nowrap;
}
.sa-table td { padding: 5px 6px; border-bottom: 1px solid var(--border, #e5e7eb); vertical-align: middle; }
.sa-table tfoot td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: none; }
.sa-table tr:last-child td { border-bottom: none; }

.sa-tax-table .sa-row-deduct td { color: #059669; }
.sa-tax-table .sa-row-net    td { color: var(--primary); font-weight: 700; }
.sa-tax-table .sa-row-sep    td { padding: 2px 0; background: var(--border); height: 1px; }
.sa-tax-table .sa-row-danger td { color: #dc2626; font-weight: 700; }

/* ---- Bar charts in tables ---- */
.sa-bar-wrap {
  width: 60px; height: 6px;
  background: var(--border, #e5e7eb);
  border-radius: 3px;
  display: inline-block; vertical-align: middle; margin-right: 6px;
}
.sa-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary, #2563eb), var(--purple, #7c3aed));
  transition: width 400ms ease;
}

/* ---- Platform bars ---- */
.sa-plat-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sa-plat-row  { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.sa-plat-name { min-width: 90px; font-weight: 500; }
.sa-plat-bar-wrap {
  flex: 1; height: 8px; background: var(--border, #e5e7eb);
  border-radius: 4px; overflow: hidden;
}
.sa-plat-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary, #2563eb), var(--purple, #7c3aed));
  min-width: 4px; transition: width 400ms ease;
}
.sa-plat-pct { width: 36px; text-align: right; color: var(--text-muted); font-size: 11px; }
.sa-plat-amt { width: 64px; text-align: right; font-weight: 600; font-size: 11px; }

/* ---- Help list ---- */
.sa-help-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sa-help-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
  font-size: 12px; cursor: pointer;
  transition: background 120ms;
}
.sa-help-item:hover { background: var(--bg, #f8fafc); }
.sa-help-item span  { color: var(--text, #374151); }

/* ---- Chips inside response ---- */
.sa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---- Mobile ---- */
@media (max-width: 480px) {
  #sa-root { bottom: 16px; right: 16px; }
  .sa-panel {
    width:  calc(100vw - 32px);
    height: 72vh;
    bottom: 72px;
    right:  0;
  }
  .sa-panel.sa-expanded {
    width:  calc(100vw - 16px);
    height: 88vh;
    right: -8px;
  }
}

/* ---- AI Advisor quick-reply chips ---- */
.advisor-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
  margin-left: 44px; /* align with AI bubble */
}
.advisor-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1.5px solid var(--primary, #2563eb);
  border-radius: 14px;
  background: transparent;
  color: var(--primary, #2563eb);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
}
.advisor-chip:hover {
  background: var(--primary, #2563eb);
  color: white;
}


/* POS cashier quick-switch bar */
#btn-change-cashier:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* Seller Picker Styles */
.seller-picker-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 0;
}

.seller-pick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seller-pick-btn:hover {
  background: var(--primary, #2563eb);
  color: white;
  border-color: var(--primary, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.seller-pick-btn:active {
  transform: translateY(0);
}

/* Toggle switch (used in Team Cashiers settings) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border, #d1d5db);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary, #2563eb);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ============================================================
   CHECKOUT MODAL STYLES (v1.0.8)
============================================================ */
.checkout-modal {
  max-width: 460px;
  width: 100%;
  animation: checkout-slide-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkout-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.checkout-section {
  margin-bottom: 16px;
}

.checkout-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Items list */
.checkout-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 2px;
}

.checkout-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2, #f8fafc);
  border-radius: 8px;
  font-size: 13px;
}

.checkout-item-qty {
  font-weight: 700;
  color: var(--primary, #2563eb);
  min-width: 24px;
  text-align: center;
  background: var(--primary-light, #eff6ff);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
}

.checkout-item-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.checkout-item-price {
  font-weight: 600;
  color: var(--text);
}

/* Totals */
.checkout-totals {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkout-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.checkout-grand-total {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-top: 6px;
  padding-top: 8px;
  border-top: 2px solid var(--border);
}

/* Payment + Cashier badges */
.checkout-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.checkout-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Cash section */
.checkout-cash-section {
  background: var(--surface-2, #f8fafc);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 4px;
}

.checkout-cash-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cash-prefix {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-muted);
}

.checkout-cash-input {
  flex: 1;
  font-size: 24px;
  font-weight: 700;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  text-align: right;
  color: var(--text);
  background: var(--bg, #fff);
  transition: border-color 0.2s;
}

.checkout-cash-input:focus {
  border-color: var(--primary, #2563eb);
  outline: none;
}

.checkout-change-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
}

.change-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.change-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-muted);
  transition: color 0.2s;
}

.change-amount.ready {
  color: #10b981;
}

.change-amount.insufficient {
  color: #ef4444;
}

/* Footer */
.checkout-footer {
  display: flex;
  gap: 10px;
}

.checkout-confirm-btn {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  padding: 12px;
}

.checkout-confirm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.text-green { color: #10b981; }

/* ============================================================
   PROJECT CONTRACTS MODULE
============================================================ */
.contracts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}
.contract-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.contract-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-2px);
}
.contract-card-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 8px;
}
.cstatus-active  { background: #dcfce7; color: #166534; }
.cstatus-paused  { background: #fef9c3; color: #854d0e; }
.cstatus-done    { background: #e0e7ff; color: #3730a3; }

.contracts-filter-tab {
  padding: 4px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.contracts-filter-tab:hover { border-color: var(--accent); color: var(--accent); }
.contracts-filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Terms & Agreements modal — language toggle */
.terms-lang-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.terms-lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.terms-lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* EN is default: .tl-es hidden, .tl-en visible */
.tl-es { display: none; }
.tl-en { display: revert; }
/* When modal has .terms-lang-es class, flip visibility */
#modal-terms.terms-lang-es .tl-en { display: none; }
#modal-terms.terms-lang-es .tl-es { display: revert; }

/* Terms & Agreements modal checkboxes */
.terms-check-row:has(input:checked) {
  border-color: var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg)) !important;
}

/* ============================================================
   SKIN PICKER (Settings → Appearance)
============================================================ */
.skin-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.skin-option {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 8px 10px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.skin-option:hover { border-color: var(--primary); transform: translateY(-2px); }
.skin-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
.skin-preview {
  width: 100%;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}
.sp-sidebar { width: 22px; flex-shrink: 0; }
.sp-main { flex: 1; display: flex; flex-direction: column; }
.sp-topbar { height: 12px; flex-shrink: 0; }
.sp-body { flex: 1; padding: 4px 3px; display: flex; flex-direction: column; gap: 3px; }
.sp-card { border-radius: 3px; height: 11px; }
.sp-accent-bar { height: 3px; flex-shrink: 0; }
.skin-name { font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.2; }
.skin-active-badge {
  display: inline-block;
  font-size: 10px;
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
}
.settings-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.contracts-detail-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.contracts-main-col { flex: 1; min-width: 0; }
.contracts-chat-col {
  width: 288px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}
@media (max-width: 900px) {
  .contracts-detail-layout { flex-direction: column; }
  .contracts-chat-col { width: 100%; position: static; }
}

.budget-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

.cd-expense-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.cd-add-dropdown {
  position: relative;
}
.cd-add-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  min-width: 170px;
  overflow: hidden;
}
.cd-add-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.cd-add-option:hover { background: var(--bg); }

/* ============================================================
   PLAN FEATURE GATING — locked nav items
============================================================ */
.nav-lock-icon { display: none; margin-left: auto; font-size: 11px; opacity: .7; }

.nav-item.locked {
  opacity: .55;
  cursor: pointer; /* keep pointer so click fires upgrade prompt */
}
.nav-item.locked:hover { opacity: .75; }
.nav-item.locked .nav-lock-icon { display: inline; }
/* prevent the locked class from opening the sub-nav */
.nav-item.locked .nav-arrow { display: none; }

.nav-sub-item.locked {
  opacity: .45;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
}
.nav-sub-item.locked::after {
  content: '🔒';
  font-size: 10px;
  margin-left: 6px;
  opacity: .7;
}

/* Sync badge locked */
#sync-badge.locked { opacity: .5; }

/* ============================================================
   SUBSCRIPTION STATUS BANNER
============================================================ */
.sub-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.sub-status-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sub-status-right { display: flex; align-items: center; }

.sub-tier-pill {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--primary, #2563EB);
  color: #fff;
  white-space: nowrap;
}

.sub-expiry-txt {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================
   PRICING CARDS — current plan highlight
============================================================ */
.pricing-card.current-plan {
  border: 2px solid var(--success, #10b981);
  position: relative;
}
.pricing-card.current-plan::before {
  content: '✓ Current Plan';
  position: absolute;
  top: -1px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--success, #10b981);
  background: var(--surface);
  padding: 0 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.feat-locked {
  color: var(--text-muted);
  opacity: .6;
}

/* ============================================================
   UPGRADE PROMPT MODAL overlay
============================================================ */
#modal-upgrade-prompt .modal,
#modal-cancel-sub .modal,
#modal-team-perms .modal {
  animation: cayiaFloatSoft 0s; /* neutralize float on these modals */
}

/* ============================================================
   TEAM TAB — member rows & pending requests
============================================================ */
.team-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.team-member-info { flex: 1; min-width: 0; }
.team-member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-member-device {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.team-member-perms {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-style: italic;
}
.team-member-actions { display: flex; gap: 6px; flex-shrink: 0; }
.team-owner-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #dbeafe;
  color: #1d4ed8;
  flex-shrink: 0;
}
.team-pending-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 8px;
}
.team-pending-info { flex: 1; min-width: 0; }
.team-pending-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
