/* ============================================================
   LoanFinal — Emerald Fresh theme (light, lively, eye-comfort)
   Light theme · deep indigo primary · offline-first PWA
   Vanilla CSS, no dependencies.
   ============================================================ */

:root {
  --primary: #FF4D00;
  --primary-dark: #D63F00;
  --primary-darker: #0B0B10;
  --bg: #F7F7F8;
  --card: #FFFFFF;
  --text: #0B0B10;
  --text-muted: #5C5C66;
  --border: #E6E6EA;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(11, 11, 16, 0.07), 0 4px 12px rgba(11, 11, 16, 0.05);
  --shadow-lg: 0 8px 28px rgba(11, 11, 16, 0.16);
  --green: #22C55E; --green-bg: #DCFCE7;
  --red: #CE4B2A;   --red-bg: #FBEBE6;
  --amber: #B97E14; --amber-bg: #FBF3D9;
  --blue: #2563EB;  --blue-bg: #E3ECFD;
  --gray: #6B7280;  --gray-bg: #F3F4F6;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; min-height: 44px; /* big touch targets */
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #FF4D00; color: #fff; box-shadow: 0 4px 14px rgba(255,77,0,.35); border: none; }
.btn-primary:hover { background: #D63F00; box-shadow: 0 6px 18px rgba(255,77,0,.45); }
.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: #F4F4F5; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #B23F22; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 7px 12px; min-height: 36px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: none; background: transparent; color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--gray-bg); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; color: var(--text); }
input:not([type]), input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="tel"], select, textarea {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: var(--font); background: #fff; color: var(--text);
  min-height: 46px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,77,0,.15);
}
textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; min-width: 0; }
.form-error { color: var(--red); font-size: 13.5px; min-height: 20px; margin: 4px 0 8px; font-weight: 500; }
.form-hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--primary-darker);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='2' cy='2' r='1.6' fill='%23FFFFFF' fill-opacity='0.08'/%3E%3C/svg%3E");
  background-size: 26px 26px;
}
.login-card {
  background: #fff; border-radius: 18px; padding: 32px 30px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-logo-mark {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  background: var(--primary-darker);
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo h1 { margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.login-logo p { margin: 2px 0 0; color: var(--text-muted); font-size: 13.5px; }
.tabs { display: flex; gap: 6px; background: var(--gray-bg); border-radius: 12px; padding: 5px; margin-bottom: 20px; }
.tab {
  flex: 1; border: none; background: transparent; border-radius: 9px;
  padding: 10px; font-size: 14.5px; font-weight: 600; font-family: var(--font);
  color: var(--text-muted); cursor: pointer; min-height: 42px;
}
.tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.login-note { text-align: center; color: var(--text-muted); font-size: 13px; margin: 18px 0 0; }
.login-note a { color: var(--primary); font-weight: 600; text-decoration: none; }
.login-note a:hover { text-decoration: underline; }

/* ---------- App layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 16px;
  background: #fff; border-bottom: 1px solid var(--border);
}
#hamburger { display: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-darker);
  color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
img.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  object-fit: contain; background: #fff; box-shadow: var(--shadow);
}
img.login-logo-img {
  width: 56px; height: 56px; border-radius: 14px; flex: none;
  object-fit: contain; background: #fff; box-shadow: var(--shadow);
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; color: var(--primary-darker); }
.topbar-spacer { flex: 1; }

.offline-banner {
  background: var(--amber-bg); color: #92400E; border: 1px solid #E8D194;
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* one-tap update banner — fixed top, non-intrusive */
.update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #FF4D00; color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 9px 14px; box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.update-banner.hidden { display: none; }
.update-banner .btn { padding: 5px 12px; font-size: 12.5px; }

.sync-badge {
  border: none; cursor: default; border-radius: 999px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 700; font-family: var(--font);
  white-space: nowrap;
}
.sync-green { background: var(--green-bg); color: #15803D; }
.sync-orange { background: var(--amber-bg); color: #D98E1F; }
.sync-gray { background: var(--gray-bg); color: var(--gray); }

.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 5px 12px 5px 5px; cursor: pointer; font-family: var(--font);
}
.user-chip:hover { background: var(--gray-bg); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.user-meta span { font-size: 14px; font-weight: 700; }
.user-meta small { font-size: 11.5px; color: var(--text-muted); text-transform: capitalize; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 220px; overflow: hidden; z-index: 60;
}
.dropdown-head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dropdown-head strong { display: block; font-size: 14.5px; }
.dropdown-head small { color: var(--text-muted); font-size: 12.5px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; border: none; background: none;
  font-size: 14.5px; font-family: var(--font); font-weight: 600;
  color: var(--red); cursor: pointer; text-align: left;
}
.dropdown-item:hover { background: #FEF2F2; }

.app-body { display: flex; min-height: calc(100vh - 64px); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px; flex: none;
  background: #FFFFFF;
  color: var(--text);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 64px; height: calc(100vh - 64px);
}
.nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  color: #55645C; text-decoration: none; font-size: 15px; font-weight: 600;
  min-height: 48px;
}
.nav-link svg { flex: none; opacity: 0.85; }
.nav-link:hover { background: #F4F4F5; color: #D63F00; }
.nav-link.active { background: #FFF1E9; color: #D63F00; box-shadow: inset 3px 0 0 #FF4D00; }
.nav-link.nav-locked { opacity: 0.75; }
.nav-link .nav-lock { margin-left: auto; display: flex; opacity: 0.9; }
.nav-link .nav-lock svg { width: 14px; height: 14px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--border); }
.sidebar-update-btn { width: 100%; margin-top: 10px; justify-content: center; }
.lang-row { margin: 8px 0 4px; display: flex; }
.lang-toggle {
  background: #EFF5F0; color: #D63F00; border: 1px solid #CFE3D6;
  border-radius: 20px; padding: 6px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.2s;
}
.lang-toggle:hover { background: #FFF1E9; }
/* RTL: flip sidebar to the right for Urdu */
html[dir="rtl"] .sidebar { left: auto; right: 0; }
html[dir="rtl"] .app-body { flex-direction: row-reverse; }
html[dir="rtl"] .view-head { text-align: right; }
html[dir="rtl"] .nav-link { flex-direction: row-reverse; }
html[dir="rtl"] .nav-link .nav-lock { margin-left: 0; margin-right: auto; }
/* RTL fix: Latin inputs ALWAYS stay LTR (username, email, password, phone, search, numbers) */
html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="search"],
html[dir="rtl"] input:not([type]),
html[dir="rtl"] textarea,
html[dir="rtl"] select { direction: ltr; text-align: left; }
html[dir="rtl"] input::placeholder,
html[dir="rtl"] textarea::placeholder { direction: ltr; text-align: left; }
/* brand names, codes, invoice numbers stay LTR */
html[dir="rtl"] .brand, html[dir="rtl"] .logo-text,
html[dir="rtl"] code, html[dir="rtl"] .mono { direction: ltr; unicode-bidi: embed; }
/* login/signup marketing panel is English content — keep LTR in Urdu mode */
html[dir="rtl"] .signup-side { direction: ltr; text-align: left; }
html[dir="rtl"] .signup-side * { text-align: left; }
/* Urdu labels stay RTL, but their Latin placeholders don't flip punctuation */
html[dir="rtl"] label { unicode-bidi: plaintext; }
.sidebar-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--text-muted); }
.sidebar-dev { margin: 6px 0 0; font-size: 11.5px; color: var(--text-muted); }
.sidebar-dev a { color: #D63F00; font-weight: 800; text-decoration: none; letter-spacing: .3px; }
.sidebar-dev a:hover { color: #FF4D00; text-decoration: underline; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 48; }

/* ---------- Main content ---------- */
.content { flex: 1; min-width: 0; padding: 24px; max-width: 1180px; margin: 0 auto; width: 100%; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.view-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.view-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 17px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; display: flex; gap: 14px; align-items: center;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.stat-icon.indigo { background: var(--primary-darker); }
.stat-icon.red { background: #B23F22; }
.stat-icon.amber { background: #D98E1F; }
.stat-icon.green { background: #FF4D00; }
.stat-body small { display: block; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.stat-body strong { font-size: 22px; letter-spacing: -0.5px; }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; padding: 4px 11px;
  border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.pill-green { background: var(--green-bg); color: #15803D; }
.pill-red { background: var(--red-bg); color: #B23F22; }
.pill-amber { background: var(--amber-bg); color: #D98E1F; }
.pill-blue { background: var(--blue-bg); color: #FF4D00; }
.pill-gray { background: var(--gray-bg); color: #4B5563; }
.plan-badge .pill { font-size: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
thead th { background: #F8FAFC; color: var(--text-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFF; }
td .cell-sub { display: block; color: var(--text-muted); font-size: 12.5px; font-weight: 400; }
tr.clickable { cursor: pointer; }

/* Filter tabs */
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1.5px solid var(--border); background: #fff; border-radius: 999px;
  padding: 8px 16px; font-size: 14px; font-weight: 600; font-family: var(--font);
  color: var(--text-muted); cursor: pointer; min-height: 38px;
}
.chip.active, .chip.chip-active { background: #FF4D00; border-color: transparent; color: #fff; }

/* Search + toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search-box input { margin: 0; }
.search-box.search-box input[type="text"], .search-box.search-box input[type="search"] { padding-left: 40px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* Customer cards (mobile-friendly list) */
.entity-list { display: grid; gap: 10px; }
.entity-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer;
}
.entity-card:hover { border-color: var(--primary); }
.entity-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: #F4F4F5; color: var(--primary); font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.entity-main { flex: 1; min-width: 0; }
.entity-main strong { font-size: 15.5px; display: block; }
.entity-main small { color: var(--text-muted); font-size: 13px; display: block; }
.entity-side { text-align: right; flex: none; }

/* Detail header */
.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.detail-head .entity-avatar { width: 64px; height: 64px; font-size: 24px; }
.detail-head h1 { margin: 0; font-size: 22px; }
.detail-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; }

/* Charts */
.chart-wrap { position: relative; width: 100%; }
canvas.chart { width: 100%; height: 240px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(11,11,16,0.5); }
.modal {
  position: relative; background: #fff; border-radius: 18px;
  width: 100%; max-width: 560px; max-height: 92vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Toasts */
.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; max-width: min(92vw, 360px); }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 500; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(11,11,16,.16), 0 2px 8px rgba(11,11,16,.08);
  width: auto; max-width: 100%; text-align: left;
  animation: toast-in 0.22s ease;
}
.toast::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #9CA3AF; }
.toast.error::before { background: #DC2626; }
.toast.ok::before { background: #16A34A; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Quick actions */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

/* Schedule preview table */
.preview-note { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

/* Empty states */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty svg { margin-bottom: 10px; opacity: 0.5; }
.empty p { margin: 6px 0 16px; }

/* WhatsApp button */
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { background: #1DA851; }

/* Detail rows */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kv div small { display: block; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.kv div span { font-size: 15px; font-weight: 600; }

/* Notice box (advance only / info) */
.notice {
  border: 1.5px dashed var(--primary); background: #F4F4F5; color: var(--primary-darker);
  border-radius: var(--radius); padding: 22px; text-align: center; font-weight: 600;
}
.notice p { margin: 8px 0 0; font-weight: 400; font-size: 14px; color: var(--text-muted); }

/* Health grid (super admin) */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  #hamburger { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 49;
    transform: translateX(-105%); transition: transform 0.22s ease;
    width: 264px;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .content { padding: 16px; }
  .view-head h1 { font-size: 20px; }
  .offline-banner { display: none; } /* keep topbar compact on mobile */
  .user-meta { display: none; }
  .brand-name { display: none; }
  .form-row { flex-direction: column; gap: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 10px 10px; font-size: 13.5px; }
  .modal { max-width: 100%; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-body strong { font-size: 18px; }
  .btn { min-height: 46px; }
  .quick-actions .btn { flex: 1 1 100%; }
}

/* Print-friendly for reports */
@media print {
  .sidebar, .topbar, .quick-actions, .view-actions, .modal-root, .toast-root { display: none !important; }
  .content { max-width: none; padding: 10mm; }
  body.printing-sheet .content { padding: 0; }
  body.printing-sheet .print-root .rc-sheet.rc-80mm { padding: 3mm; }
  body.printing-sheet .print-root .rc-sheet.rc-58mm { padding: 2mm; }
  body.printing-sheet .print-root .rc-sheet.rc-a5,
  body.printing-sheet .print-root .rc-sheet.rc-a4 { padding: 10mm; }
  body.printing-sheet .print-root .stmt-sheet { padding: 10mm; }
}

/* ============================================================
 * LANDING PAGE (index.html at /)
 * ============================================================ */
body.landing { background: #fff; }

.land-wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }

/* Nav */
.land-nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.land-nav-inner { display: flex; align-items: center; gap: 28px; height: 68px; }
.land-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; }
.land-links { display: flex; gap: 24px; }
.land-links a { color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 15px; }
.land-links a:hover { color: var(--primary); }

/* Hero */
.land-hero { background: #FF4D00; color: #fff; overflow: hidden; }
.land-hero-inner { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; padding: 84px 22px 96px; }
.land-badge { display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; margin-bottom: 20px; }
.land-hero h1 { font-size: 46px; line-height: 1.12; margin: 0 0 18px; letter-spacing: -0.5px; }
.land-hero h1 .hl { color: #E3B959; }
.land-sub { font-size: 18px; line-height: 1.65; color: rgba(255,255,255,.85); margin: 0 0 30px; max-width: 520px; }
.land-ctas { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.land-micro { font-size: 13.5px; color: rgba(255,255,255,.65); margin: 0; }
.land-center { text-align: center; }

/* CSS dashboard mock */
.mock-window { background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; transform: rotate(1.5deg); }
.mock-bar { display: flex; gap: 7px; padding: 12px 16px; background: #F3F4F6; }
.mock-bar span { width: 11px; height: 11px; border-radius: 50%; background: #D1D5DB; }
.mock-body { padding: 18px; }
.mock-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mock-stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.mock-stat small { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.mock-stat strong { font-size: 16px; color: var(--text); }
.mock-stat strong.red { color: var(--red); }
.mock-stat strong.amber { color: var(--amber); }
.mock-chart { height: 90px; background: #F4F4F5; border-radius: 10px; margin-bottom: 14px; position: relative; overflow: hidden; }
.mock-line { position: absolute; left: 0; right: 0; bottom: 0; height: 70%; background: rgba(255,77,0,.35); clip-path: polygon(0 80%, 15% 55%, 30% 65%, 45% 35%, 60% 45%, 75% 20%, 90% 30%, 100% 5%, 100% 100%, 0 100%); }
.mock-rows { display: grid; gap: 8px; }
.mock-row { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 8px; padding: 9px 12px; }
.mock-row i { width: 26px; height: 26px; border-radius: 50%; background: #E9E9EE; flex-shrink: 0; }
.mock-row b { flex: 1; height: 10px; border-radius: 5px; background: #E5E7EB; }
.mock-row em { width: 54px; height: 18px; border-radius: 999px; font-style: normal; }
.mock-row em.pill-green { background: var(--green-bg); }
.mock-row em.pill-red { background: var(--red-bg); }
.mock-row em.pill-amber { background: var(--amber-bg); }

/* Trust strip */
.land-strip { border-bottom: 1px solid var(--border); background: #fff; }
.land-strip-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; padding: 40px 22px; align-items: start; }
.strip-item { text-align: center; }
.strip-item strong { display: block; font-size: 30px; color: var(--primary); letter-spacing: -0.5px; }
.strip-item span { font-size: 14px; color: var(--text-muted); }

/* Sections */
.land-section { padding: 88px 0; }
.land-alt { background: var(--bg); }
.land-eyebrow { color: var(--primary); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; margin: 0 0 12px; }
.land-section h2 { font-size: 34px; letter-spacing: -0.5px; margin: 0 0 14px; }
.land-lead { font-size: 17px; color: var(--text-muted); max-width: 640px; margin: 0 0 44px; }

/* Feature grid */
/* Feature grid — compact cards with 3D depth */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 20px 18px;
  box-shadow:
    0 1px 2px rgba(11,11,16,.05),
    0 12px 28px -14px rgba(255,77,0,.38),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .18s ease, box-shadow .18s ease;
}
.feat-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 2px 4px rgba(11,11,16,.06),
    0 20px 42px -14px rgba(255,77,0,.5),
    inset 0 1px 0 rgba(255,255,255,.9);
}
.land-alt .feat-card { border-color: transparent; }
.feat-icon {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: var(--primary-darker);
  box-shadow: 0 8px 16px -8px rgba(255,77,0,.65), inset 0 1px 0 rgba(255,255,255,.35);
}
.feat-icon svg { width: 24px; height: 24px; }
.feat-card h3 { margin: 0 0 6px; font-size: 16px; }
.feat-card p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: #fff; border-radius: var(--radius); padding: 30px 26px; box-shadow: var(--shadow); position: relative; }
.step-n { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; font-size: 18px; margin-bottom: 16px; }
.step h3 { margin: 0 0 8px; font-size: 18px; }
.step p { margin: 0; color: var(--text-muted); font-size: 14.5px; }

/* Plans */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 880px; margin: 0 auto 26px; }
.plan-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 36px 32px; box-shadow: var(--shadow); position: relative; }
.plan-hot { border: 2px solid var(--primary); box-shadow: var(--shadow-lg); }
.plan-tag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: #FF4D00; color: #fff; font-size: 12.5px; font-weight: 700; padding: 5px 16px; border-radius: 999px; white-space: nowrap; }
.plan-card h3 { font-size: 24px; margin: 0 0 4px; }
.plan-for { color: var(--text-muted); font-size: 14.5px; margin: 0 0 22px; }
.plan-list { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 11px; }
.plan-list li { position: relative; padding-left: 28px; font-size: 15px; }
.plan-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }

/* CTA band */
.land-cta { background: #FF4D00; color: #fff; text-align: center; padding: 76px 22px; }
.land-cta h2 { font-size: 32px; margin: 0 0 10px; }
.land-cta p { color: rgba(255,255,255,.8); font-size: 17px; margin: 0 0 28px; }

/* Footer */
.land-footer { border-top: 1px solid var(--border); padding: 34px 0; background: #fff; }
.land-footer-inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.land-copy { margin: 0 0 0 auto; font-size: 13.5px; color: var(--text-muted); }

/* Buttons: large + light variants */
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; min-height: 52px; }
.btn-light { background: #fff; color: var(--primary); }
.btn-light:hover { background: #F4F4F5; }

/* ============================================================
 * AUTH PAGES (/login, /server)
 * ============================================================ */
body.auth-page { background-color: #FAFAFA; background-image: radial-gradient(660px 430px at 88% -60px, rgba(255,77,0,.12), rgba(255,77,0,0) 62%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='2' cy='2' r='1.6' fill='%230B0B10' fill-opacity='0.10'/%3E%3C/svg%3E"); background-size: auto, 26px 26px; min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(11,11,16,.16); padding: 36px 32px; width: 100%; max-width: 400px; }
.auth-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-logo h1 { font-size: 22px; margin: 0; }
.auth-logo p { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; }
.auth-back { text-align: center; margin: 18px 0 0; font-size: 14px; }
.auth-back a { color: var(--primary); text-decoration: none; font-weight: 600; }
.brand-sub { font-size: 12px; font-weight: 500; color: var(--text-muted); }

/* Landing responsive */
@media (max-width: 900px) {
  .land-hero-inner { grid-template-columns: 1fr; padding: 60px 22px 70px; }
  .land-hero h1 { font-size: 34px; }
  .feat-grid, .steps { grid-template-columns: 1fr; }
  .land-strip-inner { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .land-links { display: none; }
  .land-copy { margin: 12px 0 0; }
}

/* ============================================================
 * LANDING REDESIGN v2 — glass nav, mesh hero, rich mockup,
 * floating cards, testimonials, FAQ accordion
 * ============================================================ */

/* Glassmorphism nav */
.land-nav-glass {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(229,231,235,.65);
  box-shadow: 0 4px 24px rgba(11,11,16,.06);
}
.land-nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.land-nav .land-brand { margin-right: 0; }

/* Hero (fixed brand color — gradients removed 2026-10-14) */
.land-hero-mesh {
  background: #FF4D00;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='2' cy='2' r='1.6' fill='%23FFFFFF' fill-opacity='0.08'/%3E%3C/svg%3E");
  background-size: 26px 26px;
  color: #fff; position: relative; overflow: hidden;
}
.land-h1 {
  font-size: 54px; line-height: 1.06; letter-spacing: -1.2px;
  margin: 0 0 22px; font-weight: 800;
}
.land-h1 .hl {
  color: #E3B959;
  background: #E3B959;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.btn-outline-light {
  background: rgba(255,255,255,.08); color: #fff;
  border: 1.5px solid rgba(255,255,255,.55);
}
.btn-outline-light:hover { background: rgba(255,255,255,.18); }
.land-hero-fade {
  height: 56px; margin-top: -56px; position: relative;
  background: transparent;
}

/* Rich dashboard mockup */
.land-hero-visual { position: relative; }
.mock-rich { transform: perspective(1200px) rotateY(-6deg) rotateX(2deg); transition: transform .4s ease; }
.mock-rich:hover { transform: perspective(1200px) rotateY(-2deg) rotateX(0deg); }
.mock-bar em {
  margin-left: auto; font-style: normal; font-size: 11px; color: #9CA3AF;
  background: #fff; border: 1px solid #E5E7EB; border-radius: 6px; padding: 3px 10px;
}
.mock-body { display: flex; gap: 0; padding: 0; }
.mock-side {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 4px 18px 16px;
}
.mock-side i { width: 34px; height: 10px; border-radius: 5px; background: #E5E7EB; }
.mock-side i.on { background: var(--primary); width: 40px; }
.mock-main { flex: 1; padding: 16px; min-width: 0; }
.mock-chart-label {
  font-size: 11px; color: var(--text-muted); font-weight: 700;
  display: block; margin-bottom: 8px; letter-spacing: .3px;
}
.mock-bars { display: flex; align-items: flex-end; gap: 8px; height: 92px; }
.mock-bars i {
  flex: 1; border-radius: 6px 6px 3px 3px;
  background: #FF4D00;
  height: var(--h); transform-origin: bottom;
  animation: bar-grow 1.1s cubic-bezier(.2,.8,.3,1) both;
}
.mock-bars i:nth-child(2) { animation-delay: .08s; }
.mock-bars i:nth-child(3) { animation-delay: .16s; }
.mock-bars i:nth-child(4) { animation-delay: .24s; }
.mock-bars i:nth-child(5) { animation-delay: .32s; }
.mock-bars i:nth-child(6) { animation-delay: .4s; background: #FF4D00; }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Floating notification cards */
.float-card {
  position: absolute; z-index: 2;
  display: flex; gap: 10px; align-items: center;
  background: #fff; border-radius: 14px; padding: 12px 16px 12px 12px;
  box-shadow: 0 18px 44px rgba(11,11,16,.28);
  animation: float-y 5.5s ease-in-out infinite;
  max-width: 250px;
}
.float-card-1 { top: 6%; right: -18px; }
.float-card-2 { bottom: 8%; left: -26px; animation-delay: 2.6s; }
.float-card-3 { bottom: -12px; right: -8px; animation-delay: 1.3s; }
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.float-ic {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.float-ic.ok { background: #FF4D00; }
.float-ic.wa { background: #1DA851; }
.float-card strong { display: block; font-size: 13.5px; color: var(--text); }
.float-card small { color: var(--text-muted); font-size: 12px; }

/* Testimonials */
.testi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.testi-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 26px; box-shadow: var(--shadow); margin: 0;
  display: flex; flex-direction: column; gap: 20px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.testi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.testi-card blockquote { margin: 0; font-size: 15.5px; line-height: 1.7; color: var(--text); flex: 1; }
.testi-card figcaption { display: flex; align-items: center; gap: 12px; }
.testi-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: var(--primary-darker);
  color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.testi-card figcaption strong { display: block; font-size: 14.5px; }
.testi-card figcaption small { color: var(--text-muted); font-size: 13px; }

/* FAQ accordion */
.land-narrow { max-width: 780px; margin: 0 auto; padding: 0 22px; }
.faq-list { display: grid; gap: 12px; }
.faq-item {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .18s ease;
}
.faq-item.open { box-shadow: var(--shadow); border-color: #E9E9EE; }
.faq-q {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 19px 22px; background: none; border: none; cursor: pointer; text-align: left;
  font-size: 16px; font-weight: 700; font-family: var(--font); color: var(--text);
}
.faq-q i { font-style: normal; font-size: 24px; line-height: 1; color: var(--primary); transition: transform .22s ease; flex: none; }
.faq-item.open .faq-q i { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.faq-item.open .faq-a { max-height: 260px; }
.faq-a p { margin: 0; padding: 0 22px 22px; color: var(--text-muted); font-size: 15px; line-height: 1.65; }

/* ============================================================
 * SIGNUP PAGE
 * ============================================================ */
.auth-card-wide { max-width: 580px; }

/* ---------- Signup: 2-part split (form left, text right), compact ---------- */
.signup-split {
  display: flex; width: 100%; max-width: 920px; background: #fff;
  border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(11,11,16,.14);
}
.signup-form { flex: 1.12; padding: 26px 26px 22px; min-width: 0; }
.auth-logo-sm { margin-bottom: 18px; }
.auth-logo-sm .login-logo-img { width: 44px; height: 44px; border-radius: 12px; }
.auth-logo-sm h1 { font-size: 19px; }
.auth-logo-sm p { font-size: 13px; }
.signup-form-compact label { font-size: 13px; margin-bottom: 10px; }
.signup-form-compact input { padding: 9px 11px; font-size: 14px; }
.signup-form-compact .plan-pick-label { margin: 12px 0 8px; font-size: 13px; }
.signup-form-compact .plan-pick { gap: 8px; margin-bottom: 10px; }
.signup-form-compact .plan-pick-body { padding: 10px 12px; }
.signup-form-compact .plan-pick-body strong { font-size: 14px; }
.signup-form-compact .plan-pick-body small { font-size: 12px; }
.signup-form-compact .trial-badge { font-size: 11px; padding: 2px 8px; }
.signup-form-compact .btn-block { padding: 11px; font-size: 15px; }
.signup-form-compact .trial-note { margin: 10px 0 0; font-size: 12.5px; }
.auto-plan-box {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 12px;
  background: #F4F4F5; border: 1px solid #E9E9EE; border-radius: 12px; padding: 10px 14px;
}
.auto-plan-box strong { font-size: 14px; color: var(--primary); }
.auto-plan-box span { font-size: 12.5px; color: var(--text-muted); }
.signup-side {
  flex: 1; color: var(--text); padding: 34px 30px;
  background: #F4F4F5;
  display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden;
}
.signup-side::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: transparent;
}
.signup-side > * { position: relative; }
.signup-side-logo { width: 58px; height: 58px; border-radius: 16px; object-fit: contain; background: #fff; margin-bottom: 18px; box-shadow: 0 10px 24px rgba(11,11,16,.18); }
.signup-side h2 { margin: 0 0 10px; font-size: 25px; letter-spacing: -.4px; color: var(--text); line-height: 1.25; }
.signup-side-sub { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #5B5480; }
.signup-points { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.signup-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.signup-points .tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: #FF4D00; border: 1px solid transparent; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.signup-side-badge {
  align-self: flex-start; font-size: 12.5px; font-weight: 700;
  background: #FFFFFF; border: 1px solid #E6E6EA;
  padding: 8px 14px; border-radius: 999px; color: #D63F00;
}
@media (max-width: 760px) {
  .signup-split { flex-direction: column; max-width: 480px; }
  .signup-side { padding: 24px 22px; }
  .signup-side h2 { font-size: 21px; }
  .signup-points { grid-template-columns: 1fr 1fr; gap: 8px; }
  .signup-points li { font-size: 12.5px; }
}

/* ---------- Signup: premium icon inputs + compact no-scroll layout ---------- */
.auth-page .auth-wrap { min-height: 100dvh; }
@media (min-width: 761px) {
  .auth-page .auth-wrap { height: 100dvh; padding: 10px; overflow: hidden; }
  .auth-page .signup-split { max-height: calc(100dvh - 20px); max-width: 940px; }
  .auth-page .signup-form { padding: 14px 22px 8px; overflow: hidden; }
  .auth-page .auth-logo-sm { margin-bottom: 10px; }
  .auth-page .auth-logo-sm .login-logo-img { width: 36px; height: 36px; border-radius: 10px; }
  .auth-page .auth-logo-sm h1 { font-size: 17px; margin: 0 0 2px; }
  .auth-page .auth-logo-sm p { font-size: 12px; margin: 0; }
  .auth-page .fld { margin-bottom: 8px; }
  .auth-page .fld > span:first-child { font-size: 12px; margin-bottom: 5px; }
  .auth-page .inp { padding: 0 11px; border-radius: 11px; }
  .auth-page .inp svg { width: 16px; height: 16px; }
  .auth-page .inp input { padding: 8px 0; font-size: 14px; }
  .auth-page .auto-plan-box { padding: 7px 12px; margin: 2px 0 8px; border-radius: 10px; }
  .auth-page .auto-plan-box strong { font-size: 13px; }
  .auth-page .auto-plan-box span { font-size: 11.5px; }
  .auth-page .signup-form-compact .btn-block { padding: 10px; font-size: 14.5px; }
  .auth-page .signup-form-compact .trial-note { margin: 6px 0 0; font-size: 11.5px; }
  .auth-page .login-note { margin: 8px 0 0; font-size: 12.5px; }
  .auth-page .auth-back { margin: 5px 0 0; font-size: 12.5px; }
  .auth-page .signup-side { padding: 20px 26px; }
  .auth-page .signup-side-logo { width: 46px; height: 46px; margin-bottom: 12px; border-radius: 13px; }
  .auth-page .signup-side h2 { font-size: 21px; margin: 0 0 8px; }
  .auth-page .signup-side-sub { font-size: 13px; margin: 0 0 14px; }
  .auth-page .signup-points { gap: 8px; margin: 0 0 14px; }
  .auth-page .signup-points li { font-size: 13px; }
  .auth-page .signup-side-badge { font-size: 12px; padding: 7px 12px; }
}
/* very short screens: allow scroll rather than clipping */
@media (min-width: 761px) and (max-height: 599px) {
  .auth-page .auth-wrap { height: auto; min-height: 100dvh; overflow: visible; }
  .auth-page .signup-split { max-height: none; }
}
.fld { display: block; margin-bottom: 12px; }
.fld > span:first-child { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.inp {
  display: flex; align-items: center; gap: 10px;
  background: #F7FAFF; border: 1.5px solid #DCE6F5; border-radius: 13px;
  padding: 0 13px; transition: border-color .18s, box-shadow .18s, background .18s, transform .18s;
}
.inp svg { width: 18px; height: 18px; flex: none; color: #8AA3C2; transition: color .18s; }
.inp input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  padding: 11px 0; font-size: 14.5px; color: var(--text);
}
/* kill the generic input:focus purple ring inside .inp — the wrapper's own
   focus-within glow is the single source of truth for the shadow */
.inp input:focus { box-shadow: none; }
.inp input::placeholder { color: #9DB1CC; }
.inp:hover { border-color: #B9D4F2; background: #F2F7FE; }
.inp:focus-within {
  border-color: var(--ib-blue, #FF4D00); background: #fff;
  box-shadow: 0 0 0 3.5px rgba(255,77,0,.16), 0 6px 18px rgba(255,77,0,.12);
  transform: translateY(-1px);
}
.inp:focus-within svg { color: var(--ib-blue, #FF4D00); }
.inp.input-ok { border-color: #FF4D00; }
.inp.input-ok svg { color: #FF4D00; }
.inp.input-bad { border-color: #EF4444; animation: inpShake .3s; }
@keyframes inpShake { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }
.signup-form-compact .btn-block {
  background: #FF4D00;
  border: none; box-shadow: 0 10px 24px rgba(255,77,0,.35);
  transition: transform .2s, box-shadow .2s;
}
.signup-form-compact .btn-block:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(255,77,0,.45); }
.signup-form-compact .btn-block:disabled { opacity: .65; }
.plan-pick-label { font-weight: 700; font-size: 14px; margin: 8px 0 10px; color: var(--text); }
.plan-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.plan-pick-card { display: block; cursor: pointer; position: relative; }
.plan-pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.plan-pick-body {
  display: block; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 14px 16px; height: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.plan-pick-body strong { display: block; font-size: 15.5px; margin-bottom: 4px; color: var(--text); }
.plan-pick-body small { color: var(--text-muted); font-size: 12.5px; line-height: 1.5; display: block; }
.plan-pick-card input:checked + .plan-pick-body {
  border-color: var(--primary); background: #F4F4F5;
  box-shadow: 0 0 0 3px rgba(255,77,0,.16);
}
.plan-pick-card input:focus-visible + .plan-pick-body { outline: 2px solid var(--primary); outline-offset: 2px; }
.form-ok {
  background: var(--green-bg); color: #FF4D00;
  border-radius: 10px; padding: 12px 16px;
  font-size: 14px; font-weight: 600; margin: 0 0 16px;
}
/* Trial badges + notes (signup page, staff app banner) */
.trial-badge {
  display: inline-block; margin-top: 8px; padding: 4px 10px;
  background: var(--green-bg); color: #FF4D00; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.trial-note {
  text-align: center; color: var(--text-muted); font-size: 13px; margin: 12px 0 0;
}
.trial-banner {
  background: var(--amber-bg); color: #92400E;
  border-bottom: 1px solid #E8D194;
  font-size: 13.5px; font-weight: 600; text-align: center;
  padding: 8px 16px;
}
/* license banner states */
.trial-banner.license-ok { background: #F4F4F5; color: #15803D; border-bottom-color: #E9E9EE; }
.trial-banner.license-warn { background: #FBF3D9; color: #92400E; border-bottom-color: #E8D194; }
.trial-banner.license-grace { background: #FAF0E6; color: #8A4B1F; border-bottom-color: #EBC9A3; }
/* full-screen license expired */
#licenseExpiredView {
  position: fixed; inset: 0; z-index: 9999;
  background: #FF4D00;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#licenseExpiredView.hidden { display: none; }
.lic-exp-card {
  background: #fff; border-radius: 16px; padding: 36px; max-width: 440px; width: 100%;
  text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.lic-exp-icon { font-size: 48px; margin-bottom: 12px; }
.lic-exp-card h2 { margin: 0 0 8px; font-size: 24px; }
.lic-exp-card p { color: var(--text-muted); font-size: 14px; }
.lic-exp-card label { text-align: left; display: block; margin: 16px 0; }
.lic-exp-card input { width: 100%; }

/* Landing v2 responsive */
@media (max-width: 900px) {
  .land-h1 { font-size: 37px; letter-spacing: -.6px; }
  .testi-grid { grid-template-columns: 1fr; }
  .float-card-1 { right: 0; }
  .float-card-2 { left: 0; }
  .float-card-3 { right: 0; }
  .mock-rich { transform: none; }
  .plan-pick { grid-template-columns: 1fr; }
  .land-nav-actions .btn-ghost { display: none; }
  .land-nav-actions { gap: 8px; }
}

/* ============================================================
 * CONTROL ROOM (/server) — mega panel components
 * ============================================================ */

/* KPI cards (clickable) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  display: flex; gap: 14px; align-items: center;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
  text-decoration: none; color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
a.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #E9E9EE; }

/* Row action button clusters (fleet table) */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Expiry radar */
.radar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.radar-bucket {
  background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--gray);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.rb-red { border-top-color: #CE4B2A; }
.rb-orange { border-top-color: #EA580C; }
.rb-amber { border-top-color: #B97E14; }
.rb-blue { border-top-color: #FF4D00; }
.rb-purple { border-top-color: #D63F00; }
.radar-bucket h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.radar-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; padding: 6px 0; border-top: 1px dashed var(--border); }

/* Pure-CSS trend bars */
.css-bars { display: flex; align-items: stretch; gap: 8px; height: 190px; padding: 10px 4px 0; }
.css-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.css-bar {
  width: 100%; max-width: 44px; border-radius: 6px 6px 3px 3px;
  background: var(--primary);
  min-height: 4px;
}
.css-bar-label { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }

/* Rank medals */
.medal {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
}
.medal.gold { background: #D98E1F; }
.medal.silver { background: #6B7280; }
.medal.bronze { background: #92400E; }

/* Pending-collection alert */
.alert-box {
  border: 1.5px solid #FCA5A5; background: #FEF2F2;
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
}
.alert-box h3 { margin: 0 0 8px; color: #B23F22; font-size: 15px; }

/* Click-to-copy IP badge */
.ip-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; background: var(--gray-bg);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; cursor: pointer; color: var(--text);
}
button.ip-badge:hover { background: #E5E7EB; }

/* Pagination */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; justify-content: center; }
.pager .page-info { font-size: 13.5px; color: var(--text-muted); }

/* Big activation code display */
.code-big {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px; font-weight: 800; letter-spacing: 2px;
  background: #F4F4F5; border: 2px dashed var(--primary);
  border-radius: 12px; padding: 18px; text-align: center; margin: 14px 0;
}

/* AI chat */
.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; padding: 6px 2px; margin-bottom: 12px; }
.chat-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; }
.chat-user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-ai { align-self: flex-start; background: var(--gray-bg); color: var(--text); border-bottom-left-radius: 4px; }
.chat-row { display: flex; gap: 10px; }
.chat-row input { margin: 0; flex: 1; }

/* Status dot (fleet health) */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; vertical-align: middle; }
.dot.on { background: #FF4D00; box-shadow: 0 0 0 3px #FFF1E9; }
.dot.off { background: #9CA3AF; box-shadow: 0 0 0 3px #F3F4F6; }

/* Secret settings rows (integrations) */
.secret-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.secret-row label { flex: 1; min-width: 180px; margin: 0; }

/* Ticket rows + replies */
.ticket-row { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ticket-row:hover { background: #FAFAFF; }
.reply { background: var(--gray-bg); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.reply small { display: block; color: var(--text-muted); margin-bottom: 4px; }
.reply.mine { background: #F4F4F5; }

/* Printer template picker + code editor */
.pt-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.tpl-item {
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer; background: #fff;
}
.tpl-item:hover { border-color: #E9E9EE; }
.tpl-item.active { border-color: var(--primary); background: #F4F4F5; }
.code-editor { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; min-height: 280px; }

/* Info box */
.info-box {
  background: #F4F4F5; border: 1px solid #E9E9EE; color: var(--primary-darker);
  border-radius: var(--radius); padding: 14px 18px; font-size: 14px; margin-bottom: 18px;
}

/* Two-column cards */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .pt-grid { grid-template-columns: 1fr; }
  .code-big { font-size: 20px; letter-spacing: 1px; }
}

/* ============================================================
 * PHASE 1 — inventory / purchase / sale / return
 * Indigo Prime. Mobile-first.
 * ============================================================ */

/* ---------- products ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.prod-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; display: flex; gap: 12px; align-items: flex-start;
}
.prod-card:hover { border-color: #E9E9EE; }
.prod-photo {
  width: 64px; height: 64px; border-radius: 12px; flex: none;
  background: var(--gray-bg); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.prod-photo img { width: 100%; height: 100%; object-fit: cover; }
.prod-info { flex: 1; min-width: 0; }
.prod-info strong { display: block; font-size: 15px; line-height: 1.35; }
.prod-info small { color: var(--text-muted); font-size: 12.5px; display: block; margin-top: 2px; }
.prod-price { font-weight: 800; font-size: 16.5px; color: var(--primary); margin: 5px 0; }
.prod-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: none; }
.health-bar { height: 6px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.health-bar > span { display: block; height: 100%; border-radius: 99px; transition: width .3s; }

.alert-strip {
  display: flex; align-items: center; gap: 10px;
  background: var(--amber-bg); border: 1px solid #E8D194; color: #92400E;
  border-radius: 12px; padding: 12px 16px; font-weight: 600; font-size: 14px;
  margin-bottom: 14px;
}
.chip-alert {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--amber-bg); border: 1px solid #E8D194; color: #92400E;
  border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: 14px;
  text-decoration: none;
}
.chip-alert:hover { background: #E8D194; }

/* ---------- line-item editor ---------- */
.line-editor { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 6px; background: #FBFBFF; }
.line-head, .line-row { display: grid; grid-template-columns: 1fr 64px 92px 92px 34px; gap: 8px; align-items: center; }
.line-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.line-row { margin-bottom: 8px; }
.line-row input { margin-top: 0; min-height: 42px; padding: 8px 10px; font-size: 14px; }
.prod-pick { position: relative; min-width: 0; }
.prod-drop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); max-height: 220px; overflow-y: auto;
}
.prod-opt { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.prod-opt:last-child { border-bottom: none; }
.prod-opt:hover { background: #F4F4F5; }
.prod-opt strong { display: block; font-size: 14px; }
.prod-opt small { color: var(--text-muted); font-size: 12px; }
.line-amt { font-weight: 700; text-align: right; font-size: 14px; white-space: nowrap; }
.line-del { color: var(--red); font-size: 20px; }
@media (max-width: 600px) {
  .line-head { display: none; }
  .line-row { grid-template-columns: 64px 1fr 34px; }
  .prod-pick { grid-column: 1 / -1; grid-row: 1; }
  .line-row .rq { grid-column: 1; grid-row: 2; }
  .line-row .rr { grid-column: 2; grid-row: 2; }
  .line-del { grid-column: 3; grid-row: 2; }
  .line-amt { grid-column: 1 / -1; grid-row: 3; text-align: left; font-size: 15px; }
}

/* ---------- totals box ---------- */
.totals { background: #F8FAFF; border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin: 14px 0; }
.totals .t-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; font-size: 14.5px; }
.totals .t-row strong { font-size: 15.5px; }
.totals .t-row.grand { font-weight: 800; font-size: 17px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }
.totals .t-row.grand strong { font-size: 18px; color: var(--primary); }
.totals .t-row input { width: 130px; margin: 0; min-height: 40px; padding: 6px 10px; text-align: right; }

/* ---------- net / qist toggle cards ---------- */
.pay-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.toggle-card { display: block; cursor: pointer; margin: 0; position: relative; }
.toggle-card input { position: absolute; opacity: 0; pointer-events: none; margin: 0; min-height: 0; }
.toggle-body {
  display: block; border: 2px solid var(--border); border-radius: 14px;
  padding: 16px 14px; text-align: center; background: #fff; height: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.toggle-body strong { display: block; font-size: 15.5px; margin-bottom: 4px; color: var(--text); }
.toggle-body small { color: var(--text-muted); font-size: 12.5px; line-height: 1.45; display: block; }
.toggle-card input:checked + .toggle-body.net { border-color: var(--green); background: #F5F3FF; box-shadow: 0 0 0 3px rgba(255,77,0,0.15); }
.toggle-card input:checked + .toggle-body.qist { border-color: var(--primary); background: #F4F4F5; box-shadow: 0 0 0 3px rgba(255,77,0,0.15); }
.toggle-card input:focus-visible + .toggle-body { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 520px) { .pay-toggle { grid-template-columns: 1fr; } }

/* ---------- receipt ---------- */
.receipt { font-size: 14px; color: #111; max-width: 360px; margin: 0 auto; }
.receipt h3 { text-align: center; margin: 0 0 2px; font-size: 18px; }
.receipt .r-center { text-align: center; margin: 4px 0; }
.r-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 12px 0; font-size: 13.5px; }
.r-meta div span { display: block; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.r-totals { margin-top: 10px; border-top: 1.5px dashed var(--border); padding-top: 8px; }
.r-totals div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.r-totals .grand { font-weight: 800; font-size: 16.5px; border-top: 1.5px dashed var(--border); margin-top: 6px; padding-top: 8px; }
.r-qr { text-align: center; margin: 12px 0 6px; }
.r-qr svg { width: 116px; height: 116px; }

/* ---------- QR box + 80mm label ---------- */
.qr-box { text-align: center; }
.label-card {
  width: 80mm; max-width: 100%; margin: 0 auto; text-align: center;
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 12px 10px;
  background: #fff;
}
.label-card .l-name { font-weight: 800; font-size: 15px; line-height: 1.3; }
.label-card .l-sku { color: var(--text-muted); font-size: 12px; margin: 2px 0 6px; }
.label-card .r-qr svg { width: 96px; height: 96px; }
.label-card .l-price { font-size: 21px; font-weight: 800; color: var(--primary-darker); margin-top: 4px; }
.label-card .l-token { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---------- return rows ---------- */
.ret-head, .ret-row { display: grid; grid-template-columns: 1fr 60px 110px; gap: 8px; align-items: center; }
.ret-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.ret-row { margin-bottom: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.ret-row strong { display: block; font-size: 14px; }
.ret-row small { color: var(--text-muted); font-size: 12px; }
.ret-row input { margin-top: 0; min-height: 42px; }

/* ---------- Phase 1: receipt / label printing ---------- */
@media print {
  body.printing #appView,
  body.printing .modal-backdrop,
  body.printing .modal-head,
  body.printing .modal-foot,
  body.printing .no-print { display: none !important; }
  body.printing .modal-root { display: flex !important; position: static; padding: 0; }
  body.printing .modal { box-shadow: none; border: none; max-width: none; max-height: none; width: 100%; }
  body.printing .modal-body { overflow: visible; padding: 0; }
  body.printing .receipt { width: 72mm; max-width: 72mm; }
  body.printing .label-card { border: none; }
  body.printing .table-wrap { border: none; }
}

/* ============================================================
 * PHASE 2 — Smart Dashboard 2.0 · Customer 360 · receipts ·
 * global search · notifications. Indigo Prime, mobile-first.
 * ============================================================ */

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px;
}
.kpi-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; gap: 12px; align-items: flex-start;
}
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon.indigo { background: #F4F4F5; color: var(--primary); }
.kpi-icon.amber { background: var(--amber-bg); color: var(--amber); }
.kpi-icon.red { background: var(--red-bg); color: var(--red); }
.kpi-icon.green { background: var(--green-bg); color: var(--green); }
.kpi-body { min-width: 0; }
.kpi-body small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.kpi-body strong { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.kpi-sub { font-size: 12.5px; color: var(--text-muted); }
.kpi-sub a { color: var(--primary); font-weight: 600; text-decoration: none; }
.kpi-bar { height: 7px; background: var(--gray-bg); border-radius: 999px; margin: 8px 0 5px; overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 999px; background: var(--primary-dark); }

/* ---------- Aging chips ---------- */
.aging-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.aging-chip {
  flex: 1 1 120px; text-decoration: none; color: var(--text);
  background: var(--gray-bg); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid transparent; transition: border-color 0.15s, background 0.15s;
}
.aging-chip:hover { border-color: var(--primary); background: #F4F4F5; }
.aging-chip span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.aging-chip strong { font-size: 17px; font-weight: 800; color: var(--red); }

/* ---------- Trend bars (pure CSS) ---------- */
.trend-bars {
  display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 8px;
}
.tbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.tbar-fill {
  width: 70%; max-width: 34px; border-radius: 5px 5px 0 0;
  background: var(--primary);
}
.tbar span { font-size: 10.5px; color: var(--text-muted); margin-top: 5px; }

/* ---------- Forecast ---------- */
.forecast-total { font-size: 16px; margin: 0 0 12px; }
.forecast-total strong { color: var(--primary); font-size: 20px; }
.forecast-list { display: flex; flex-direction: column; }
.forecast-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--border);
}
.forecast-row:last-child { border-bottom: none; }
a.forecast-row { text-decoration: none; color: var(--text); border-radius: 6px; padding-left: 6px; padding-right: 6px; margin: 0 -6px; }
a.forecast-row:hover { background: #F0F7F2; }
.forecast-row small { display: block; color: var(--text-muted); font-size: 12.5px; }

/* ---------- Follow-ups strip ---------- */
.tl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.followup-strip { display: flex; flex-direction: column; gap: 10px; }
.fu-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--gray-bg); border-radius: 12px; padding: 10px 12px;
}
.fu-main small { display: block; color: var(--text-muted); font-size: 12.5px; }
.fu-actions { display: flex; gap: 8px; align-items: center; flex: none; }

/* ---------- Customer 360 tabs ---------- */
.cust-tabs {
  display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
}
.cust-tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  padding: 10px 14px; border-radius: 9px; font-family: var(--font);
  font-size: 14px; font-weight: 700; color: var(--text-muted); white-space: nowrap;
}
.cust-tab.active { background: #F4F4F5; color: var(--primary); }

/* ---------- Timeline ---------- */
.tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-dot {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: #F4F4F5; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.tl-body { min-width: 0; }
.tl-title { font-weight: 700; font-size: 14.5px; }
.tl-detail { font-size: 13.5px; color: var(--text); margin-top: 2px; white-space: pre-wrap; }
.tl-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Documents ---------- */
.doc-upload-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.docs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px;
}
.doc-tile {
  position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: #fff; cursor: pointer;
}
.doc-tile img { width: 100%; height: 110px; object-fit: cover; display: block; }
.doc-ico {
  height: 110px; display: flex; align-items: center; justify-content: center;
  background: var(--gray-bg); color: var(--text-muted);
}
.doc-meta { padding: 8px 10px; }
.doc-meta small { display: block; font-size: 12px; color: var(--text-muted); }
.doc-del {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px;
  background: rgba(255, 255, 255, 0.92); color: var(--red); border-radius: 8px;
  font-size: 18px; font-weight: 700; line-height: 1;
}

/* ---------- Statement ---------- */
.stmt-sheet { border: 1px solid var(--border); border-radius: 12px; padding: 18px; background: #fff; }
.stmt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.stmt-cust { background: var(--gray-bg); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.stmt-sheet h3 { margin: 16px 0 8px; font-size: 15px; }
.stmt-totals { margin-top: 14px; border-top: 2px solid var(--border); padding-top: 10px; }
.stmt-totals > div { display: flex; justify-content: space-between; padding: 4px 0; }
.stmt-totals .grand { font-size: 17px; font-weight: 800; color: var(--primary); }
.stmt-qr { text-align: center; margin-top: 14px; }
.stmt-qr svg { width: 130px; height: 130px; }

/* ---------- Receipt sizes + preview ---------- */
.seg { display: inline-flex; background: var(--gray-bg); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg button {
  border: none; background: transparent; cursor: pointer; font-family: var(--font);
  font-size: 13.5px; font-weight: 700; color: var(--text-muted);
  padding: 8px 16px; border-radius: 7px;
}
.seg button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.rc-preview-box {
  border: 1px dashed var(--border); border-radius: 12px; padding: 16px;
  background: #FBFBFE; max-height: 55vh; overflow: auto;
}
.rc-sheet { margin: 0 auto; color: #111; }
.rc-sheet.rc-80mm { max-width: 300px; font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rc-sheet.rc-58mm { max-width: 220px; font-size: 11.5px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rc-sheet.rc-a4 { max-width: 100%; font-size: 14px; }
.rc-sheet.rc-a5 { max-width: 520px; font-size: 13px; }
.rc-co { text-align: center; margin-bottom: 8px; }
.rc-title { text-align: center; font-weight: 800; letter-spacing: 1px; margin: 8px 0; border-top: 1px dashed #999; border-bottom: 1px dashed #999; padding: 6px 0; }
.rc-meta div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.rc-meta span { color: #555; }
.rc-items { width: 100%; border-collapse: collapse; margin: 8px 0; }
.rc-items th, .rc-items td { border-bottom: 1px dashed #bbb; padding: 5px 2px; text-align: left; font-size: inherit; }
.rc-totals { margin-top: 6px; }
.rc-totals div { display: flex; justify-content: space-between; padding: 2px 0; }
.rc-totals .grand { font-weight: 800; font-size: 1.18em; border-top: 1px solid #333; margin-top: 4px; padding-top: 6px; }
.rc-qr { text-align: center; margin: 10px 0 4px; }
.rc-qr svg { width: 110px; height: 110px; }
.rc-thanks { text-align: center; margin-top: 10px; font-weight: 700; }
.rc-foot { text-align: center; margin-top: 8px; padding-top: 6px; border-top: 1px dashed #bbb; font-size: 10px; color: #666; }
.stmt-foot { text-align: center; margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 10.5px; color: #888; }
.print-foot { display: none; }

/* ---------- Global search ---------- */
.gs-toggle { display: none; }
.gs-wrap { position: relative; flex: 1; max-width: 420px; }
#globalSearch {
  width: 100%; margin-top: 0; padding: 9px 14px 9px 38px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--gray-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 17px;
}
#globalSearch:focus { background-color: #fff; border-color: var(--primary); outline: none; }
.gs-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 80;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); max-height: 60vh; overflow: auto; padding: 6px;
}
.gs-glabel {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding: 8px 10px 4px;
}
.gs-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: 9px; font-family: var(--font);
}
.gs-item:hover { background: #F4F4F5; }
.gs-ico { color: var(--primary); flex: none; display: flex; }
.gs-main small { display: block; color: var(--text-muted); font-size: 12.5px; }
.gs-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ---------- Notifications ---------- */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 90;
  width: 350px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); overflow: hidden;
}
.np-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.np-list { max-height: 55vh; overflow: auto; }
.notif-item {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  border: none; background: transparent; cursor: pointer; text-align: left;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-family: var(--font);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-bg); }
.notif-item.unread { background: #F4F4F5; }
.np-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.np-main { flex: 1; min-width: 0; }
.np-main strong { display: block; font-size: 14px; }
.np-main small { display: block; color: var(--text-muted); font-size: 12.5px; }
.np-time { font-size: 11.5px !important; margin-top: 2px; }
.np-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: none; margin-top: 6px; }
.np-head-btns { display: flex; gap: 6px; }
.np-group {
  padding: 8px 14px 4px; font-size: 11px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase; color: var(--text-muted); background: var(--gray-bg);
}
.np-empty { font-size: 42px; margin: 0; }
/* notification toasts (bottom-right slide-in) */
.notif-toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px));
}
.notif-toast {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: #1e293b; color: #fff; border: none; border-radius: 12px;
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow-lg);
  animation: nt-in .35s ease; font-family: var(--font); width: 100%;
}
.notif-toast.nt-out { opacity: 0; transform: translateX(20px); transition: all .4s ease; }
@keyframes nt-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.nt-ico { font-size: 22px; flex: none; }
.nt-main { flex: 1; min-width: 0; }
.nt-main strong { display: block; font-size: 13.5px; }
.nt-main small { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
.nt-x { flex: none; opacity: .6; font-size: 18px; line-height: 1; padding: 2px 4px; }
/* preferences modal */
.npref-sec {
  font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--text-muted); margin: 14px 0 6px;
}
.npref-sec:first-child { margin-top: 0; }
.npref-row {
  display: flex; gap: 10px; align-items: center; padding: 9px 4px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.npref-row.npref-off { opacity: .55; }
.npref-ico { font-size: 20px; flex: none; width: 28px; text-align: center; }
.npref-main { flex: 1; min-width: 0; font-size: 13.5px; }
.npref-main small.npref-hint { display: block; color: var(--text-muted); font-size: 11.5px; }
.npref-badge { font-size: 10px; margin-left: 6px; vertical-align: 1px; }
.npref-toggle { width: 40px; height: 22px; flex: none; accent-color: var(--primary); cursor: pointer; }
.npref-toggle:disabled { cursor: not-allowed; }
.npref-push {
  display: flex; gap: 10px; align-items: center; margin-top: 16px;
  padding: 12px; background: var(--gray-bg); border-radius: 10px;
}
.npref-push small { color: var(--text-muted); font-size: 12px; }

/* ---------- Dedicated print root (Phase-2 receipts/statements) ---------- */
.print-root { display: none; }
@media print {
  body.printing-sheet #appView,
  body.printing-sheet .modal-root,
  body.printing-sheet #toastRoot { display: none !important; }
  body.printing-sheet .print-root { display: block !important; }
  body.printing-sheet .print-root .rc-sheet.rc-80mm { max-width: 72mm; }
  body.printing-sheet .print-root .rc-sheet.rc-58mm { max-width: 52mm; }
  body.printing-sheet .print-root .rc-sheet.rc-a5 { max-width: 138mm; }
  body.printing-sheet .print-root .rc-sheet.rc-a4 { max-width: 190mm; }
  .print-foot { display: block; position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font-size: 10px; color: #666; }
  body.printing-sheet .print-foot { display: none; }
  body.printing-sheet .print-root .stmt-sheet { border: none; }
}

/* ---------- Phase-2 responsive ---------- */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .gs-toggle { display: inline-flex; }
  .gs-wrap { display: none; position: absolute; top: 64px; left: 0; right: 0; max-width: none; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border); z-index: 70; }
  .gs-wrap.open { display: block; }
  .gs-results { position: static; margin-top: 8px; max-height: 50vh; box-shadow: none; border: none; padding: 0; }
  .notif-panel { position: fixed; top: 70px; left: 12px; right: 12px; width: auto; max-width: none; }
  .fu-item { flex-direction: column; align-items: stretch; }
  .fu-actions { justify-content: flex-end; }
}
@media (max-width: 480px) {
  .kpi-card { padding: 12px; }
  .kpi-body strong { font-size: 19px; }
  .trend-bars { height: 140px; }
  .docs-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Phase 3: Recovery Pro / Intelligence / Activity ---------- */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.case-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; transition: box-shadow .15s; }
.case-card:hover { box-shadow: 0 4px 14px rgba(255,77,0,.12); }
.case-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.case-sub { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.case-amt { font-size: 20px; font-weight: 700; margin: 8px 0 2px; }
.case-amt small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.case-meta { font-size: 13px; color: var(--text-muted); }
.ptp-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #FBF3D9; border: 1px solid #E3B959; color: #92400E; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.ptp-chip { background: #fff; border: 1px solid #E3B959; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.bar { height: 10px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.tl-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.tl-row p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-muted); }
.ptp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.rule-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rule-tpl { font-size: 13px; color: var(--text-muted); margin-top: 4px; max-width: 440px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: #D1D5DB; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .sl:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .sl { background: #FF4D00; }
.switch input:checked + .sl:before { transform: translateX(20px); }
/* Device authorization lock overlay */
.device-lock { position: fixed; inset: 0; z-index: 9999; background-color: #FF4D00; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='2' cy='2' r='1.6' fill='%23FFFFFF' fill-opacity='0.08'/%3E%3C/svg%3E"); background-size: 26px 26px; color: #fff; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.device-lock .dl-card { max-width: 420px; }
.device-lock h1 { font-size: 22px; margin: 14px 0 8px; color: #fff; }
.device-lock p { opacity: .85; font-size: 14.5px; }
.device-lock a { color: #fff; text-decoration: underline; }
@media (max-width: 480px) { .case-grid { grid-template-columns: 1fr; } }

/* ---- Collections (dunning) view ---- */
.dun-bucket { cursor: pointer; text-align: left; font-family: var(--font); transition: transform .12s ease, box-shadow .12s ease; }
.dun-bucket:hover { transform: translateY(-2px); }
.dun-bucket.active { outline: 2px solid var(--primary); }
.dun-task { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dun-task:last-child { border-bottom: none; }
.btn-xs { padding: 6px 10px; font-size: 13px; min-height: 0; border-radius: 8px; }
@media (max-width: 480px) { .dun-task { align-items: flex-start; } }

/* ---- New Sale 3-step wizard ---- */
.sale-wizard .sw-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sale-wizard .sw-head h2 { margin: 0; }
.sw-compact-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; margin: 0; }
.sw-compact-toggle input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; min-height: 0; }
.sw-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.sw-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: default; }
.sw-step .sw-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--border); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.sw-step.active { color: var(--text); font-weight: 600; }
.sw-step.active .sw-dot { background: var(--primary); color: #fff; }
.sw-step.done .sw-dot { background: var(--green); color: #fff; }
.sw-step.done { cursor: pointer; }
.sw-sep { flex: 1; height: 2px; background: var(--border); border-radius: 2px; min-width: 12px; }
.sw-body { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.sw-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 4px; }
.sw-chips .chip { cursor: pointer; }
.sw-items-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 6px; }
.wz-head, .wz-row { display: grid; grid-template-columns: 1fr 64px 92px 84px 30px; gap: 8px; align-items: center; }
.wz-head { font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 0 2px 4px; }
.wz-row { margin-bottom: 8px; }
.wz-row input { margin: 0; min-height: 0; padding: 9px 10px; }
.wz-amt { font-weight: 600; font-size: 13px; text-align: right; }
.wz-del { justify-self: center; }
.wz-pick { position: relative; }
.sw-paymodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 6px; }
.sw-pm { padding: 12px 8px; border: 2px solid var(--border); border-radius: 12px; background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; font-family: var(--font); transition: all .12s ease; }
.sw-pm.active { border-color: var(--green); background: #F5F3FF; box-shadow: 0 0 0 3px rgba(255,77,0,.15); }
.sw-big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.sw-big-box { background: var(--bg-soft, #F8FAFC); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.sw-big-box small { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.sw-big-box strong { font-size: 20px; color: var(--primary); }
.sw-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.sw-save-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
/* compact mode: denser rows */
.sale-wizard.compact .wz-row input { padding: 5px 8px; font-size: 13px; }
.sale-wizard.compact .wz-head { font-size: 11px; padding-bottom: 2px; }
.sale-wizard.compact .wz-row { margin-bottom: 4px; gap: 6px; }
.sale-wizard.compact .wz-amt { font-size: 12px; }
.sale-wizard.compact .sw-body label { margin-bottom: 6px; font-size: 13px; }
.sale-wizard.compact .sw-body input, .sale-wizard.compact .sw-body select { padding: 7px 9px; font-size: 13px; }
.sale-wizard.compact .sw-big-box { padding: 8px 10px; }
.sale-wizard.compact .sw-big-box strong { font-size: 16px; }
.sale-wizard.compact .sw-pm { padding: 8px 6px; font-size: 13px; }
.sale-wizard.compact .sw-steps { margin-bottom: 10px; }
@media (max-width: 560px) {
  .wz-head, .wz-row { grid-template-columns: 1fr 52px 76px 70px 26px; gap: 6px; }
  .sw-lbl { display: none; }
  .sw-big { grid-template-columns: 1fr 1fr; }
}

/* AI floating button: don't cover content — lift on small screens, add clearance */
#aiFab { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
@media (max-width: 768px) {
  #aiFab { bottom: 84px !important; }
}
.sale-wizard { padding-bottom: 8px; }

/* ============================================================
 * New Sale — single-page compact form (compact by default)
 * ============================================================ */
.sale-single { display: flex; flex-direction: column; gap: 10px; }
.sale-single .ss-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sale-single .ss-head h2 { margin: 0; font-size: 18px; }
.sale-single .ss-meta { display: flex; gap: 6px; }
.sale-single .ss-meta input { width: 132px; padding: 6px 8px; font-size: 13px; margin: 0; }
.sale-single .ss-sec { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.sale-single .ss-custrow { display: flex; gap: 6px; align-items: flex-start; }
.sale-single .cust-pick { position: relative; flex: 1; }
.sale-single #wzCustName { width: 100%; padding: 8px 10px; font-size: 14px; margin: 0; }
.sale-single #wzCustName.has-pick { padding-right: 92px; }
.sale-single .cust-tag { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: #FF4D00; font-weight: 700; background: #FFF1E9; padding: 2px 8px; border-radius: 99px; pointer-events: none; white-space: nowrap; }
.sale-single #wzCustDrop { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; }
.sale-single .ss-label { font-weight: 700; font-size: 13px; }
.sale-single .ss-items-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sale-single .wz-head { font-size: 11px; padding-bottom: 2px; }
.sale-single .wz-row { margin-bottom: 4px; gap: 6px; }
.sale-single .wz-row input { padding: 6px 8px; font-size: 13px; margin: 0; }
.sale-single .wz-amt { font-size: 12px; }
.sale-single .pay-toggle-sm { gap: 8px; }
.sale-single .pay-toggle-sm .toggle-body { padding: 8px 10px; }
.sale-single .pay-toggle-sm strong { font-size: 13px; }
.sale-single .sw-paymodes-sm { gap: 6px; }
.sale-single .sw-paymodes-sm .sw-pm { padding: 6px 10px; font-size: 12px; }
.sale-single .ss-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sale-single .ss-inline { margin-bottom: 6px; font-size: 13px; }
.sale-single .ss-inline input, .sale-single .ss-inline select { padding: 7px 9px; font-size: 13px; margin-top: 4px; }
.sale-single .sw-big-sm { gap: 8px; margin-top: 8px; }
.sale-single .sw-big-sm .sw-big-box { padding: 8px 10px; }
.sale-single .sw-big-sm small { font-size: 11px; }
.sale-single .sw-big-sm strong { font-size: 15px; }
.sale-single .sw-save-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sale-single .sw-save-row .btn { flex: 1; min-width: 130px; }
.sale-single #wzSummary .t-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; font-size: 14px; }
.sale-single #wzSummary .t-row span { color: var(--text-muted); }
.sale-single #wzSummary .t-row strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.sale-single #wzSummary .t-row.grand { border-top: 1.5px solid var(--border); margin-top: 6px; padding-top: 10px; }
.sale-single #wzSummary .t-row.grand span { color: var(--text); font-weight: 700; }
.sale-single #wzSummary .t-row.grand strong { font-size: 18px; color: var(--primary); }
@media (max-width: 560px) {
  .sale-single .ss-grid2 { grid-template-columns: 1fr 1fr; }
  .sale-single .ss-meta input { width: 112px; }
}
/* single-page sale: payment LEFT, summary RIGHT */
.sale-single .ss-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.sale-single .ss-2col .ss-pay { order: 1; }
.sale-single .ss-2col .ss-sum { order: 2; }
.sale-single .sw-save-row.sw-save-col { flex-direction: column; }
.sale-single .sw-save-row.sw-save-col .btn { width: 100%; }
@media (max-width: 860px) {
  .sale-single .ss-2col { grid-template-columns: 1fr; }
  .sale-single .ss-2col .ss-pay { order: 1; }
  .sale-single .ss-2col .ss-sum { order: 2; }
}

/* admin modals: password toggle + checkbox rows */
.pw-wrap { display: flex; gap: 6px; align-items: center; }
.pw-wrap input { flex: 1; min-width: 0; }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 8px 0; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }

/* ============ Customer wizard (4-part, plan-gated) ============ */
.wiz-steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.wiz-step {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1.5px solid var(--border); border-radius: 999px; background: #fff;
  font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: all .15s ease;
}
.wiz-step-n {
  width: 24px; height: 24px; border-radius: 50%; background: var(--gray-bg);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.wiz-step.active { border-color: var(--primary); color: var(--primary); background: #F4F4F5; }
.wiz-step.active .wiz-step-n { background: var(--primary); color: #fff; }
.wiz-step.done { border-color: #86efac; color: #FF4D00; }
.wiz-step.done .wiz-step-n { background: #FF4D00; color: #fff; }
.wiz-body { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.wiz-grid { display: flex; flex-direction: column; gap: 12px; }
.wiz-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wiz-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; }
.wiz-grid input, .wiz-grid select, .wiz-grid textarea {
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px;
  font-family: inherit; background: #fff; width: 100%; box-sizing: border-box;
}
.wiz-grid input:focus, .wiz-grid select:focus, .wiz-grid textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,77,0,.12);
}
.wiz-grid textarea { min-height: 80px; resize: vertical; }
.fld-half { min-width: 0; }
.chk-row { flex-direction: row !important; align-items: center; gap: 10px !important; cursor: pointer; }
.chk-row input { width: 20px; height: 20px; accent-color: var(--primary); }
.chk-wrap { display: flex; align-items: center; }
.wiz-sec { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 14px; }
.wiz-adv-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 800; color: #D63F00; text-transform: uppercase; letter-spacing: .5px;
  margin-top: 4px;
}
.wiz-adv-head small { background: #f3e8ff; color: #D63F00; padding: 2px 10px; border-radius: 999px; font-size: 11px; }
/* photo slots */
.photo-slot { border: 1.5px dashed var(--border); border-radius: 12px; padding: 12px; }
.photo-slot-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 13.5px; }
.photo-add { cursor: pointer; }
.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-item { display: flex; flex-direction: column; gap: 4px; width: 112px; }
.photo-item .photo-desc { width: 112px; min-height: 30px; font-size: 12px; padding: 5px 7px; }
.photo-thumb { position: relative; width: 72px; height: 72px; }
.photo-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.photo-x {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  background: #CE4B2A; color: #fff; border: none; font-size: 16px; line-height: 1; cursor: pointer;
}
/* extra documents */
.extra-list { display: flex; flex-direction: column; gap: 10px; }
.extra-item { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.extra-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.extra-item-body { flex: 1; }
.extra-item-body input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; }
/* wizard footer */
.wiz-count { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (max-width: 640px) {
  .wiz-grid2 { grid-template-columns: 1fr; }
  .wiz-step-l { display: none; }
  .wiz-step { padding: 8px 10px; }
}

/* wizard wide modal */
.modal-root.wiz-wide .modal { max-width: 720px; }

/* ============ Customer cards (rich grid) ============ */
.cust-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cust-card {
  background: #fff; border: 1.5px solid var(--border); border-radius: 16px; padding: 16px;
  cursor: pointer; transition: all .15s ease; display: flex; flex-direction: column; gap: 10px;
}
.cust-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.cust-card-top { display: flex; align-items: center; gap: 12px; }
.cust-card-av { width: 48px; height: 48px; font-size: 20px; flex: none; }
.cust-card-head { flex: 1; min-width: 0; }
.cust-card-head strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-card-head small { color: var(--text-muted); font-size: 13px; }
.cust-card-risk { flex: none; }
.cust-card-info { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.cust-card-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-card-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cust-card-actions { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; }
.cust-card-goto { margin-left: auto; color: var(--text-muted); display: flex; }
@media (max-width: 640px) {
  .cust-cards { grid-template-columns: 1fr; }
}

/* ============ Timeline note images ============ */
.tl-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tl-imgs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; transition: transform .12s ease; }
.tl-imgs img:hover { transform: scale(1.06); }

/* ============ Sidebar submenu ============ */
.nav-group { display: flex; flex-direction: column; }
.nav-parent .nav-caret { margin-left: auto; font-size: 11px; opacity: .7; transition: transform .15s ease; }
.nav-group.open .nav-parent .nav-caret { transform: rotate(180deg); }
.nav-parent.has-active { background: #F4F4F5; color: #D63F00; }
/* submenus: slim tree branch under the parent — no double pills */
.nav-subs { display: none; flex-direction: column; gap: 2px; margin: 2px 0 6px 23px; padding-left: 10px; border-left: 2px solid #E6E6EA; }
.nav-group.open .nav-subs { display: flex; }
.nav-sub { font-size: 13.5px; font-weight: 600; min-height: 38px; padding: 8px 12px; border-radius: 8px; position: relative; }
.nav-sub:hover { background: #F4F4F5; }
.nav-sub.active { background: #FFF1E9; color: #D63F00; box-shadow: none; }
.nav-sub.active::before { content: ''; position: absolute; left: -17px; top: 50%; transform: translateY(-50%); width: 7px; height: 7px; border-radius: 50%; background: #FF4D00; box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px #FF4D00; }
html[dir="rtl"] .nav-subs { margin: 2px 23px 6px 0; padding-left: 0; padding-right: 10px; border-left: none; border-right: 2px solid #E6E6EA; }
html[dir="rtl"] .nav-sub.active::before { left: auto; right: -17px; }
/* ultra-advance product modal */
.psec { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: var(--bg-soft, #FAFBFE); }
.psec-h { font-weight: 800; font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.psub { border-top: 1px dashed var(--border); padding: 10px 0 4px; margin-top: 8px; }
.psub-h { font-weight: 700; font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.margin-live { font-size: 13px; margin: 2px 0 10px; color: var(--text-muted); }
.margin-live .pos { color: var(--green, #FF4D00); }
.margin-live .neg { color: var(--red, #CE4B2A); }
.pphotos { display: flex; gap: 8px; flex-wrap: wrap; }
.pph { position: relative; display: inline-block; }
.pph img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.pph b { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: #CE4B2A; color: #fff; font-size: 14px; line-height: 20px; text-align: center; cursor: pointer; }
.prow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.prow:last-child { border-bottom: 0; }
.serial-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; }
.schip { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: #F4F4F5; border: 1px solid #E9E9EE; font-family: monospace; }
.schip.sold { background: #F3F4F6; border-color: #D1D5DB; color: #6B7280; }
.mbadge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.mbadge.fast { background: #F4F4F5; color: #15803D; border: 1px solid #E9E9EE; }
.mbadge.slow { background: #FBF3D9; color: #D98E1F; border: 1px solid #E8D194; }
.mbadge.dead { background: #FEF2F2; color: #B23F22; border: 1px solid #FECACA; }
/* sale row advance options */
.wz-opts-in { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: #F8FAFF; border: 1px dashed var(--border); border-radius: 10px; margin-top: 6px; }
.wz-opts-in label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1; }
.wz-opts-in select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fff; }

/* ============================================================
 * DARK MODE — Emerald Fresh (user side only)
 * Activated by the topbar toggle: <html class="lf-dark">.
 * The server console never gets the class, so it stays light.
 * Paper documents (receipts/statements) stay white — they print.
 * ============================================================ */
html.lf-dark {
  color-scheme: dark;
  --bg: #101014;
  --card: #17171C;
  --text: #F4F4F5;
  --text-muted: #A3A3AD;
  --border: #26262E;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 32px rgba(0,0,0,.55);
  --green-bg: #123524; --red-bg: #3D231B; --amber-bg: #3A2F14;
  --blue-bg: #16233F; --gray-bg: #1E1E24; --gray: #A3A3AD;
}
html.lf-dark body { background: var(--bg); color: var(--text); }
html.lf-dark .topbar { background: var(--card); }
html.lf-dark .brand-name { color: #FF7A45; }
html.lf-dark .sidebar { background: #131316; border-right-color: var(--border); }
html.lf-dark .nav-link { color: #C9C9D1; }
html.lf-dark .nav-link:hover { background: #17171C; color: #F4F4F5; }
html.lf-dark .nav-link.active { background: #FF4D00; color: #FFFFFF; box-shadow: inset 3px 0 0 #FFFFFF; }
html.lf-dark .lang-toggle { background: #17171C; color: #FF7A45; border-color: var(--border); }
html.lf-dark .lang-toggle:hover { background: #FF4D00; color: #FFFFFF; }
html.lf-dark input[type="text"], html.lf-dark input[type="password"], html.lf-dark input[type="email"],
html.lf-dark input[type="number"], html.lf-dark input[type="date"], html.lf-dark input[type="tel"],
html.lf-dark input[type="search"], html.lf-dark select, html.lf-dark textarea {
  background: #17171C; color: var(--text); border-color: var(--border);
}
html.lf-dark input::placeholder, html.lf-dark textarea::placeholder { color: #7A739E; }
html.lf-dark .inp { background: #17171C; border-color: var(--border); }
html.lf-dark .inp input { background: transparent; color: var(--text); }
html.lf-dark .modal, html.lf-dark .dropdown, html.lf-dark .gs-results,
html.lf-dark .notif-panel, html.lf-dark .auth-card { background: var(--card); color: var(--text); }
html.lf-dark .dropdown-item:hover { background: #17171C; }
html.lf-dark .btn-secondary { background: #1E1E24; color: var(--text); border-color: var(--border); }
html.lf-dark .btn-ghost:hover { background: #17171C; }
html.lf-dark .chip { background: #17171C; border-color: var(--border); color: var(--text-muted); }
html.lf-dark .seg button.active { background: #26332A; color: #FF7A45; }
html.lf-dark .tbl th { background: #17171C; color: var(--text-muted); }
html.lf-dark .tbl td, html.lf-dark .tbl th { border-color: var(--border); }
html.lf-dark .table-wrap { border-color: var(--border); }
html.lf-dark .trial-banner { color: #E3B959; }
html.lf-dark .extra-item, html.lf-dark .doc-tile { background: #17171C; }
html.lf-dark .rc-preview-box { background: #0B0F0C; }
html.lf-dark .rc-sheet, html.lf-dark .stmt-sheet { background: #fff; color: #111; }
html.lf-dark .pvm-empty, html.lf-dark .empty { color: var(--text-muted); }
html.lf-dark .kv small, html.lf-dark .cell-sub { color: var(--text-muted); }
html.lf-dark .switch .sl { background: #33413A; }
html.lf-dark .photo-slot { background: #141B16; }
html.lf-dark .wiz-sec { border-color: var(--border); }
html.lf-dark .gs-item:hover, html.lf-dark .notif-item:hover { background: #17171C; }
html.lf-dark .login-card { background: var(--card); color: var(--text); }

/* Dark-mode leftovers: tables + stat cards were hardcoded white */
html.lf-dark table { background: var(--card); color: var(--text); }
html.lf-dark thead th { background: #17171C; }
html.lf-dark tbody tr:hover { background: #17171C; }
html.lf-dark .stat-card { background: var(--card); }

/* Dark-mode completion pass (2026-10-15): customer/entity cards were
 * hardcoded white, success pills paired dark-green bg with violet
 * text, and a few emerald-era dark tints survived the re-theme. */
html.lf-dark .cust-card { background: var(--card); }
html.lf-dark .entity-card { background: var(--card); }
html.lf-dark .user-chip { background: var(--card); color: var(--text); }
html.lf-dark .signup-split { background: var(--card); color: var(--text); }
html.lf-dark .pill-green { background: #123524; color: #4ADE80; }
html.lf-dark .pill-red { background: #3D231B; color: #F87171; }
html.lf-dark .pill-amber { background: #3A2F14; color: #FCD34D; }
html.lf-dark .pill-gray { background: #1E1E24; color: #C9C4DE; }
html.lf-dark .sync-green { background: #123524; color: #4ADE80; }
html.lf-dark .sync-orange { background: #3A2F14; color: #FCD34D; }
html.lf-dark .trial-banner { background: #3A2F14; border-bottom-color: #57451C; color: #FCD34D; }
html.lf-dark .trial-banner.license-ok { background: #123524; color: #4ADE80; border-bottom-color: #1E5B3C; }
html.lf-dark .trial-banner.license-warn { background: #3A2F14; color: #FCD34D; border-bottom-color: #57451C; }
html.lf-dark .trial-banner.license-grace { background: #3D231B; color: #FCA5A5; border-bottom-color: #5F2E1E; }
html.lf-dark .seg button.active { background: #FF4D00; }
html.lf-dark .rc-preview-box { background: #0D0A18; }
html.lf-dark .switch .sl { background: #3B3663; }
html.lf-dark .photo-slot { background: #171230; }

/* ============================================================
 * COMPACT DENSITY — user side only (body.lf-compact)
 * Everything a touch smaller (~3px): text, boxes, spacing,
 * across all app sections. Print sizes are NOT touched.
 * ============================================================ */
body.lf-compact { font-size: 14px; }
body.lf-compact .topbar { height: 58px; }
body.lf-compact .app-body { min-height: calc(100vh - 58px); }
body.lf-compact .sidebar { top: 58px; height: calc(100vh - 58px); width: 232px; }
body.lf-compact .brand-name { font-size: 16px; }
body.lf-compact .brand-mark, body.lf-compact img.brand-logo { width: 32px; height: 32px; }
body.lf-compact .content { padding: 18px; }
body.lf-compact .card { padding: 16px; margin-bottom: 14px; }
body.lf-compact .card h2 { font-size: 15px; margin-bottom: 11px; }
body.lf-compact .card h3 { font-size: 14px; }
body.lf-compact .view-head h1 { font-size: 21px; }
body.lf-compact .nav-link { padding: 9px 12px; min-height: 42px; font-size: 14px; gap: 10px; }
body.lf-compact .btn { padding: 9px 15px; min-height: 40px; font-size: 14px; }
body.lf-compact .btn-sm { padding: 6px 10px; min-height: 32px; font-size: 12.5px; }
body.lf-compact label { font-size: 13.5px; margin-bottom: 11px; }
body.lf-compact input[type="text"], body.lf-compact input[type="password"], body.lf-compact input[type="email"],
body.lf-compact input[type="number"], body.lf-compact input[type="date"], body.lf-compact input[type="tel"],
body.lf-compact select, body.lf-compact textarea { min-height: 42px; padding: 9px 11px; font-size: 14px; }
body.lf-compact th, body.lf-compact td { padding: 9px 11px; }
body.lf-compact table { font-size: 13.5px; }
body.lf-compact .modal-head { padding: 15px 17px; }
body.lf-compact .modal-head h2 { font-size: 16px; }
body.lf-compact .modal-body { padding: 16px; }
body.lf-compact .modal-foot { padding: 13px 17px; }
body.lf-compact .chip { font-size: 12.5px; }
body.lf-compact .seg button { padding: 6px 12px; font-size: 13px; }
body.lf-compact .stat-card { padding: 14px; gap: 11px; }
body.lf-compact .stat-icon { width: 42px; height: 42px; }
body.lf-compact .stat-body strong { font-size: 19px; }
body.lf-compact .stat-body small { font-size: 12px; }
body.lf-compact .kpi-card { padding: 12px; }
body.lf-compact .kpi-icon { width: 38px; height: 38px; }
body.lf-compact .kpi-body strong { font-size: 19px; }
body.lf-compact .photo-thumb, body.lf-compact .photo-thumb img { width: 64px; height: 64px; }
body.lf-compact .user-avatar { width: 32px; height: 32px; }
body.lf-compact .form-hint { font-size: 12px; }
body.lf-compact .filter-tabs { margin-bottom: 11px; }
body.lf-compact .trial-banner { font-size: 13px; }
@media print {
  body.lf-compact { font-size: 15px; }
  body.lf-compact .content { padding: 0; }
  body.lf-compact .sidebar { width: 248px; }
}

/* Trial/license banner now lives inside the content column */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#trialSlot { padding: 14px 24px 0; }
#trialSlot:empty { padding: 0; }
#trialSlot .trial-banner { border-radius: 12px; }
.content .trial-banner { border-radius: 12px; margin-bottom: 14px; }
body.lf-compact #trialSlot { padding: 12px 18px 0; }

/* ---------- Settings shell (side-nav layout) ---------- */
.set-shell { display: grid; grid-template-columns: 228px 1fr; gap: 18px; align-items: start; }
.set-nav { position: sticky; top: 84px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 16px; padding: 12px; box-shadow: 0 4px 14px rgba(11,11,16,.05); }
.set-nav input { margin: 0 0 10px; min-height: 42px; font-size: 14px; }
.set-nav-it { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; border-radius: 10px; padding: 10px 12px; font: 600 14px var(--font); color: var(--text); cursor: pointer; }
.set-nav-it:hover { background: var(--bg); }
.set-nav-it.active { background: #FFF1E9; color: #D63F00; }
.set-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.set-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.set-main .card { margin: 0; border-radius: 16px; scroll-margin-top: 84px; }
@keyframes setFlash { 0% { box-shadow: 0 0 0 3px rgba(255,77,0,.45); } 100% { box-shadow: 0 0 0 0 rgba(255,77,0,0); } }
.set-flash { animation: setFlash 1.1s ease; }
@media (max-width: 900px) {
  .set-shell { grid-template-columns: 1fr; }
  .set-nav { position: static; display: flex; gap: 6px; overflow-x: auto; padding: 10px; align-items: center; }
  .set-nav input { flex: 0 0 170px; margin: 0; }
  .set-nav-it { width: auto; white-space: nowrap; padding: 8px 11px; }
}
html.lf-dark .set-nav { background: var(--card); }
html.lf-dark .set-nav-it.active { background: rgba(255,77,0,.18); color: #7BE3B0; }

/* ---------- Mobile UX pack (user side, <=860px) ---------- */
#mobileNav { display: none; }
@media (max-width: 860px) {
  #mobileNav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--card, #fff); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(11,11,16,.08);
  }
  .mnav-it {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px 4px; border: none; background: none; cursor: pointer;
    color: var(--text-muted); font: 600 11px var(--font); text-decoration: none;
    border-radius: 12px; position: relative; min-height: 52px; justify-content: center;
  }
  .mnav-it.active { color: #D63F00; }
  .mnav-it.active::before {
    content: ''; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3.5px; border-radius: 0 0 4px 4px; background: #FF4D00;
  }
  /* nothing hides behind the bar */
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
  /* AI assistant floats ABOVE the bar */
  #aiFab { bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important; }
  #aiPanel { bottom: calc(162px + env(safe-area-inset-bottom, 0px)) !important; height: min(520px, calc(100dvh - 220px)) !important; }
  .toast-root { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  /* iOS zoom guard + comfortable touch targets */
  input, select, textarea { font-size: 16px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .btn-sm { min-height: 40px; }
  /* tables scroll sideways instead of crushing/overlapping */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 560px; }
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  /* quick actions: tidy 2-col grid */
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick-actions .btn { width: 100%; }
  /* view headers wrap cleanly */
  .view-head { flex-wrap: wrap; gap: 10px; }
  .view-head .view-actions { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  /* modals become bottom sheets */
  .modal-root { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .kv { grid-template-columns: 1fr 1fr; }
}
@media print { #mobileNav { display: none !important; } .content { padding-bottom: 0 !important; } }

/* ---------- Mobile polish round 2 (mobile only) ---------- */
@media (max-width: 860px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .sync-badge { padding: 5px 9px; font-size: 11px; white-space: nowrap; }
  #langToggleSlotTop select { max-width: 80px; }
  html.lf-dark .gs-wrap { background: var(--card); }
  .card { padding: 16px; }
  .kv span { overflow-wrap: anywhere; }
  .card h2 { font-size: 16px; }
}
@media (max-width: 480px) {
  .tbl th, .tbl td { padding: 9px 8px; font-size: 13px; }
  .modal .form-actions, .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 380px) {
  #syncBadge { display: none; }
  .brand-logo { width: 30px; height: 30px; }
}

/* ---------- Mobile anti-overflow guards (mobile only) ---------- */
@media (max-width: 860px) {
  html, body { overflow-x: clip; max-width: 100vw; }
  .content { overflow-x: clip; }
  .topbar { max-width: 100vw; }
  .set-shell { grid-template-columns: minmax(0, 1fr); }
  .set-nav { min-width: 0; max-width: 100%; }
  .set-main { min-width: 0; }
  .view-head { min-width: 0; }
  .view-head h1, .view-head p { overflow-wrap: break-word; }
  img, svg, video, canvas { max-width: 100%; }
}

/* ---------- Analytics Pro (ultra) ---------- */
.an-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.an-hero-ic { width: 52px; height: 52px; border-radius: 15px; background: #FF4D00; color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 8px 18px rgba(11,11,16,.25); }
.an-hero h1 { margin: 0; font-size: 24px; }
.an-hero p { margin: 3px 0 0; color: var(--text-muted); font-size: 13.5px; }
.an-tabs { display: inline-flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.an-tab { display: inline-flex; align-items: center; gap: 7px; border: none; background: none; padding: 9px 18px; border-radius: 999px; font: 600 14px var(--font); color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.an-tab.active { background: #FF4D00; color: #fff; box-shadow: 0 4px 12px rgba(255,77,0,.35); }
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; margin-bottom: 16px; }
.an-kpi { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; align-items: center; gap: 13px; box-shadow: 0 4px 14px rgba(11,11,16,.05); }
.an-kpi small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.an-kpi strong { font-size: 19px; }
.an-kpi-ic { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.an-ring { width: 54px; height: 54px; flex: none; transform: rotate(0deg); }
.an-ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.an-ring-fg { fill: none; stroke-width: 6; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.an-ring text { font-size: 15px; font-weight: 800; fill: var(--text); }
.an-chart-card { padding: 20px; }
.an-chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.an-chart-head h3 { margin: 0; }
.an-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-muted); }
.an-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; }
.an-chart { width: 100%; height: auto; }
.an-grid { stroke: var(--border); stroke-dasharray: 3 4; }
.an-base { stroke: var(--text-muted); stroke-width: 1; opacity: .5; }
.an-col-exp { fill: #BFE6D2; }
.an-col-adj { fill: #FF4D00; }
.an-axis { font-size: 11px; fill: var(--text-muted); }
.an-val { font-size: 11.5px; font-weight: 700; fill: var(--text); }
.an-best { display: flex; gap: 12px; align-items: center; background: #FFF1E9; border: 1px solid #BFE6D2; border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; }
.an-best-ic { width: 40px; height: 40px; border-radius: 50%; background: #E8A33D; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.an-cohort { padding: 14px 0; border-bottom: 1px solid var(--border); }
.an-cohort:last-child { border-bottom: none; }
.an-cohort-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.an-dual { height: 12px; border-radius: 99px; background: #FDECEA; overflow: hidden; }
.an-dual span { display: block; height: 100%; background: #FF4D00; border-radius: 99px; }
.an-cohort-foot { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.an-agent { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.an-agent:last-of-type { border-bottom: none; }
.an-rank { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; margin-top: 4px; }
.an-avatar { width: 44px; height: 44px; border-radius: 50%; background: #FF4D00; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.an-agent-main { flex: 1; min-width: 0; }
.an-agent-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.an-agent-top strong { font-size: 17px; }
.an-agent-bars { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; margin-top: 8px; }
.an-ab small { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.an-mini { height: 7px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.an-mini span { display: block; height: 100%; border-radius: 99px; }
.an-sk { height: 120px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); margin-bottom: 14px; animation: anPulse 1.2s ease-in-out infinite alternate; }
@keyframes anPulse { from { opacity: .55; } to { opacity: 1; } }
html.lf-dark .an-best { background: rgba(255,77,0,.14); border-color: rgba(255,77,0,.35); }
html.lf-dark .an-col-exp { fill: #5B21B6; }
html.lf-dark .an-dual { background: rgba(206,75,42,.25); }
@media (max-width: 640px) {
  .an-agent-bars { grid-template-columns: 1fr 1fr; }
  .an-hero h1 { font-size: 20px; }
  .an-kpi strong { font-size: 17px; }
}

/* Dark mode: the auth side panel must go dark too — in 3.1.5 it turned
 * light lavender while its text follows the (light) dark-mode ink,
 * which made the panel copy invisible in dark mode. */
html.lf-dark .signup-side { background: #17171C; color: var(--text); }
html.lf-dark .signup-side-sub { color: #A3A3AD; }
html.lf-dark .signup-side-badge { background: #17171C; border-color: var(--border); color: #FFB59A; }
html.lf-dark .signup-side-logo { box-shadow: 0 10px 24px rgba(0,0,0,.4); }

/* Auth pages join the clean monochrome + orange scheme
 * (user direction, 2026-10-16) — scoped to body.auth-page so
 * the app itself is untouched. */
body.auth-page {
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='2' cy='2' r='1.6' fill='%230B0B10' fill-opacity='0.05'/%3E%3C/svg%3E");
  background-size: 26px 26px;
}
body.auth-page .btn-primary { background: #FF4D00; box-shadow: 0 4px 14px rgba(255,77,0,.28); }
body.auth-page .btn-primary:hover { background: #D63F00; box-shadow: 0 6px 18px rgba(255,77,0,.35); }
body.auth-page .signup-side { background: #F7F7F8; }
body.auth-page .signup-side-sub { color: #55565E; }
body.auth-page .signup-points .tick { background: #FF4D00; border-color: transparent; }
body.auth-page .signup-side-badge { border-color: #E8E8EE; color: #0B0B10; }
body.auth-page a { color: #D63F00; }
body.auth-page input:focus, body.auth-page select:focus, body.auth-page textarea:focus {
  border-color: #FF4D00 !important; box-shadow: 0 0 0 3px rgba(255,77,0,.16) !important;
}
body.auth-page .lang-toggle { color: #0B0B10 !important; border-color: #E8E8EE !important; background: #FFFFFF !important; }

/* ---------- loading kit: skeletons + route progress (3.5.14) ---------- */
.skl{position:relative;overflow:hidden;background:#E9E7E0;border-radius:10px;min-height:14px}
.skl::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.6),transparent);transform:translateX(-100%);animation:sklShimmer 1.25s infinite}
@keyframes sklShimmer{100%{transform:translateX(100%)}}
html.lf-dark .skl{background:#26262E}
html.lf-dark .skl::after{background:linear-gradient(90deg,transparent,rgba(255,255,255,.09),transparent)}
@media (prefers-reduced-motion:reduce){.skl::after{animation:none}}
#lf-progress{position:fixed;top:0;left:0;height:3px;width:0;background:#FF4D00;z-index:99998;opacity:0;transition:width .3s ease,opacity .35s ease;pointer-events:none}
#lf-progress.on{opacity:1}
