/* ==========================================================================
   个金 CRM · Notion Notebook Aesthetic + Huawei Mate XTs Tri-Fold Responsive
   ========================================================================== */

:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #F5F5F4;
  --surface-hover: #F3F2EF;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;

  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #78716C;

  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EFF6FF;
  --hl-blue: #BFDBFE;
  --hl-blue-soft: #DBEAFE;

  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --ok: #15803D;
  --ok-bg: #DCFCE7;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-sm: 0 2px 8px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 10px 30px rgba(28, 25, 23, 0.09);
  --shadow-lg: 0 20px 50px rgba(28, 25, 23, 0.16);

  --font-sans: "HarmonyOS Sans SC", "PingFang SC", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --sidebar-w: 236px;
  --rail-w: 76px;
  --topbar-h: 54px;
  --bnav-h: 60px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.text-danger {
  color: var(--danger) !important;
}

.text-accent {
  color: var(--accent) !important;
}

/* Signature Notion Notebook Grid Paper Accent */
.grid-paper {
  background-color: #FAFAF8;
  background-image:
    linear-gradient(to right, rgba(28, 25, 23, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(28, 25, 23, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Signature Blue Highlighter Pills (from Screenshot 2) */
.hl-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 7px;
  background: var(--hl-blue);
  color: #1E293B;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.hl-title {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--hl-blue-soft);
  color: #1E3A8A;
  font-size: 14px;
  font-weight: 700;
}

/* ==========================================================================
   App Layout Shell (Mate XTs Single / Dual / Tri-Fold Adaptive)
   ========================================================================== */

#app {
  height: 100%;
}

.app-layout {
  display: flex;
  height: 100%;
  min-height: 100dvh;
  width: 100%;
}

/* Left Sidebar (Visible on Dual >= 680px & Tri-Fold >= 1080px) */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #F7F6F3;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 12px;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-brand:hover {
  background: rgba(28, 25, 23, 0.04);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fold-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  margin: 0 4px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 600;
}

.fold-chip svg {
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(28, 25, 23, 0.05);
  color: var(--ink);
}

.nav-item.active {
  background: #FFFFFF;
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--hl-blue-soft);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.nav-badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.nav-badge.subtle {
  background: rgba(28, 25, 23, 0.06);
  color: var(--muted);
}

.sidebar-tier-section {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 10px 6px;
  letter-spacing: 0.4px;
}

.tier-quick-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
}

.tier-quick-btn:hover {
  background: rgba(28, 25, 23, 0.05);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.side-tool-btn:hover {
  background: rgba(28, 25, 23, 0.05);
}

.side-tool-btn.active {
  background: var(--hl-blue-soft);
  color: var(--accent);
  border-color: var(--hl-blue);
  font-weight: 700;
}

/* Main Workspace Column */
.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

.main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile Topbar & Bottom Nav (Hidden on Dual/Tri-Fold) */
.mobile-topbar,
.mobile-bottom-nav {
  display: none;
}

/* ==========================================================================
   Buttons, Pills & Form Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.btn-primary {
  background: var(--ink);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: #292524;
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  background: rgba(28, 25, 23, 0.04);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: rgba(28, 25, 23, 0.06);
  color: var(--ink);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-block {
  width: 100%;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
}

.btn-link:hover {
  background: var(--accent-soft);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--ink-2);
  display: grid;
  place-items: center;
}

.icon-btn.active {
  background: var(--hl-blue-soft);
  border-color: var(--hl-blue);
  color: var(--accent);
}

.icon-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  transition: background 0.14s, color 0.14s;
}

.icon-mini-btn:hover {
  background: rgba(28, 25, 23, 0.07);
  color: var(--ink);
}

/* Notion Pastel Pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-private { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.badge-wealth  { background: #E0E7FF; color: #3730A3; border: 1px solid #C7D2FE; }
.badge-gold    { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.badge-potential { background: #F5F5F4; color: #57534E; border: 1px solid #E7E5E4; }

.status-hot    { background: #FFF1F2; color: #BE123C; }
.status-normal { background: #F0FDF4; color: #15803D; }
.status-wake   { background: #FEF3C7; color: #B45309; }
.status-pause  { background: #F5F5F4; color: #78716C; }

.pill-risk     { background: #F5F5F4; color: #44403C; border: 1px solid var(--border); }
.pill-cat      { background: #F5F5F4; color: #44403C; }
.pill-channel  { background: var(--hl-blue-soft); color: #1D4ED8; }

.fu-overdue { background: var(--danger-bg); color: var(--danger); }
.fu-today   { background: var(--hl-blue-soft); color: var(--accent); }
.fu-soon    { background: var(--warn-bg); color: var(--warn); }
.fu-ok      { background: var(--ok-bg); color: var(--ok); }
.fu-none    { background: #F5F5F4; color: var(--muted); }

.prio-high { background: var(--danger-bg); color: var(--danger); }
.prio-mid  { background: var(--warn-bg); color: var(--warn); }
.prio-low  { background: #F5F5F4; color: var(--muted); }

.cust-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.cust-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cust-chip.neutral {
  background: var(--surface-2);
  color: var(--muted);
  border-color: transparent;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================================================
   View Pages & Dashboard
   ========================================================================== */

.view-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-kicker {
  margin-bottom: 6px;
}

.page-title {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.page-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 680px;
}

/* Banners */
.soft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #FFFFFF;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.install-banner {
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 100%);
  border-color: var(--hl-blue);
}

.demo-banner {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.wechat-banner {
  background: #FEF2F2;
  border-color: #FECACA;
}

.wechat-banner .banner-icon {
  color: var(--danger);
}

.backup-banner {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

.backup-banner .banner-icon {
  color: var(--ok);
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}

.banner-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.banner-text strong {
  font-size: 13.5px;
}

.banner-text span {
  font-size: 12.5px;
  color: var(--ink-2);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dashboard Hero Card */
.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hero-date {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.hero-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.hero-subtitle {
  margin: 6px 0 14px;
  color: var(--ink-2);
  font-size: 14px;
}

.hero-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-doodle {
  flex-shrink: 0;
  opacity: 0.95;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
  box-shadow: var(--shadow-xs);
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.kpi-card.kpi-alert {
  border-color: #FECACA;
  background: linear-gradient(180deg, #FFF5F5 0%, #FFFFFF 45%);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.kpi-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.kpi-icon-wrap.blue  { background: var(--hl-blue-soft); color: var(--accent); }
.kpi-icon-wrap.red   { background: var(--danger-bg); color: var(--danger); }
.kpi-icon-wrap.amber { background: var(--warn-bg); color: var(--warn); }
.kpi-icon-wrap.stone { background: var(--surface-2); color: var(--ink-2); }

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.kpi-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 3px;
}

.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Dashboard Panels Grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-body {
  padding: 14px 16px;
  flex: 1;
}

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.followup-row,
.maturity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #FFFFFF;
  transition: background 0.14s, border-color 0.14s;
}

.followup-row:hover,
.maturity-row:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.followup-row-main,
.maturity-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.row-top-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cust-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.cust-name.lg {
  font-size: 16px;
}

.row-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.amount-strong {
  margin-left: auto;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
}

.sub-group-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.bday-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  cursor: pointer;
}

.bday-icon {
  color: #D97706;
  display: grid;
  place-items: center;
}

.bday-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
}

.bday-info strong {
  font-size: 13.5px;
}

.mini-vault-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-file-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: #FFFFFF;
  transition: transform 0.14s, box-shadow 0.14s;
}

.mini-file-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.mini-file-thumb {
  height: 76px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.mini-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-file-info {
  padding: 7px 8px;
}

.mini-file-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-file-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Customers Workspace (Split Master-Detail + Notion Board)
   ========================================================================== */

.customers-workspace {
  display: flex;
  height: 100%;
  min-height: 100%;
}

.customers-workspace.mode-split .customers-master {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.customers-workspace.mode-board .customers-master {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.view-toolbar {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.toolbar-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.count-badge {
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.seg-btn.active {
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.search-sort-row {
  display: flex;
  gap: 8px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 10px 8px 34px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  outline: none;
  font-size: 13.5px;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.select-compact,
.input-date-compact {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  font-size: 13px;
  outline: none;
}

.select-compact.narrow {
  width: 96px;
}

.chip-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chip-bar::-webkit-scrollbar {
  display: none;
}

.chip-bar.large {
  margin-bottom: 16px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.14s;
}

.filter-chip span {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filter-chip.active {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.filter-chip.active span {
  color: #D6D3D1;
}

.customers-list-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.customer-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.customer-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.customer-row:hover {
  background: var(--surface-hover);
}

.customer-row.selected {
  background: var(--accent-soft);
  border-color: var(--hl-blue);
}

.avatar-md {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
}

.avatar-lg {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.customer-row-info {
  flex: 1;
  min-width: 0;
}

.customer-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.customer-row-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.customer-row-aum {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.customer-row-mid {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.customer-row-counters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-counter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--muted);
}

.mini-counter svg {
  width: 13px;
  height: 13px;
}

/* Notion Kanban Board View (Glorious on Mate XTs Tri-Fold!) */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  padding: 18px;
  overflow-x: auto;
  height: 100%;
  align-items: start;
}

.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.kanban-aum {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.kanban-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.14s, border-color 0.14s;
}

.kanban-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.amount-sm {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
}

.kanban-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-empty {
  text-align: center;
  padding: 20px 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   Right Split Inspector / Customer Notion Dossier
   ========================================================================== */

.customers-detail-pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
}

.detail-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 10px;
}

.detail-empty h3 {
  margin: 0;
  font-size: 18px;
}

.detail-empty p {
  margin: 0 0 8px;
  color: var(--muted);
  max-width: 380px;
}

.detail-container {
  max-width: 860px;
  margin: 0 auto;
  padding-bottom: 48px;
}

.mobile-detail-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(250, 250, 249, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.detail-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.detail-title-block {
  min-width: 0;
  flex: 1;
}

.detail-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.detail-name {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.detail-sub-line {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.detail-props-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.prop-cell {
  background: #FFFFFF;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prop-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.prop-val {
  font-size: 15px;
  font-weight: 700;
}

.prop-val.strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.prop-val-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prop-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.detail-tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
}

.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.detail-tabs::-webkit-scrollbar {
  display: none;
}

.detail-tab {
  border: none;
  background: transparent;
  padding: 12px 12px 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.detail-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
}

.detail-tab.active .tab-badge {
  background: var(--hl-blue-soft);
  color: var(--accent);
}

.detail-body {
  padding: 18px 22px;
}

.detail-section {
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.section-sub {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.notion-callout {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-left: 3px solid var(--hl-blue);
  font-size: 13.8px;
  line-height: 1.65;
  color: var(--ink-2);
}

/* Assets List */
.asset-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asset-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  border: 1px solid var(--border);
}

.asset-card-main {
  flex: 1;
  min-width: 0;
}

.asset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.asset-name {
  font-weight: 700;
  font-size: 14.5px;
}

.asset-amount {
  font-weight: 800;
  font-size: 15px;
  color: var(--accent);
  white-space: nowrap;
}

.asset-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.asset-rate {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}

.asset-note {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.asset-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Smart Follow-up Rule Box & Timeline */
.smart-rule-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--hl-blue);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.rule-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #1E3A8A;
}

.rule-desc {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 2px;
}

.rule-actions {
  display: flex;
  gap: 8px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

.timeline.wide {
  max-width: 860px;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-date {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.timeline-summary {
  font-size: 13.8px;
  color: var(--ink);
  line-height: 1.6;
}

.timeline-next {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ==========================================================================
   Follow-ups Queue Cards
   ========================================================================== */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.fu-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.fu-card.is-overdue {
  border-color: #FECACA;
}

.fu-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fu-card-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.fu-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px;
}

.fu-card-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-lbl {
  font-size: 11px;
  color: var(--muted);
}

.fu-card-note {
  font-size: 12.5px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fu-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* ==========================================================================
   To-Do List & Quick Inline Add
   ========================================================================== */

.quick-todo-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  margin-bottom: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

.quick-todo-input {
  flex: 1;
  min-width: 220px;
  border: none;
  outline: none;
  padding: 6px 8px;
  font-size: 14px;
}

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todo-list.panel-surface {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.14s;
}

.todo-item:hover {
  background: var(--surface-hover);
}

.todo-item.is-done .todo-title {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.8px solid var(--border-strong);
  background: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  color: #FFFFFF;
  transition: all 0.14s;
}

.todo-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.todo-content {
  flex: 1;
  min-width: 0;
}

.todo-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.todo-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.todo-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.todo-due {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.todo-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ==========================================================================
   Receipts, Files & Images Vault
   ========================================================================== */

.vault-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.vault-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.file-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform 0.14s, box-shadow 0.14s;
}

.file-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.file-thumb {
  position: relative;
  height: 148px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-cat-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(28, 25, 23, 0.72);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.file-ext-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
}

.file-ext-badge span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.file-card-body {
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.file-name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-note {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.file-footer {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.file-footer-btns {
  display: flex;
  gap: 2px;
}

/* ==========================================================================
   Settings View
   ========================================================================== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.device-status-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.ds-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.guide-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.setting-hint {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 420px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-btn-label {
  cursor: pointer;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-inline {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-box {
  padding: 24px 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: #FFFFFF;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-hero {
  padding: 40px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-hero h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.empty-hero p {
  margin: 0 0 8px;
  color: var(--muted);
  max-width: 420px;
  font-size: 13.5px;
}

/* ==========================================================================
   Slide-Over Detail Drawer (Mobile Single Screen & Notion Side Peek)
   ========================================================================== */

.detail-drawer-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.detail-drawer-wrap.open {
  pointer-events: auto;
  opacity: 1;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.36);
  backdrop-filter: blur(2px);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 100vw);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-drawer-wrap.open .drawer-panel {
  transform: translateX(0);
}

/* ==========================================================================
   Modals, Forms, Dropzone & Lightbox
   ========================================================================== */

#modal-host {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#modal-host.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(88dvh, 780px);
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
}

.modal-card.modal-wide {
  max-width: 680px;
}

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.req {
  color: var(--danger);
  font-style: normal;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  font-size: 14px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.smart-box-inline {
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--hl-blue);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.smart-box-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1E3A8A;
}

.quick-pills-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-pill-btn {
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--hl-blue);
  background: #FFFFFF;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.mini-pill-btn:hover {
  background: var(--hl-blue-soft);
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pick-btn {
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
}

.tag-pick-btn.active {
  background: var(--hl-blue-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 24px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
}

.dropzone span {
  font-size: 12px;
  color: var(--muted);
}

.selected-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  justify-content: center;
}

.chosen-file-pill {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--hl-blue-soft);
  color: #1E3A8A;
  font-size: 12px;
  font-weight: 600;
}

/* Lightbox */
.lightbox-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lightbox-img {
  width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.lightbox-pdf {
  width: 100%;
  height: 55dvh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.lightbox-doc-card {
  padding: 36px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.lightbox-meta > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.lightbox-note {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--ink-2);
}

/* Install Guide Modal */
.install-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.install-app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.install-hero h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.install-hero p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.install-tabs-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.install-platform-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.install-platform-card h5 {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--ink);
}

.install-platform-card ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-2);
}

/* PIN Lock Overlay */
#pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: var(--bg);
  padding: 20px;
}

#pin-lock-overlay.active {
  display: grid;
}

.pin-box {
  width: 100%;
  max-width: 340px;
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.pin-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  margin-bottom: 10px;
}

.pin-box h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 8px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  transition: background 0.14s, border-color 0.14s;
}

.pin-dots span.filled {
  background: var(--ink);
  border-color: var(--ink);
}

.pin-error {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--danger);
  margin-bottom: 10px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-key {
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  font-size: 19px;
  font-weight: 700;
}

.pin-key:active {
  background: var(--hl-blue-soft);
}

/* Toast Notification */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 120;
  padding: 10px 18px;
  border-radius: 99px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.success { background: #166534; }
.toast.warn    { background: #B45309; }
.toast.error   { background: #B91C1C; }

/* ==========================================================================
   Mate XTs Dual-Screen Breakpoint (680px – 1079px: Compact Rail + Split View)
   ========================================================================== */

@media (min-width: 680px) and (max-width: 1079px) {
  .sidebar {
    width: var(--rail-w);
    padding: 12px 8px;
    align-items: center;
  }

  .brand-text,
  .fold-chip,
  .sidebar-tier-section,
  .nav-badge,
  .side-tool-btn span {
    display: none;
  }

  .sidebar-brand {
    padding: 4px;
  }

  .nav-item {
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
  }

  .side-tool-btn {
    justify-content: center;
    padding: 9px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customers-workspace.mode-split .customers-master {
    width: 300px;
  }

  .cards-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .fu-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Mate XTs Single-Screen Phone Breakpoint (< 680px)
   ========================================================================== */

@media (max-width: 679px) {
  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(250, 250, 249, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
  }

  .mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
  }

  .bottom-nav-btn {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    padding: 4px 2px;
  }

  .bottom-nav-btn.active {
    color: var(--accent);
  }

  .bnav-icon {
    position: relative;
    display: grid;
    place-items: center;
  }

  .bnav-dot {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--danger);
    color: #FFFFFF;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
  }

  .view-page {
    padding: 14px 14px 26px;
  }

  .hero-card {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-doodle {
    display: none;
  }

  .hero-title {
    font-size: 20px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-card {
    padding: 13px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .dash-grid,
  .cards-grid,
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mini-vault-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customers-workspace.mode-split .customers-master {
    width: 100%;
    border-right: none;
  }

  .customers-detail-pane {
    display: none;
  }

  .detail-header {
    padding: 16px 14px;
  }

  .detail-props-grid {
    grid-template-columns: 1fr;
  }

  .detail-body {
    padding: 14px;
  }

  .fu-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  /* Native sheet style modals on single-screen phone */
  #modal-host {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .toast {
    bottom: calc(var(--bnav-h) + 18px + env(safe-area-inset-bottom, 0px));
  }
}
