/* Sha4owX Flow — Premium UI (huashu-design) */
:root {
  --flow-bg: #08080a;
  --flow-bg2: #111114;
  --flow-bg3: #18181c;
  --flow-surface: oklch(0.14 0.018 255 / 0.72);
  --flow-card: oklch(0.15 0.02 255 / 0.85);
  --flow-cyan: oklch(0.82 0.14 195);
  --flow-cyan-dim: oklch(0.82 0.14 195 / 0.12);
  --flow-teal: oklch(0.65 0.1 195);
  --flow-green: oklch(0.72 0.17 145);
  --flow-wa: oklch(0.68 0.16 155);
  --flow-yellow: oklch(0.82 0.14 95);
  --flow-red: oklch(0.62 0.2 25);
  --flow-white: oklch(0.93 0.01 255);
  --flow-w80: oklch(0.93 0.01 255 / 0.8);
  --flow-w60: oklch(0.93 0.01 255 / 0.58);
  --flow-w40: oklch(0.93 0.01 255 / 0.38);
  --flow-w25: oklch(0.93 0.01 255 / 0.22);
  --flow-w12: oklch(0.93 0.01 255 / 0.1);
  --flow-w06: oklch(0.93 0.01 255 / 0.05);
  --flow-border: oklch(0.93 0.01 255 / 0.08);
  --flow-border-hi: oklch(0.82 0.14 195 / 0.22);
  --flow-font: 'Space Grotesk', system-ui, sans-serif;
  --flow-display: 'Cabinet Grotesk', var(--flow-font);
  --flow-serif: 'Newsreader', Georgia, serif;
  --flow-mono: 'JetBrains Mono', monospace;
  --flow-r: 12px;
  --flow-r-lg: 18px;
  --flow-r-xl: 24px;
  --flow-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --flow-shadow: 0 24px 64px oklch(0.05 0.02 255 / 0.55);
  --flow-glow: 0 0 80px oklch(0.82 0.14 195 / 0.08);
  --flow-scroll-track: transparent;
  --flow-scroll-thumb: oklch(0.93 0 0 / 0.22);
  --flow-scroll-thumb-hover: oklch(0.93 0 0 / 0.38);
  --flow-scroll-thumb-active: oklch(0.93 0 0 / 0.52);
  --flow-scroll-size: 6px;
  /* Dashboard surfaces (dark default) */
  --hd-surface: oklch(0.15 0.014 255 / 0.92);
  --hd-surface-border: oklch(1 0 0 / 0.08);
  --hd-surface-shadow: 0 4px 20px oklch(0 0 0 / 0.32);
  --hd-text-primary: var(--flow-white);
  --hd-text-secondary: var(--flow-w40);
  --hd-text-muted: var(--flow-w25);
  --hd-accent: oklch(0.75 0.14 195);
  --hd-alert-bg: oklch(0.82 0.14 75 / 0.1);
  --hd-alert-border: oklch(0.82 0.14 75 / 0.22);
  --hd-bulk-bg: oklch(0.55 0.15 305 / 0.12);
  --hd-bulk-border: oklch(0.55 0.15 305 / 0.22);
  /* Order pipeline kanban (dark default) */
  --hd-kb-wrap-bg: transparent;
  --hd-kb-wrap-border: transparent;
  --hd-kb-wrap-shadow: none;
  --hd-kb-title: var(--flow-white);
  --hd-kb-link: oklch(0.75 0.14 195);
  --hd-kb-col-bg: transparent;
  --hd-kb-col-border: transparent;
  --hd-kb-col-shadow: none;
  --hd-kb-col-head-bg: transparent;
  --hd-kb-col-head-text: var(--flow-w80);
  --hd-kb-col-count-bg: oklch(1 0 0 / 0.08);
  --hd-kb-col-count-text: var(--flow-w40);
  --hd-kb-col-divider: transparent;
  --hd-kb-col-sep: oklch(1 0 0 / 0.07);
  --hd-kb-card-bg: oklch(0.17 0.014 255 / 0.95);
  --hd-kb-card-border: oklch(1 0 0 / 0.08);
  --hd-kb-card-shadow: none;
  --hd-kb-name: var(--flow-white);
  --hd-kb-muted: var(--flow-w40);
  --hd-kb-amt: var(--flow-w80);
  --hd-kb-btn-advance-fg: oklch(0.72 0.17 145);
  --hd-kb-btn-advance-bg: oklch(0.72 0.17 145 / 0.14);
  --hd-kb-btn-cancel-fg: oklch(0.72 0.12 255);
  --hd-kb-btn-cancel-bg: oklch(0.55 0.12 255 / 0.18);
  --hd-kb-btn-remind-fg: oklch(0.82 0.14 75);
  --hd-kb-btn-remind-bg: oklch(0.82 0.14 75 / 0.14);
  --hd-kb-remind-tag: oklch(0.82 0.14 75);
  --hd-kb-empty: var(--flow-w25);
  /* Form & inset surfaces (dark default) */
  --flow-input-bg: oklch(0.1 0.015 255 / 0.45);
  --flow-inset-bg: oklch(0.1 0.015 255 / 0.35);
  --flow-bar-bg: oklch(0.1 0.015 255 / 0.3);
  --flow-subtle-bg: oklch(0.14 0.02 255 / 0.6);
  --flow-bubble-in-bg: oklch(0.17 0.02 255);
  --flow-preview-bg: oklch(0.12 0.02 255 / 0.55);
  --flow-muted-surface: oklch(0.1 0.015 255 / 0.4);
  --flow-nested-surface: oklch(0.12 0.012 255 / 0.65);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  background: var(--flow-bg);
  color: var(--flow-white);
  font-family: var(--flow-font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: oklch(0.82 0.14 195 / 0.25); }

/* iOS-style minimal scrollbars — sitewide */
html,
body,
* {
  scrollbar-width: thin;
  scrollbar-color: var(--flow-scroll-thumb) var(--flow-scroll-track);
}
*::-webkit-scrollbar {
  width: var(--flow-scroll-size);
  height: var(--flow-scroll-size);
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--flow-scroll-thumb);
  border-radius: 999px;
  border: none;
  min-height: 24px;
  min-width: 24px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--flow-scroll-thumb-hover);
}
*::-webkit-scrollbar-thumb:active {
  background: var(--flow-scroll-thumb-active);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
@media (max-width: 640px) {
  :root { --flow-scroll-size: 4px; }
}

/* Grain overlay */
.flow-premium::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ── Buttons ── */
.flow-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--flow-r);
  font-weight: 600; font-size: 0.82rem;
  transition: transform 0.2s var(--flow-ease), box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.flow-btn-primary {
  background: #f2efe8;
  color: #0a0a0c;
  box-shadow: none;
  border-radius: 100px;
}
.flow-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  background: #fff;
}
.flow-btn-outline {
  border: 1px solid var(--flow-border);
  color: var(--flow-w80);
  background: var(--flow-w06);
  backdrop-filter: blur(8px);
}
.flow-btn-outline:hover { border-color: var(--flow-border-hi); color: var(--flow-cyan); }

/* ── Logo ── */
.flow-logo {
  font-family: var(--flow-display);
  font-weight: 900; font-size: 1.15rem; letter-spacing: -0.02em;
}
.flow-logo span { color: var(--flow-cyan); }
.flow-logo small {
  display: block; font-size: 0.55rem; font-family: var(--flow-mono);
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--flow-w40);
  font-weight: 500; margin-top: 2px;
}

/* ── Landing nav ── */
.flow-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2.5rem); height: 68px;
  background: oklch(0.11 0.015 255 / 0.72);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--flow-border);
}
.flow-nav-links { display: flex; align-items: center; gap: 1.75rem; }
.flow-nav-links a:not(.flow-btn) {
  font-size: 0.8rem; color: var(--flow-w60);
  transition: color 0.2s; letter-spacing: 0.01em;
}
.flow-nav-links a:not(.flow-btn):hover { color: var(--flow-white); }

/* ── Hero split ── */
.flow-hero {
  padding: clamp(6.5rem, 12vw, 9rem) clamp(1.5rem, 5vw, 3rem) clamp(3rem, 6vw, 5rem);
  position: relative; overflow: hidden;
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.flow-hero-glow {
  position: absolute; inset: -20% -10%; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 20% 30%, oklch(0.82 0.14 195 / 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 40% 35% at 85% 70%, oklch(0.55 0.06 195 / 0.06) 0%, transparent 50%);
}
.flow-hero-content { position: relative; z-index: 1; text-align: left; }
.flow-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--flow-mono); font-size: 0.62rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--flow-cyan); margin-bottom: 1.25rem;
  padding: 7px 14px; border-radius: 999px;
  background: var(--flow-cyan-dim); border: 1px solid var(--flow-border-hi);
}
.flow-hero h1 {
  font-family: var(--flow-display);
  font-size: clamp(2.4rem, 5.5vw, 3.6rem); font-weight: 900;
  line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 1.25rem;
}
.flow-hero h1 em { font-style: normal; color: var(--flow-cyan); }
.flow-hero-lead {
  font-family: var(--flow-serif);
  font-size: clamp(1rem, 2vw, 1.12rem); color: var(--flow-w60);
  line-height: 1.65; margin-bottom: 2rem; max-width: 480px;
  font-weight: 400; font-style: italic;
}
.flow-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.flow-hero-visual {
  position: relative; z-index: 1;
  border-radius: var(--flow-r-xl);
  border: 1px solid var(--flow-border);
  background: linear-gradient(165deg, oklch(0.16 0.02 255 / 0.95), oklch(0.12 0.015 255 / 0.98));
  box-shadow: var(--flow-shadow), var(--flow-glow);
  overflow: hidden;
  aspect-ratio: 4/3;
  min-height: 320px;
}
.flow-hero-visual::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 36px;
  background: oklch(0.1 0.015 255 / 0.6);
  border-bottom: 1px solid var(--flow-border);
  display: flex;
}
.flow-mock-topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 36px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; font-size: 0.62rem; font-family: var(--flow-mono); color: var(--flow-w40);
  border-bottom: 1px solid var(--flow-border);
  background: oklch(0.1 0.015 255 / 0.5);
}
.flow-mock-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; margin-top: 36px; }
.flow-mock-row { display: flex; gap: 8px; }
.flow-mock-chip {
  height: 28px; border-radius: 8px; background: var(--flow-w06);
  border: 1px solid var(--flow-border); flex: 1;
}
.flow-mock-chip.on { background: var(--flow-cyan-dim); border-color: var(--flow-border-hi); }
.flow-mock-chat {
  margin-top: 8px; display: flex; flex-direction: column; gap: 8px;
}
.flow-mock-bubble {
  max-width: 72%; padding: 8px 12px; border-radius: 12px;
  font-size: 0.68rem; line-height: 1.45; color: var(--flow-w60);
}
.flow-mock-bubble.in {
  align-self: flex-start; background: oklch(0.18 0.02 255);
  border: 1px solid var(--flow-border); border-radius: 12px 12px 12px 4px;
}
.flow-mock-bubble.out {
  align-self: flex-end; background: oklch(0.68 0.16 155 / 0.15);
  border: 1px solid oklch(0.68 0.16 155 / 0.25);
  border-radius: 12px 12px 4px 12px; color: var(--flow-w80);
}
.flow-mock-badge {
  position: absolute; bottom: 16px; right: 16px;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: oklch(0.68 0.16 155 / 0.12);
  border: 1px solid oklch(0.68 0.16 155 / 0.28);
  font-size: 0.65rem; font-family: var(--flow-mono); color: oklch(0.78 0.12 155);
}
.flow-mock-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--flow-green); animation: flowPulse 1.4s infinite; }

/* ── Stats ── */
.flow-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 1100px; margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3rem) clamp(3rem, 6vw, 4rem);
  gap: 1px;
  background: var(--flow-border);
  border: 1px solid var(--flow-border);
  border-radius: var(--flow-r-xl);
  overflow: hidden;
}
.flow-stat {
  text-align: center; padding: 1.75rem 1rem;
  background: var(--flow-bg2);
}
.flow-stat-num {
  font-family: var(--flow-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 900;
  color: var(--flow-cyan); letter-spacing: -0.02em;
}
.flow-stat-label {
  font-size: 0.72rem; color: var(--flow-w40); margin-top: 6px;
  font-family: var(--flow-mono); letter-spacing: 0.06em; text-transform: uppercase;
}

/* ── Sections ── */
.flow-section { padding: clamp(4rem, 9vw, 7rem) clamp(1.5rem, 5vw, 3rem); }
.flow-section-dark { background: var(--flow-bg2); }
.flow-container { max-width: 1100px; margin: 0 auto; }
.flow-section-head { margin-bottom: clamp(2.5rem, 5vw, 3.5rem); max-width: 640px; }
.flow-section-head.center { text-align: center; margin-left: auto; margin-right: auto; }
.flow-section-head h2 {
  font-family: var(--flow-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 900;
  line-height: 1.1; letter-spacing: -0.025em;
}
.flow-section-head h2 em { font-style: normal; color: var(--flow-cyan); }
.flow-section-head p {
  color: var(--flow-w60); margin-top: 1rem; font-size: 0.92rem; line-height: 1.65;
}

/* ── Features ── */
.flow-features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.flow-feature {
  padding: 1.75rem 1.5rem; border-radius: var(--flow-r-lg);
  background: var(--flow-card); border: 1px solid var(--flow-border);
  transition: border-color 0.25s, transform 0.25s var(--flow-ease);
}
.flow-feature:hover {
  border-color: var(--flow-border-hi);
  transform: translateY(-2px);
}
.flow-feature-icon {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--flow-cyan-dim); border: 1px solid var(--flow-border-hi);
  display: flex; align-items: center; justify-content: center;
  color: var(--flow-cyan); margin-bottom: 1.1rem;
}
.flow-feature h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.01em; }
.flow-feature p { font-size: 0.82rem; color: var(--flow-w60); line-height: 1.6; }

/* ── Channels ── */
.flow-channels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.flow-channel {
  padding: 1.35rem 1.1rem; border-radius: var(--flow-r-lg);
  background: var(--flow-card); border: 1px solid var(--flow-border);
  text-align: center; transition: border-color 0.2s, transform 0.2s var(--flow-ease);
}
.flow-channel:hover { border-color: var(--flow-border-hi); transform: translateY(-2px); }
.flow-channel-icon {
  width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 0.75rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--flow-w06); border: 1px solid var(--flow-border);
  color: var(--flow-cyan);
}
.flow-channel-icon.live { background: oklch(0.68 0.16 155 / 0.1); border-color: oklch(0.68 0.16 155 / 0.22); color: var(--flow-wa); }
.flow-channel strong { font-size: 0.85rem; display: block; margin-bottom: 4px; }
.flow-channel span { font-size: 0.72rem; color: var(--flow-w40); font-family: var(--flow-mono); }

/* ── Ask widget ── */
.flow-ask {
  max-width: 720px; margin: 0 auto;
  background: var(--flow-card); border: 1px solid var(--flow-border);
  border-radius: var(--flow-r-xl); overflow: hidden;
  box-shadow: var(--flow-shadow);
}
.flow-ask-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--flow-border);
  font-size: 0.7rem; font-family: var(--flow-mono); color: var(--flow-w40);
}
.flow-ask-live {
  width: 7px; height: 7px; border-radius: 50%; background: var(--flow-green);
  display: inline-block; margin-right: 6px; animation: flowPulse 1.4s infinite;
}
@keyframes flowPulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
.flow-ask-chat {
  min-height: 180px; max-height: 300px; overflow-y: auto;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 12px;
}
.flow-ask-msg { display: flex; gap: 10px; align-items: flex-start; }
.flow-ask-msg.user { justify-content: flex-end; }
.flow-ask-bubble {
  background: oklch(0.17 0.02 255); border: 1px solid var(--flow-border);
  padding: 12px 15px; border-radius: 16px 16px 16px 4px;
  font-size: 0.86rem; line-height: 1.6; max-width: 85%; color: var(--flow-w80);
  text-wrap: pretty;
}
.flow-ask-msg.user .flow-ask-bubble {
  background: var(--flow-cyan-dim); border-color: var(--flow-border-hi);
  border-radius: 16px 16px 4px 16px;
}
.flow-ask-bubble strong { color: var(--flow-cyan); font-weight: 600; }
.flow-ask-suggestions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 0 20px 16px;
}
.flow-ask-q {
  text-align: left; padding: 12px 14px; border-radius: var(--flow-r);
  background: var(--flow-w06); border: 1px solid var(--flow-border);
  font-size: 0.76rem; color: var(--flow-w60); line-height: 1.45;
  transition: all 0.2s var(--flow-ease);
}
.flow-ask-q:hover { background: var(--flow-cyan-dim); border-color: var(--flow-border-hi); color: var(--flow-white); }
.flow-ask-q:disabled { opacity: 0.4; cursor: not-allowed; }
.flow-ask-input {
  display: flex; gap: 10px; padding: 16px 20px;
  border-top: 1px solid var(--flow-border);
  background: var(--flow-inset-bg);
}
.flow-ask-input input {
  flex: 1; background: var(--flow-input-bg); border: 1px solid var(--flow-border);
  border-radius: var(--flow-r); padding: 12px 16px; outline: none; font-size: 0.86rem;
}
.flow-ask-input input:focus { border-color: var(--flow-border-hi); box-shadow: 0 0 0 3px oklch(0.82 0.14 195 / 0.1); }
.flow-ask-input button {
  width: 44px; height: 44px; border-radius: var(--flow-r);
  background: var(--flow-cyan); color: oklch(0.12 0.02 255);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.flow-ask-input button:hover { transform: scale(1.04); }
.flow-ask-typing { display: flex; gap: 4px; padding: 4px 0; }
.flow-ask-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--flow-cyan); opacity: 0.5; animation: flowBounce 1.4s infinite;
}
.flow-ask-typing span:nth-child(2) { animation-delay: 0.2s; }
.flow-ask-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes flowBounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-5px)} }

/* ── CTA + footer ── */
.flow-cta {
  text-align: center; padding: clamp(4rem, 8vw, 6rem) 1.5rem;
  border-top: 1px solid var(--flow-border);
  background: linear-gradient(180deg, var(--flow-bg2), var(--flow-bg));
  position: relative;
}
.flow-cta::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 50% 60% at 50% 100%, oklch(0.82 0.14 195 / 0.06), transparent);
}
.flow-cta h2 {
  font-family: var(--flow-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 900;
  margin-bottom: 0.75rem; letter-spacing: -0.02em; position: relative;
}
.flow-cta p { color: var(--flow-w60); margin-bottom: 1.75rem; font-size: 0.92rem; position: relative; }
.flow-footer {
  padding: 2rem clamp(1.5rem, 5vw, 3rem);
  border-top: 1px solid var(--flow-border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-size: 0.75rem; color: var(--flow-w40);
}
.flow-footer a { color: var(--flow-w60); transition: color 0.2s; }
.flow-footer a:hover { color: var(--flow-cyan); }

/* ═══ AUTH — split layout ═══ */
.flow-auth-screen {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
}
.flow-auth-brand {
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(2rem, 6vw, 4rem);
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, oklch(0.82 0.14 195 / 0.12), transparent 55%),
    linear-gradient(160deg, oklch(0.13 0.02 255), oklch(0.1 0.015 255));
  border-right: 1px solid var(--flow-border);
  position: relative; overflow: hidden;
}
.flow-auth-brand h1 {
  font-family: var(--flow-display); font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; margin: 1.5rem 0 1rem;
}
.flow-auth-brand h1 em { font-style: normal; color: var(--flow-cyan); }
.flow-auth-brand p {
  font-family: var(--flow-serif); font-style: italic;
  color: var(--flow-w60); font-size: 1.05rem; line-height: 1.65; max-width: 380px;
}
.flow-auth-perks {
  list-style: none; margin-top: 2.5rem; display: flex; flex-direction: column; gap: 14px;
}
.flow-auth-perks li {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.84rem; color: var(--flow-w80);
}
.flow-auth-perk-icon {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--flow-cyan-dim); border: 1px solid var(--flow-border-hi);
  display: flex; align-items: center; justify-content: center; color: var(--flow-cyan);
}
.flow-auth-panel-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
  background: var(--flow-bg);
}
.flow-auth-wrap {
  width: 100%; max-width: 400px;
}
.flow-auth-wrap .flow-logo { margin-bottom: 2rem; display: inline-block; }
.flow-auth-tabs {
  display: flex; gap: 4px; background: var(--flow-w06);
  padding: 4px; border-radius: var(--flow-r); margin-bottom: 1.5rem;
  border: 1px solid var(--flow-border);
}
.flow-auth-tab {
  flex: 1; padding: 10px; border-radius: 9px; font-size: 0.8rem;
  font-weight: 600; color: var(--flow-w40); transition: all 0.2s var(--flow-ease);
}
.flow-auth-tab.active {
  background: var(--flow-cyan-dim); color: var(--flow-cyan);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.05) inset;
}
.flow-auth-panel { display: none; }
.flow-auth-panel.active { display: block; }
.flow-auth-panel h2 {
  font-family: var(--flow-display); font-size: 1.35rem;
  font-weight: 900; letter-spacing: -0.02em; margin-bottom: 0.35rem;
}
.flow-auth-sub { font-size: 0.84rem; color: var(--flow-w40); margin-bottom: 1.5rem; }
.flow-auth-panel input {
  width: 100%; padding: 13px 16px; margin-bottom: 10px;
  border-radius: var(--flow-r); border: 1px solid var(--flow-border);
  background: var(--flow-input-bg); outline: none; font-size: 0.88rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.flow-auth-panel input:focus {
  border-color: var(--flow-border-hi);
  box-shadow: 0 0 0 3px oklch(0.82 0.14 195 / 0.1);
}
.flow-auth-submit { width: 100%; margin-top: 8px; }
.flow-auth-error { color: var(--flow-red); font-size: 0.78rem; text-align: center; margin-top: 1rem; min-height: 1.2em; }
.flow-auth-foot { text-align: center; margin-top: 1.5rem; font-size: 0.75rem; }
.flow-auth-foot a { color: var(--flow-w40); }
.flow-auth-foot a:hover { color: var(--flow-cyan); }

/* ═══ DASHBOARD ═══ */
.app-shell { display: none; height: 100dvh; flex-direction: column; }
.app-shell.active { display: flex; }

.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 1.25rem; flex-shrink: 0;
  border-bottom: 1px solid var(--flow-border);
  background: oklch(0.11 0.015 255 / 0.8);
  backdrop-filter: blur(20px) saturate(1.15);
  position: relative; z-index: 200;
}
.app-topbar-logo {
  font-family: var(--flow-display); font-weight: 900;
  font-size: 0.95rem; letter-spacing: -0.02em;
}
.app-topbar-logo span { color: var(--flow-cyan); }
.app-topbar-right { display: flex; align-items: center; gap: 10px; }
.app-sub-pill {
  font-size: 0.6rem; font-family: var(--flow-mono); padding: 5px 11px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.1em;
}
.app-sub-pill.active {
  color: var(--flow-green); border: 1px solid oklch(0.72 0.17 145 / 0.35);
  background: oklch(0.72 0.17 145 / 0.08);
}
.app-sub-pill.inactive {
  color: oklch(0.75 0.12 25); border: 1px solid oklch(0.62 0.2 25 / 0.3);
  background: oklch(0.62 0.2 25 / 0.07);
}

.app-user-dropdown-sep {
  height: 1px;
  background: var(--flow-border);
  margin: 4px 6px;
}

/* User widget */
.app-user-widget { position: relative; display: flex; align-items: center; gap: 8px; }
.app-user-name { font-size: 0.8rem; color: var(--flow-w80); font-weight: 500; }
.app-user-avatar {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px 4px 5px;
  border-radius: 999px;
  background: oklch(0.22 0.04 255 / 0.7);
  border: 1px solid var(--flow-border);
  font-size: 0.72rem; font-weight: 700;
  color: var(--flow-white);
  transition: background 0.15s;
}
.app-user-avatar:hover { background: oklch(0.27 0.04 255 / 0.8); }
.app-user-avatar span { 
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: oklch(0.45 0.14 255); color: #fff;
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0;
}
.app-user-chevron { color: var(--flow-w40); flex-shrink: 0; }
.app-user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: oklch(0.18 0.02 255 / 0.98);
  border: 1px solid var(--flow-border-hi);
  border-radius: 14px;
  padding: 6px;
  min-width: 130px;
  box-shadow: 0 8px 32px oklch(0.05 0.02 255 / 0.5);
  z-index: 200;
}
.app-user-dropdown button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  border-radius: 9px; font-size: 0.78rem;
  color: var(--flow-w80);
  transition: background 0.12s, color 0.12s;
}
.app-user-dropdown button:hover { background: var(--flow-w06); color: var(--flow-white); }

.app-body { display: flex; flex: 1; overflow: hidden; }
.app-sidebar {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--flow-border);
  background: oklch(0.12 0.015 255 / 0.6);
  backdrop-filter: blur(12px);
  padding: 1.25rem 0.85rem;
  display: flex; flex-direction: column; gap: 2px;
}
.app-nav-label {
  font-size: 0.68rem; letter-spacing: 0.01em;
  color: var(--flow-w40); padding: 0 14px 8px; margin-top: 8px;
}
.app-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.84rem; font-weight: 500; color: var(--flow-w60);
  transition: background 0.2s var(--flow-ease), color 0.2s; text-align: left; width: 100%;
  border: none;
}
.app-nav-item:hover { background: oklch(1 0 0 / 0.04); color: var(--flow-white); }
.app-nav-item.active {
  background: oklch(1 0 0 / 0.08); color: var(--flow-white);
}
.app-nav-item svg { flex-shrink: 0; opacity: 0.55; stroke-width: 1.75; }
.app-nav-item.active svg { opacity: 0.95; }
.app-nav-text { /* desktop: inline label */ }
.app-sidebar-footer {
  margin-top: auto; padding-top: 1rem;
  border-top: 1px solid var(--flow-border);
}
.app-sidebar-footer a {
  font-size: 0.72rem; color: var(--flow-w40);
  display: block; padding: 9px 12px; transition: color 0.2s;
}
.app-sidebar-footer a:hover { color: var(--flow-cyan); }

.app-main {
  flex: 1; overflow-y: auto; padding: clamp(1.25rem, 3vw, 2rem);
  background: transparent; position: relative;
  min-height: 0;
}
/* Inbox: lock page height; scroll only inside chat + contact list */
.app-main:has(#page-inbox.active) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-main:has(#page-home.active) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-main::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 80% 0%, oklch(0.82 0.14 195 / 0.04), transparent 55%);
}
.app-page { display: none; position: relative; z-index: 1; animation: pageIn 0.35s var(--flow-ease); }
.app-page.active { display: block; }
#page-inbox.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#page-inbox .flow-inbox-header { flex-shrink: 0; margin-bottom: 1rem; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.app-page-header { margin-bottom: 1.75rem; }
.app-page-title {
  font-family: var(--flow-display); font-size: 1.5rem;
  font-weight: 900; letter-spacing: -0.025em; margin-bottom: 0.35rem;
}
.app-page-desc { font-size: 0.84rem; color: var(--flow-w60); line-height: 1.55; max-width: 560px; }
.app-page-desc strong { color: var(--flow-w80); font-weight: 600; }

.app-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.app-status-dot.on { background: var(--flow-green); box-shadow: 0 0 8px oklch(0.72 0.17 145 / 0.5); }
.app-status-dot.off { background: var(--flow-red); }

/* Cards */
.app-card, .premium-card {
  background: var(--flow-card);
  border: 1px solid var(--flow-border);
  border-radius: var(--flow-r-lg);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset;
  transition: border-color 0.25s;
}
.premium-card:hover { border-color: var(--flow-border-hi); }
.app-card-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.9rem; font-weight: 600; margin-bottom: 1.1rem;
}
.app-card-title svg { color: var(--flow-cyan); }

.app-form-group { margin-bottom: 1.1rem; }
.app-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--flow-w60);
  margin-bottom: 8px;
  font-family: var(--flow-font);
  letter-spacing: 0.01em;
}
.app-form-group input,
.app-form-group textarea,
.app-form-group select {
  width: 100%; padding: 12px 14px; border-radius: var(--flow-r);
  border: 1px solid var(--flow-border);
  background: var(--flow-input-bg);
  color: var(--flow-white); font-size: 0.84rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.app-form-group textarea { resize: vertical; font-family: var(--flow-mono); line-height: 1.5; }
.app-form-group input:focus,
.app-form-group textarea:focus,
.app-form-group select:focus {
  border-color: var(--flow-border-hi);
  box-shadow: 0 0 0 3px oklch(0.82 0.14 195 / 0.08);
}
.app-field-hint { font-size: 0.72rem; color: var(--flow-w40); margin-top: 6px; }
.flow-profile-preview {
  padding: 14px 16px; border-radius: var(--flow-r);
  border: 1px solid var(--flow-border);
  background: var(--flow-preview-bg);
  font-size: 0.84rem; line-height: 1.6; color: var(--flow-w80);
  min-height: 72px; white-space: pre-wrap;
}
.flow-profile-preview.empty {
  color: var(--flow-w40); font-style: italic;
}

.app-toggle {
  width: 44px; height: 24px; border-radius: 12px; flex-shrink: 0;
  background: var(--flow-w12); position: relative; transition: background 0.25s;
}
.app-toggle.on { background: var(--flow-cyan); }
.app-toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.25s var(--flow-ease);
  box-shadow: 0 1px 3px oklch(0 0 0 / 0.3);
}
.app-toggle.on::after { transform: translateX(20px); }
.flow-bot-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}

/* QR connect */
.flow-connect-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
}
.flow-qr-card {
  border-radius: 16px; overflow: hidden;
  border: none;
  background: oklch(0.17 0.012 255);
  box-shadow: none;
}
.flow-qr-status {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 10px;
  font-size: 0.84rem; font-weight: 500; color: var(--flow-w80);
}
.flow-qr-body { padding: 1.5rem 1.75rem 2rem; text-align: center; }
.flow-qr-placeholder { color: var(--flow-w40); }
.flow-qr-placeholder .flow-qr-icon-wrap {
  width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 1.25rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--flow-w06); border: 1px solid var(--flow-border);
  color: var(--flow-cyan);
}
.flow-qr-placeholder p { font-size: 0.86rem; margin-bottom: 1.5rem; line-height: 1.55; }
.flow-qr-img-wrap {
  background: #fff; border-radius: 18px; padding: 16px;
  display: inline-block; margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px oklch(0 0 0 / 0.25);
}
.flow-qr-steps {
  text-align: left; font-size: 0.82rem; color: var(--flow-w60);
  padding-left: 1.25rem; line-height: 1.9;
}
.flow-qr-steps strong { color: var(--flow-white); font-weight: 600; }
.flow-connected-badge {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.68 0.16 155 / 0.12);
  border: 1px solid oklch(0.68 0.16 155 / 0.28);
  color: var(--flow-wa);
}
.flow-qr-connected h3 {
  font-family: var(--flow-display); font-size: 1.2rem;
  font-weight: 900; margin-bottom: 0.5rem;
}
.flow-qr-connected p { font-size: 0.84rem; color: var(--flow-w60); line-height: 1.55; }

.flow-connect-info {
  display: flex; flex-direction: column; gap: 0;
}
.flow-info-card {
  padding: 1.15rem 1.25rem; border-radius: var(--flow-r-lg);
  background: var(--flow-card); border: 1px solid var(--flow-border);
}
.flow-info-card h4 {
  font-size: 0.88rem; font-weight: 600;
  color: var(--flow-white); margin-bottom: 6px;
}
.flow-info-card p { font-size: 0.84rem; color: var(--flow-w60); line-height: 1.55; }

/* Inbox */
.flow-inbox-layout {
  display: grid; grid-template-columns: 300px 1fr; gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.flow-inbox-list {
  background: var(--flow-card); border: 1px solid var(--flow-border);
  border-radius: var(--flow-r-lg); overflow-y: auto;
  min-height: 0;
}
.flow-inbox-empty {
  padding: 2rem 1.5rem; font-size: 0.82rem; color: var(--flow-w40);
  text-align: center; line-height: 1.55;
}
.flow-inbox-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 13px 15px; border: none;
  border-bottom: 1px solid var(--flow-border);
  background: none; text-align: left; cursor: pointer;
  transition: background 0.15s;
}
.flow-inbox-item:hover, .flow-inbox-item.active {
  background: var(--flow-cyan-dim);
}
.flow-inbox-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: oklch(0.68 0.16 155 / 0.12);
  color: var(--flow-wa); font-weight: 700; font-size: 0.82rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid oklch(0.68 0.16 155 / 0.2);
}
.flow-inbox-info { flex: 1; min-width: 0; }
.flow-inbox-info strong {
  display: block; font-size: 0.84rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.flow-inbox-info span {
  display: block; font-size: 0.72rem; color: var(--flow-w40);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.flow-inbox-time {
  font-size: 0.62rem; color: var(--flow-w40);
  font-family: var(--flow-mono); flex-shrink: 0;
}
.flow-inbox-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.flow-inbox-refresh-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--flow-r);
  border: 1px solid var(--flow-border);
  background: var(--flow-subtle-bg);
  color: var(--flow-w80); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.flow-inbox-refresh-btn:hover {
  background: var(--flow-cyan-dim);
  border-color: oklch(0.68 0.16 155 / 0.35);
  color: var(--flow-wa);
}
.flow-inbox-refresh-btn.spinning i {
  animation: flow-spin 0.8s linear infinite;
}
@keyframes flow-spin {
  to { transform: rotate(360deg); }
}

.flow-chat-panel {
  background: var(--flow-card); border: 1px solid var(--flow-border);
  border-radius: var(--flow-r-lg);
  display: flex; flex-direction: column; overflow: hidden;
  min-height: 0;
  height: 100%;
}
.flow-chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--flow-w40); gap: 0.85rem; padding: 2rem;
}
.flow-chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.flow-chat-head {
  padding: 14px 18px; border-bottom: 1px solid var(--flow-border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--flow-bar-bg);
  flex-shrink: 0;
}
.flow-chat-head-info {
  display: flex; align-items: baseline; gap: 10px; min-width: 0;
}
.flow-chat-head strong { font-size: 0.92rem; font-weight: 600; }
.flow-chat-head span { font-size: 0.72rem; color: var(--flow-w40); font-family: var(--flow-mono); }
.flow-chat-delete-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: var(--flow-r);
  border: 1px solid oklch(0.55 0.18 25 / 0.35);
  background: oklch(0.55 0.18 25 / 0.08);
  color: oklch(0.72 0.16 25); font-size: 0.72rem; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
  flex-shrink: 0;
}
.flow-chat-delete-btn:hover {
  background: oklch(0.55 0.18 25 / 0.18);
}
.flow-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;
  overscroll-behavior: contain;
}
.flow-chat-bubble {
  max-width: 78%; padding: 11px 14px; border-radius: 16px;
  font-size: 0.86rem; line-height: 1.55; word-break: break-word;
  text-wrap: pretty;
}
.flow-chat-bubble.in {
  align-self: flex-start;
  background: var(--flow-bubble-in-bg);
  border: 1px solid var(--flow-border);
  border-radius: 16px 16px 16px 4px;
}
.flow-chat-bubble.out {
  align-self: flex-end;
  background: oklch(0.68 0.16 155 / 0.14);
  border: 1px solid oklch(0.68 0.16 155 / 0.22);
  border-radius: 16px 16px 4px 16px;
}
.flow-chat-send {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--flow-border);
  background: var(--flow-inset-bg);
  flex-shrink: 0;
}
.flow-chat-send input {
  flex: 1; padding: 12px 16px; border-radius: var(--flow-r);
  border: 1px solid var(--flow-border);
  background: var(--flow-input-bg);
  outline: none; font-size: 0.86rem;
}
.flow-chat-send input:focus { border-color: var(--flow-border-hi); }
.flow-chat-send button {
  width: 44px; height: 44px; border-radius: var(--flow-r);
  background: var(--flow-wa); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, filter 0.15s;
}
.flow-chat-send button:hover { transform: scale(1.04); filter: brightness(1.08); }

/* Bulk */
.flow-bulk-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;
}
.flow-bulk-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 1.1rem;
}
.flow-bulk-stat {
  text-align: center; padding: 14px 10px; border-radius: var(--flow-r);
  background: var(--flow-muted-surface); border: 1px solid var(--flow-border);
}
.flow-bulk-stat-num {
  display: block; font-size: 1.5rem; font-weight: 900;
  color: var(--flow-cyan); font-family: var(--flow-display);
  letter-spacing: -0.02em;
}
.flow-bulk-stat-label {
  font-size: 0.62rem; color: var(--flow-w40);
  text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--flow-mono);
}
.flow-bulk-bar-wrap {
  height: 5px; border-radius: 3px;
  background: var(--flow-w06); overflow: hidden; margin-bottom: 0.75rem;
}
.flow-bulk-bar {
  height: 100%; width: 0; border-radius: 3px;
  background: var(--flow-cyan);
  transition: width 0.45s var(--flow-ease);
}
.flow-bulk-status-text { font-size: 0.82rem; color: var(--flow-w60); }
.flow-bulk-errors { margin-top: 0.75rem; }
.flow-bulk-err {
  font-size: 0.72rem; color: oklch(0.75 0.12 25);
  padding: 7px 11px; margin-top: 5px;
  background: oklch(0.62 0.2 25 / 0.08); border-radius: 8px;
  font-family: var(--flow-mono);
}

/* Subscription banner + modal */
.flow-sub-banner {
  margin-bottom: 1.25rem; padding: 13px 17px; border-radius: var(--flow-r-lg);
  background: oklch(0.62 0.2 25 / 0.08);
  border: 1px solid oklch(0.62 0.2 25 / 0.2);
  color: oklch(0.78 0.1 25); font-size: 0.84rem; line-height: 1.55;
}
.flow-sub-banner.warn {
  background: oklch(0.82 0.14 95 / 0.08);
  border-color: oklch(0.82 0.14 95 / 0.22);
  color: oklch(0.88 0.1 95);
}
.flow-sub-banner strong { color: var(--flow-white); }
.flow-sub-banner-link {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--flow-cyan); font: inherit; font-weight: 600;
  text-decoration: underline; cursor: pointer;
}
.flow-sub-banner-link:hover { color: var(--flow-white); }
.flow-btn.needs-sub {
  background: linear-gradient(135deg, oklch(0.82 0.14 195), oklch(0.68 0.16 155));
  color: #041018;
}

.flow-modal-bg {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: oklch(0.05 0.02 255 / 0.88);
  backdrop-filter: blur(16px) saturate(1.1);
  align-items: center; justify-content: center; padding: 1.5rem;
}
.flow-modal-bg.open { display: flex; }
.flow-modal.premium-modal {
  width: 100%; max-width: 420px;
  background: var(--flow-card);
  border: 1px solid var(--flow-border-hi);
  border-radius: var(--flow-r-xl); padding: 2.25rem 2rem;
  box-shadow: var(--flow-shadow), var(--flow-glow);
  text-align: center;
}
.flow-modal-lock {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 1.1rem;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.62 0.2 25 / 0.1);
  border: 1px solid oklch(0.62 0.2 25 / 0.2);
  color: oklch(0.78 0.1 25);
}
.flow-modal h3 {
  font-family: var(--flow-display);
  font-size: 1.4rem; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 0.65rem;
}
.flow-modal-text {
  font-size: 0.88rem; color: var(--flow-w60); line-height: 1.65; margin-bottom: 1.35rem;
}
.flow-modal-features {
  list-style: none; text-align: left; margin-bottom: 1.5rem;
  padding: 1rem 1.1rem; border-radius: var(--flow-r);
  background: var(--flow-muted-surface); border: 1px solid var(--flow-border);
}
.flow-modal-features li {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.82rem; color: var(--flow-w80); padding: 7px 0;
}
.flow-modal-features svg { color: var(--flow-green); flex-shrink: 0; }
.flow-modal-actions { display: flex; flex-direction: column; gap: 10px; }
.flow-modal-actions .flow-btn { width: 100%; }
.flow-pay-modal { max-width: 440px; }

/* App dialog — iOS minimal alert/confirm */
.flow-app-dialog {
  max-width: 360px;
  text-align: left;
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: 20px;
}
.flow-app-dialog-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.82 0.14 195 / 0.12);
  color: var(--flow-cyan);
  margin-bottom: 0.85rem;
}
.flow-app-dialog.is-error .flow-app-dialog-icon {
  background: oklch(0.62 0.2 25 / 0.12);
  color: oklch(0.72 0.16 25);
}
.flow-app-dialog.is-success .flow-app-dialog-icon {
  background: oklch(0.72 0.17 145 / 0.12);
  color: var(--flow-green);
}
.flow-app-dialog h3 {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 0.45rem; text-align: left;
}
.flow-app-dialog-msg {
  font-size: 0.86rem; color: var(--flow-w60); line-height: 1.55;
  margin-bottom: 1.2rem; word-break: break-word; white-space: pre-wrap;
}
.flow-app-dialog-actions {
  display: flex; gap: 10px; justify-content: stretch;
}
.flow-app-dialog-actions .flow-btn {
  flex: 1; min-height: 42px; border-radius: 12px; font-size: 0.82rem;
}
.flow-app-dialog-actions #app-dialog-cancel { display: none; }
.flow-app-dialog.is-confirm .flow-app-dialog-actions #app-dialog-cancel { display: inline-flex; }

.flow-plan-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 0 0 1rem;
}
.flow-plan-card {
  padding: 12px 10px; border-radius: var(--flow-r);
  border: 1px solid var(--flow-border);
  background: var(--flow-muted-surface);
  cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s;
}
.flow-plan-card:hover { border-color: var(--flow-border-hi); }
.flow-plan-card.on {
  border-color: oklch(0.68 0.16 155 / 0.45);
  background: oklch(0.68 0.16 155 / 0.1);
}
.flow-plan-card strong {
  display: block; font-size: 0.78rem; text-transform: capitalize; margin-bottom: 4px;
}
.flow-plan-card .flow-plan-price {
  font-family: var(--flow-display); font-weight: 800; font-size: 1rem;
}
.flow-plan-card span {
  display: block; font-size: 0.62rem; color: var(--flow-w40); margin-top: 4px; line-height: 1.35;
}
.flow-pay-status {
  min-height: 1.2em; font-size: 0.76rem; color: var(--flow-w60); text-align: center; margin-bottom: 0.5rem;
  line-height: 1.5;
}
.flow-pay-status a { color: var(--flow-cyan); text-decoration: underline; }
.flow-btn-ghost {
  background: transparent; border: none; color: var(--flow-w40); font-size: 0.78rem;
}
.flow-btn-ghost:hover { color: var(--flow-w60); }

.sub-inactive .app-nav-item:not([data-page="connect"]) { opacity: 0.42; }
.sub-inactive .app-nav-item:not([data-page="connect"]):hover { opacity: 0.65; }

.flow-save-hint { font-size: 0.75rem; color: var(--flow-green); margin-left: 12px; }

.flow-rzp-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.68rem; font-family: var(--flow-mono); font-weight: 600;
  padding: 6px 11px; border-radius: 999px; margin-bottom: 14px;
  background: oklch(0.55 0.18 25 / 0.1); color: oklch(0.72 0.14 25);
  border: 1px solid oklch(0.55 0.18 25 / 0.22);
}
.flow-rzp-status.on {
  background: oklch(0.68 0.16 155 / 0.12); color: var(--flow-wa);
  border-color: oklch(0.68 0.16 155 / 0.28);
}

.flow-commerce-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.flow-catalog-row {
  display: grid;
  grid-template-columns: 72px 1.2fr 0.7fr 1.4fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}
.cat-image-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.cat-image-btn {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1px dashed var(--flow-border);
  background: var(--flow-inset-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.cat-image-btn:hover { border-color: var(--flow-cyan); }
.cat-image-ph {
  font-size: 0.62rem;
  color: var(--flow-w40);
  text-align: center;
  line-height: 1.2;
  padding: 4px;
}
.cat-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cat-image-clear {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid oklch(0.62 0.2 25 / 0.25);
  background: oklch(0.62 0.2 25 / 0.08);
  color: var(--flow-red); cursor: pointer;
  font-size: 0.85rem; line-height: 1;
}
.flow-catalog-row input,
.flow-catalog-row textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--flow-r);
  border: 1px solid var(--flow-border);
  background: var(--flow-input-bg);
  color: var(--flow-white);
  font-size: 0.8rem;
  font-family: var(--flow-font);
}
.flow-catalog-row textarea { min-height: 38px; resize: vertical; }
.flow-catalog-del {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid oklch(0.62 0.2 25 / 0.25);
  background: oklch(0.62 0.2 25 / 0.08);
  color: var(--flow-red); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.flow-leads-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1rem;
  align-items: start;
}
.flow-lead-q-row {
  display: flex; gap: 8px; margin-bottom: 8px; align-items: center;
}
.flow-lead-q-row input { flex: 1; }
.flow-lead-q-row button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--flow-border);
  background: transparent; color: var(--flow-red); cursor: pointer;
}
.flow-leads-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.flow-leads-table-wrap { overflow-x: auto; }
.flow-leads-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.flow-leads-table th,
.flow-leads-table td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--flow-border);
  vertical-align: top;
}
.flow-leads-table th {
  color: var(--flow-w40); font-weight: 600; font-size: 0.72rem;
}
.flow-leads-empty {
  color: var(--flow-w40); font-size: 0.82rem; text-align: center; padding: 2rem 1rem;
}
.flow-lead-details { color: var(--flow-w60); line-height: 1.45; max-width: 220px; }

.flow-books-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1rem; }
.flow-books-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flow-books-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; flex-wrap: wrap; }
.flow-month-nav { display: flex; align-items: center; gap: 8px; }
.flow-month-btn { min-width: 36px; padding: 8px 12px; font-size: 1.1rem; line-height: 1; }
.flow-month-label { font-size: 0.82rem; color: var(--flow-w50); margin-left: auto; }
.flow-invoice-toolbar { display: flex; align-items: center; gap: 8px; }
.flow-invoice-toolbar input[type="month"] { background: var(--flow-surface); border: 1px solid var(--flow-border); color: var(--flow-w90); padding: 6px 8px; border-radius: 8px; font-size: 0.78rem; }

.flow-inv-tabs {
  display: inline-flex; gap: 6px; padding: 4px;
  margin: 0 0 1.1rem;
  border-radius: 14px;
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
}
.flow-inv-tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent; cursor: pointer;
  color: var(--flow-w50); font-size: 0.84rem; font-weight: 600;
  padding: 10px 16px; border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.flow-inv-tab:hover { color: var(--flow-w90); }
.flow-inv-tab.is-active {
  background: color-mix(in oklab, var(--flow-accent) 18%, var(--flow-surface));
  color: var(--flow-w90);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--flow-accent) 35%, transparent);
}
.flow-inv-panel[hidden] { display: none !important; }
.flow-inv-view-toolbar { margin-top: 0; }
.flow-inv-month-label-wrap {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 148px; height: 40px; padding: 0 14px; gap: 6px;
  border-radius: 10px; border: 1px solid var(--flow-border);
  background: var(--flow-surface); cursor: pointer;
  color: inherit; font: inherit; appearance: none; -webkit-appearance: none;
  transition: border-color 0.15s, background 0.15s;
}
.flow-inv-month-label-wrap:hover {
  border-color: color-mix(in oklab, var(--flow-accent) 45%, var(--flow-border));
  background: color-mix(in oklab, var(--flow-accent) 8%, var(--flow-surface));
}
.flow-inv-month-label-wrap:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--flow-accent) 55%, transparent);
  outline-offset: 2px;
}
.flow-inv-month-caption {
  font-size: 0.88rem; font-weight: 600; color: var(--flow-w90);
  pointer-events: none; white-space: nowrap;
}
.flow-inv-month-label-wrap::after {
  content: "";
  width: 14px; height: 14px; flex-shrink: 0; pointer-events: none; opacity: 0.65;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--flow-w70);
}
.flow-inv-month-label-wrap input[type="month"],
.flow-inv-month-label-wrap input[type="date"] {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  width: 100%; height: 100%; border: 0; padding: 0; margin: 0;
}
.gst-period-panel { margin-bottom: 0.5rem; }
.gst-period-panel select,
.gst-period-panel input[type="date"],
.gst-period-panel input[type="month"] {
  width: 100%; background: var(--flow-surface); border: 1px solid var(--flow-border);
  color: var(--flow-w90); padding: 8px 10px; border-radius: 8px;
}
.flow-books-toolbar input[type="month"] { background: var(--flow-surface); border: 1px solid var(--flow-border); color: var(--flow-w90); padding: 8px 10px; border-radius: 8px; }
.flow-import-block { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--flow-border); }
.flow-import-title { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; color: var(--flow-w90); margin: 0 0 8px; }
.flow-import-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.flow-file-btn { cursor: pointer; margin: 0; }
.flow-file-btn input { display: none; }
.flow-import-status { font-size: 0.78rem; color: var(--flow-w60); margin: 10px 0 0; min-height: 1.2em; }
.flow-import-status.ok { color: #059669; }
.flow-import-status.err { color: #dc2626; }

.flow-scan-block {
  margin: 0 0 1.1rem;
  padding: 12px 14px;
  border: 1px dashed color-mix(in oklab, var(--flow-accent) 45%, var(--flow-border));
  border-radius: 14px;
  background: color-mix(in oklab, var(--flow-accent) 6%, var(--flow-surface));
}
.flow-scan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flow-scan-preview {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  padding: 10px; border-radius: 12px; background: var(--flow-surface); border: 1px solid var(--flow-border);
}
.flow-scan-preview[hidden],
.flow-scan-progress[hidden] { display: none !important; }
.flow-scan-thumb-wrap {
  width: 56px; height: 56px; border-radius: 8px; background: var(--flow-w10);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  color: var(--flow-w40);
}
.flow-scan-preview img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--flow-w10);
  display: block;
}
.flow-scan-preview img[hidden] { display: none !important; }
.flow-scan-preview-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.flow-scan-preview-meta strong {
  font-size: 0.8rem; color: var(--flow-w90); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.flow-scan-preview-meta span { font-size: 0.72rem; color: var(--flow-w40); }
.flow-scan-progress { margin-top: 12px; }
.flow-scan-bar {
  height: 4px; border-radius: 999px; background: var(--flow-w10); overflow: hidden; margin-bottom: 8px;
}
.flow-scan-bar span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--flow-accent), #22d3ee);
  animation: flow-scan-slide 1.1s ease-in-out infinite;
}
@keyframes flow-scan-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
.flow-scan-progress p { margin: 0; font-size: 0.78rem; color: var(--flow-w60); }
.flow-gstin-row { display: flex; gap: 8px; align-items: stretch; }
.flow-gstin-row input { flex: 1; min-width: 0; }
.flow-gstin-row .flow-btn { flex-shrink: 0; padding: 0 12px; font-size: 0.75rem; }
.flow-inv-extra-items {
  margin: 0 0 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--flow-w05, oklch(1 0 0 / 0.03)); border: 1px solid var(--flow-border);
  font-size: 0.78rem; color: var(--flow-w60); line-height: 1.45;
}
.flow-gst-modal { max-width: 420px; }
.flow-gst-gstin {
  font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; letter-spacing: 0.04em;
  color: var(--flow-accent); margin: 0 0 14px; word-break: break-all;
}
.flow-gst-captcha-wrap {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  min-height: 56px;
}
.flow-gst-captcha-wrap img {
  height: 52px; max-width: 180px; border-radius: 8px; background: #fff; border: 1px solid var(--flow-border);
}
.flow-gst-captcha-ph {
  flex: 1; font-size: 0.82rem; color: var(--flow-w40);
  padding: 14px; border-radius: 8px; border: 1px dashed var(--flow-border);
}
.flow-books-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 1.25rem; }
.flow-stat-card {
  background: var(--flow-surface); border: 1px solid var(--flow-border); border-radius: 12px; padding: 14px 16px;
}
.flow-stat-card span { display: block; font-size: 0.72rem; color: var(--flow-w40); margin-bottom: 6px; }
.flow-stat-card strong { font-size: 1.15rem; color: var(--flow-w90); }
.flow-stat-card.income strong { color: #059669; }
.flow-stat-card.expense strong { color: #dc2626; }
.flow-stat-card.net strong { color: var(--flow-accent); }
.flow-stat-card.turnover strong { color: #2563eb; }
.flow-check-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--flow-w60); margin: 12px 0; }
.flow-inv-dl { font-size: 0.72rem; color: var(--flow-accent); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; }
.flow-inv-dl:hover { text-decoration: underline; }
.flow-inv-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow-inv-del { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 0.72rem; padding: 0; }
.flow-inv-del:hover { text-decoration: underline; }
.tx-del { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 0.72rem; }

.flow-inventory-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1.25rem; }
.flow-inventory-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 1.25rem;
}
.flow-inventory-search, .flow-inventory-filter {
  flex: 1; min-width: 160px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--flow-border); background: var(--flow-surface); color: var(--flow-w90);
  font-size: 0.82rem;
}
.flow-inventory-filter { flex: 0 0 160px; }
.flow-inventory-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px;
}
.flow-inv-card {
  background: var(--flow-surface); border: 1px solid var(--flow-border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
}
.flow-inv-card.low { border-color: #f59e0b55; }
.flow-inv-card.out { border-color: #dc262655; opacity: 0.85; }
.flow-inv-img-wrap {
  position: relative; aspect-ratio: 4/3; background: var(--flow-bg); border-bottom: 1px solid var(--flow-border);
}
.flow-inv-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flow-inv-img-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--flow-w40); font-size: 0.75rem; cursor: pointer;
}
.flow-inv-img-ph:hover { color: var(--flow-cyan); }
.flow-inv-img-file { display: none; }
.flow-inv-badge {
  position: absolute; top: 8px; right: 8px; font-size: 0.65rem; font-weight: 600;
  padding: 3px 8px; border-radius: 20px; background: #05966922; color: #059669;
}
.flow-inv-badge.low { background: #f59e0b22; color: #d97706; }
.flow-inv-badge.out { background: #dc262622; color: #dc2626; }
.flow-inv-badge.na { background: var(--flow-w10); color: var(--flow-w40); }
.flow-inv-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.flow-inv-name {
  width: 100%; border: none; background: transparent; color: var(--flow-w90);
  font-weight: 600; font-size: 0.9rem; padding: 0;
}
.flow-inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flow-inv-meta input, .flow-inv-desc {
  width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--flow-border);
  background: var(--flow-input-bg); color: var(--flow-w80); font-size: 0.75rem;
}
.flow-inv-desc { resize: vertical; min-height: 48px; grid-column: 1 / -1; }
.flow-inv-actions { display: flex; justify-content: flex-end; margin-top: auto; }
.flow-inv-del {
  background: none; border: none; color: #dc2626; cursor: pointer; font-size: 0.72rem; padding: 4px 0;
}
.flow-inventory-empty { color: var(--flow-w40); font-size: 0.85rem; text-align: center; padding: 2rem; }

/* Invoice page layout + live preview */
.flow-invoice-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.flow-invoice-list-card { grid-column: 1 / -1; }
.flow-inv-preview-hint { font-size: 0.68rem; color: var(--flow-w40); }
.inv-theme-form { margin: 0 0 12px; }
.inv-theme-form label { font-size: 0.72rem; margin-bottom: 6px; }
.inv-theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.inv-theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 6px; border-radius: 10px;
  border: 2px solid oklch(1 0 0 / 0.08);
  background: var(--flow-muted-surface);
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.inv-theme-swatch:hover { border-color: oklch(1 0 0 / 0.2); transform: translateY(-1px); }
.inv-theme-swatch.is-active {
  border-color: var(--flow-cyan, #22d3ee);
  box-shadow: 0 0 0 1px oklch(0.75 0.14 195 / 0.35);
}
.inv-theme-swatch-colors {
  display: flex; gap: 3px; width: 100%; justify-content: center;
}
.inv-theme-swatch-colors i {
  display: block; width: 18px; height: 18px; border-radius: 4px;
}
.inv-theme-swatch-colors i:first-child { background: var(--swatch-accent); transform: rotate(8deg); }
.inv-theme-swatch-colors i:last-child { background: var(--swatch-navy); transform: rotate(-6deg); margin-top: 2px; }
.inv-theme-swatch-name {
  font-size: 0.58rem; color: var(--flow-w70, #cbd5e1); text-align: center; line-height: 1.2;
}
.inv-design-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.inv-design-tab {
  font-size: 0.72rem;
  border: 1px solid var(--flow-border);
  background: var(--flow-surface);
  color: var(--flow-w80);
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
}
.inv-design-tab.active {
  background: var(--flow-white);
  border-color: var(--flow-border-hi);
  color: var(--flow-cyan);
}
.inv-accent-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.inv-accent-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  cursor: pointer;
  padding: 0;
}
.inv-accent-swatch.active { box-shadow: 0 0 0 2px var(--flow-cyan); }
.inv-accent-custom {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: conic-gradient(red,yellow,lime,cyan,blue,magenta,red);
}
.inv-accent-custom input[type="color"] {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 36px;
  height: 36px;
  border: none;
  cursor: pointer;
}
.inv-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.inv-logo-preview-wrap {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px dashed var(--flow-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}
.inv-logo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.inv-logo-placeholder {
  font-size: 0.62rem;
  color: var(--flow-w40);
  text-align: center;
  padding: 4px;
}
.inv-logo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-logo-pick { cursor: pointer; margin: 0; }
.flow-invoice-preview-scroll {
  /* Do not use overflow-x:auto here — CSS computes the other axis to auto too,
     which forces a nested scrollbar even when the page has free space. */
  overflow: hidden;
  border-radius: 12px;
  background: oklch(0.08 0.01 255 / 0.5);
  padding: 12px;
}
.flow-invoice-preview {
  background: #e4e3df;
  color: #101113;
  border-radius: 14px;
  box-shadow: 0 8px 32px oklch(0 0 0 / 0.35);
  font-size: 11px;
  line-height: 1.45;
  min-height: 0;
  position: relative;
  overflow: hidden;
  padding: 10px;
  width: 100%;
}
.flow-invoice-preview .inv-multi-root,
.flow-invoice-preview .inv-multi-root .design {
  width: 100%;
}
.flow-invoice-preview .inv-multi-root .sheet {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto !important;
  box-sizing: border-box;
}
.flow-invoice-preview .inv-multi-root .d1 .inner,
.flow-invoice-preview .inv-multi-root .d2 .inner,
.flow-invoice-preview .inv-multi-root .d3 .inner {
  padding-left: clamp(18px, 3.5vw, 40px);
  padding-right: clamp(18px, 3.5vw, 40px);
}
/* Invoice preview — single column, soft cards */
.inv-tpl {
  --inv-red: #d64545;
  --inv-navy: #1a2744;
  --inv-muted: #6b7280;
  --inv-line: #e8ecf1;
  --inv-surface: #f8fafc;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.inv-tpl-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--inv-line);
}
.inv-tpl-brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.inv-tpl-logo { display: flex; gap: 4px; flex-shrink: 0; }
.inv-tpl-logo span {
  display: block; width: 10px; height: 10px; background: var(--inv-red);
  transform: rotate(12deg); border-radius: 3px;
}
.inv-tpl-logo span:nth-child(2) { transform: rotate(-8deg); margin-top: 2px; }
.inv-tpl-logo span:nth-child(3) { transform: rotate(18deg); margin-top: -1px; }
.inv-tpl-brand-text h2 {
  margin: 0; font-size: 15px; font-weight: 800; color: #111827; letter-spacing: -0.01em;
  word-break: break-word;
}
.inv-tpl-tagline { margin: 3px 0 0; font-size: 9px; color: var(--inv-muted); }
.inv-tpl-title {
  margin: 0; font-size: 26px; font-weight: 800; color: var(--inv-red);
  letter-spacing: 0.06em; line-height: 1; flex-shrink: 0;
}
.inv-tpl-body {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 24px 20px;
}
.inv-tpl-card {
  background: var(--inv-surface);
  border: 1px solid var(--inv-line);
  border-radius: 14px;
  padding: 14px 16px;
}
.inv-tpl-card-label {
  font-size: 7px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #9ca3af; margin-bottom: 10px;
}
.inv-tpl-card-meta .inv-tpl-invno-num {
  font-size: 22px; font-weight: 700; color: #111827; letter-spacing: 0.04em;
  line-height: 1.1; margin-bottom: 10px;
}
.inv-tpl-meta-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.inv-tpl-chip {
  display: inline-flex; align-items: center; padding: 5px 10px;
  border-radius: 999px; background: #fff; border: 1px solid var(--inv-line);
  font-size: 8.5px; color: #374151;
}
.inv-tpl-chip.inv-tpl-status.pending { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.inv-tpl-chip.inv-tpl-status.paid { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.inv-tpl-customer { display: block; font-size: 13px; color: #111827; margin-bottom: 6px; }
.inv-tpl-detail { margin: 0 0 5px; font-size: 9px; color: #4b5563; line-height: 1.45; }
.inv-tpl-detail span {
  display: inline-block; min-width: 52px; font-weight: 600; color: #9ca3af;
  text-transform: uppercase; font-size: 7px; letter-spacing: 0.06em; margin-right: 4px;
}
.inv-tpl-card-table { padding-bottom: 12px; }
.inv-tpl-table-wrap {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--inv-line); background: #fff;
}
.inv-tpl-thead {
  display: grid; grid-template-columns: 1fr 58px 34px 62px; gap: 6px;
  background: var(--inv-navy); color: #fff; padding: 10px 12px;
  font-size: 7.5px; font-weight: 700; letter-spacing: 0.07em;
}
.inv-tpl-thead span:last-child { text-align: right; }
.inv-tpl-row {
  display: grid; grid-template-columns: 1fr 58px 34px 62px; gap: 6px;
  padding: 10px 12px; font-size: 9px; color: #111827;
}
.inv-tpl-row + .inv-tpl-row { border-top: 1px solid #f1f5f9; }
.inv-tpl-row:nth-child(even) { background: #fafbfc; }
.inv-tpl-row .amt { text-align: right; font-weight: 600; }
.inv-tpl-card-totals .inv-tpl-tline {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 9px; color: var(--inv-muted); margin-bottom: 8px; padding: 0 2px;
}
.inv-tpl-card-totals .inv-tpl-tline strong { color: #111827; font-weight: 600; }
.inv-tpl-total-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  background: var(--inv-navy); color: #fff;
  font-size: 10px; font-weight: 700;
}
.inv-tpl-total-bar strong { font-size: 12px; }
.inv-tpl-card-terms p {
  margin: 0; font-size: 8px; color: #9ca3af; line-height: 1.6;
}
.inv-tpl-contacts-col {
  display: flex; flex-direction: column; gap: 8px;
}
.inv-tpl-contact {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--inv-red); color: #fff; border-radius: 12px;
  padding: 12px 14px;
}
.inv-tpl-contact p { margin: 0 0 3px; font-size: 8px; line-height: 1.4; word-break: break-word; }
.inv-tpl-contact-ico {
  flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px;
  background: #fff;
  mask-size: contain; mask-repeat: no-repeat; mask-position: center;
  -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center;
}
.inv-tpl-ico-phone {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1-9.4 0-17-7.6-17-17 0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.5.6 3.6.1.3 0 .7-.2 1L6.6 10.8z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1-9.4 0-17-7.6-17-17 0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.5.6 3.6.1.3 0 .7-.2 1L6.6 10.8z'/%3E%3C/svg%3E");
}
.inv-tpl-ico-web {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm7.9 9h-3.4a15.9 15.9 0 0 0-1.2-5.1A8 8 0 0 1 19.9 11zM12 4c.9 1.5 2.1 4.2 2.4 7H9.6C9.9 8.2 11.1 5.5 12 4zM8.7 5.9A15.9 15.9 0 0 0 7.5 11H4.1a8 8 0 0 1 4.6-5.1zM4.1 13h3.4c.3 1.9.9 3.7 1.7 5.3A8 8 0 0 1 4.1 13zm7.5 7c-.9-1.5-2.1-4.2-2.4-7h4.8c-.3 2.8-1.5 5.5-2.4 7zm3.8-1.7c.8-1.6 1.4-3.4 1.7-5.3h3.4a8 8 0 0 1-5.1 5.3z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm7.9 9h-3.4a15.9 15.9 0 0 0-1.2-5.1A8 8 0 0 1 19.9 11zM12 4c.9 1.5 2.1 4.2 2.4 7H9.6C9.9 8.2 11.1 5.5 12 4zM8.7 5.9A15.9 15.9 0 0 0 7.5 11H4.1a8 8 0 0 1 4.6-5.1zM4.1 13h3.4c.3 1.9.9 3.7 1.7 5.3A8 8 0 0 1 4.1 13zm7.5 7c-.9-1.5-2.1-4.2-2.4-7h4.8c-.3 2.8-1.5 5.5-2.4 7zm3.8-1.7c.8-1.6 1.4-3.4 1.7-5.3h3.4a8 8 0 0 1-5.1 5.3z'/%3E%3C/svg%3E");
}
.inv-tpl-ico-pin {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5c-1.4 0-2.5-1.1-2.5-2.5S10.6 6.5 12 6.5s2.5 1.1 2.5 2.5S13.4 11.5 12 11.5z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5c-1.4 0-2.5-1.1-2.5-2.5S10.6 6.5 12 6.5s2.5 1.1 2.5 2.5S13.4 11.5 12 11.5z'/%3E%3C/svg%3E");
}
.inv-tpl-footer {
  position: relative; height: 24px; background: var(--inv-navy);
  border-radius: 16px 16px 0 0; margin-top: 4px; overflow: hidden;
}
.inv-tpl-wave {
  position: absolute; left: 0; bottom: 0; width: 110px; height: 32px;
  background: var(--inv-red);
  border-top-right-radius: 70% 100%;
}
@media (max-width: 480px) {
  .inv-tpl-title { font-size: 22px; }
  .inv-tpl-card-meta .inv-tpl-invno-num { font-size: 18px; }
  .inv-tpl-body { padding: 14px 16px 16px; }
  .inv-tpl-header { padding: 18px 16px 16px; }
}

/* Mobile shell — hidden on desktop */
.app-mobile-nav,
.app-more-sheet { display: none; }
.flow-chat-back-btn { display: none; }

/* Responsive */
@media (max-width: 960px) {
  .flow-hero { grid-template-columns: 1fr; text-align: center; }
  .flow-hero-content { text-align: center; }
  .flow-hero-lead { margin-left: auto; margin-right: auto; }
  .flow-hero-actions { justify-content: center; }
  .flow-hero-visual { max-width: 480px; margin: 0 auto; }
  .flow-stats { grid-template-columns: repeat(2, 1fr); }
  .flow-features { grid-template-columns: 1fr 1fr; }
  .flow-channels { grid-template-columns: repeat(2, 1fr); }
  .flow-auth-screen { grid-template-columns: 1fr; }
  .flow-auth-brand { display: none; }
  .flow-connect-layout { grid-template-columns: 1fr; }
  .flow-inbox-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 220px) minmax(0, 1fr); }
  .flow-bulk-grid { grid-template-columns: 1fr; }
  .flow-commerce-grid { grid-template-columns: 1fr; }
  .flow-leads-layout { grid-template-columns: 1fr; }
  .flow-catalog-row { grid-template-columns: 1fr; }
  .flow-books-grid { grid-template-columns: 1fr; }
  .flow-invoice-layout { grid-template-columns: 1fr; }
  .flow-books-stats { grid-template-columns: repeat(2, 1fr); }
  .flow-inventory-stats { grid-template-columns: repeat(2, 1fr); }
  .flow-inventory-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .cat-image-wrap { flex-direction: row; }
  .flow-inv-tabs { display: flex; width: 100%; }
  .flow-inv-tab { flex: 1; justify-content: center; }
}

@media (max-width: 640px) {
  .flow-features { grid-template-columns: 1fr; }
  .flow-ask-suggestions { grid-template-columns: 1fr; }
  .flow-nav-links a:not(.flow-btn) { display: none; }
  .flow-bulk-stats { grid-template-columns: repeat(2, 1fr); }
  .flow-plan-grid { grid-template-columns: 1fr; }

  /* Safe zone — no horizontal bleed on notched phones / Safari */
  html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
  }
  .app-shell,
  .app-body,
  .app-main,
  .app-page,
  .app-card,
  .premium-card,
  .flow-leads-layout,
  .flow-books-grid,
  .flow-commerce-grid,
  .flow-inbox-layout {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  /* ── Native-style phone app shell ── */
  .app-shell { height: 100dvh; height: 100svh; overflow-x: hidden; }
  .app-topbar {
    min-height: 48px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  .app-topbar-logo { font-size: 0.85rem; }
  .app-user-name { display: none; }
  .app-sub-pill { font-size: 0.55rem; padding: 3px 8px; }

  .app-body { flex-direction: column; overflow: hidden; }
  .app-sidebar { display: none !important; }

  /* 5-tab bottom bar (like WhatsApp / banking apps) */
  .app-mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    align-items: stretch;
    justify-content: space-around;
    gap: 0;
    padding-top: 4px;
    padding-left: max(6px, env(safe-area-inset-left, 0px));
    padding-right: max(6px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background: oklch(0.1 0.015 255 / 0.97);
    backdrop-filter: blur(24px) saturate(1.3);
    border-top: 1px solid var(--flow-border);
    box-shadow: 0 -4px 24px oklch(0.05 0.02 255 / 0.5);
  }
  .app-shell.inbox-chat-open .app-mobile-nav { display: none; }

  .app-mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    max-width: 20%;
    padding: 6px 4px;
    border-radius: 12px;
    color: var(--flow-w40);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .app-mobile-tab span {
    font-size: 0.58rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.01em;
  }
  .app-mobile-tab.active {
    color: var(--flow-cyan);
    background: var(--flow-cyan-dim);
  }
  .app-mobile-tab.active svg { stroke: var(--flow-cyan); }

  /* More menu — bottom sheet */
  .app-more-sheet {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 300;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.25s;
  }
  .app-more-sheet.open {
    pointer-events: auto;
    visibility: visible;
  }
  .app-more-backdrop {
    position: absolute;
    inset: 0;
    background: oklch(0.05 0.02 255 / 0.55);
    border: none;
    opacity: 0;
    transition: opacity 0.25s;
  }
  .app-more-sheet.open .app-more-backdrop { opacity: 1; }
  .app-more-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: oklch(0.12 0.015 255 / 0.98);
    border-radius: 20px 20px 0 0;
    padding: 1rem max(1rem, env(safe-area-inset-right, 0px)) calc(1rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
    transform: translateY(100%);
    transition: transform 0.3s var(--flow-ease);
    border-top: 1px solid var(--flow-border);
  }
  .app-more-sheet.open .app-more-panel { transform: translateY(0); }
  .app-more-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
  }
  .app-more-head h3 { font-size: 1rem; font-weight: 700; }
  .app-more-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--flow-w06);
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .app-more-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .app-more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 76px;
    padding: 12px 8px;
    border-radius: 14px;
    background: var(--flow-w06);
    border: 1px solid var(--flow-border);
    font-size: 0.68rem;
    color: var(--flow-w80);
    touch-action: manipulation;
  }
  .app-more-item.active {
    border-color: var(--flow-border-hi);
    background: var(--flow-cyan-dim);
    color: var(--flow-cyan);
  }
  body.mobile-more-open { overflow: hidden; }

  .app-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-top: 0.75rem;
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
    min-height: 0;
    box-sizing: border-box;
  }
  .app-shell.inbox-chat-open .app-main {
    padding: 0;
    overflow: hidden;
  }

  /* Compact page chrome */
  .app-page-header { margin-bottom: 0.75rem; }
  .app-page-title { font-size: 1.15rem; margin-bottom: 0.15rem; }
  .app-page-desc { display: none; }
  .app-card, .premium-card {
    padding: 1rem;
    border-radius: 14px;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
  }
  .app-card-title { font-size: 0.85rem; margin-bottom: 0.85rem; }

  .flow-btn {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 0.88rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .app-form-group { margin-bottom: 0.9rem; min-width: 0; }
  .app-form-group input,
  .app-form-group textarea,
  .app-form-group select,
  .flow-inventory-search,
  .flow-inventory-filter,
  .flow-inv-name,
  .flow-inv-meta input,
  .flow-inv-desc,
  .flow-catalog-row input,
  .flow-catalog-row textarea,
  .flow-chat-send input,
  .flow-books-toolbar input[type="month"],
  .flow-lead-q-row input,
  input[type="date"],
  input[type="month"],
  input[type="datetime-local"],
  select {
    font-size: 16px;
    min-height: 48px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
  }
  .flow-books-row2,
  .flow-books-row2 > *,
  .flow-leads-layout > *,
  .flow-commerce-grid > *,
  .flow-inventory-toolbar,
  .flow-inventory-grid,
  .flow-lead-q-row {
    min-width: 0;
    max-width: 100%;
  }
  .flow-lead-q-row {
    gap: 10px;
    align-items: stretch;
  }
  .flow-lead-q-row input { flex: 1; min-width: 0; }
  .flow-lead-q-row button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    flex-shrink: 0;
    align-self: center;
  }
  .app-card .flow-btn,
  .app-page > .flow-btn,
  .flow-modal-actions .flow-btn,
  .flow-inventory-toolbar .flow-btn,
  #btn-save-commerce {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .app-topbar .flow-btn,
  .flow-inbox-refresh-btn,
  .flow-month-btn,
  .flow-month-nav .flow-btn,
  .flow-chat-send button,
  .flow-chat-delete-btn,
  .flow-chat-back-btn,
  .app-more-close,
  .tx-del,
  .flow-inv-del,
  .flow-catalog-del,
  .cat-image-clear,
  .flow-lead-q-row button,
  .app-mobile-tab,
  .app-more-item {
    width: auto;
    max-width: none;
  }
  .app-toggle { width: 52px; height: 30px; }
  .app-toggle::after { width: 22px; height: 22px; top: 4px; left: 4px; }
  .app-toggle.on::after { transform: translateX(22px); }
  .flow-bot-toggle-row {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  /* Stats — 2-column grid on phone (no horizontal bleed) */
  .flow-books-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
  .flow-books-stats .flow-stat-card {
    flex: none;
    width: auto;
    min-width: 0;
    padding: 12px 14px;
  }
  .flow-books-stats .flow-stat-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .flow-inventory-stats {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 1rem;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    width: 100%;
    max-width: 100%;
  }
  .flow-inventory-stats .flow-stat-card {
    flex: 0 0 42vw;
    min-width: 130px;
    scroll-snap-align: start;
    padding: 12px 14px;
  }
  .flow-stat-card strong { font-size: 1.05rem; }

  /* Inbox — list OR full-screen chat (WhatsApp pattern) */
  #page-inbox.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  #page-inbox .flow-inbox-header {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    flex-direction: row;
    align-items: center;
  }
  #page-inbox .flow-inbox-header > div { flex: 1; min-width: 0; }
  #page-inbox .flow-inbox-header .app-page-title { margin: 0; }
  .flow-inbox-refresh-btn {
    width: auto;
    min-height: 40px;
    padding: 8px 12px;
    flex-shrink: 0;
  }
  .flow-inbox-refresh-btn span { display: none; }

  .flow-inbox-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
    overflow: hidden;
  }
  .flow-inbox-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    min-height: 0;
  }
  .flow-inbox-item {
    flex: none;
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--flow-border);
    min-height: 68px;
    padding: 14px 16px;
  }
  .flow-chat-panel {
    display: none;
    flex: 1;
    min-height: 0;
    border-radius: 0;
    border: none;
  }

  #page-inbox.inbox-chat-open .flow-inbox-header,
  #page-inbox.inbox-chat-open .flow-inbox-list { display: none; }
  #page-inbox.inbox-chat-open .flow-inbox-layout { flex: 1; }
  #page-inbox.inbox-chat-open .flow-chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .flow-chat-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--flow-w06);
    margin-right: 4px;
  }
  .flow-chat-head {
    padding: 10px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    gap: 8px;
    flex-wrap: nowrap;
  }
  .flow-chat-head-info { flex: 1; min-width: 0; }
  .flow-chat-delete-btn span { display: none; }
  .flow-chat-delete-btn { min-width: 40px; min-height: 40px; padding: 8px; }
  .flow-chat-messages {
    flex: 1;
    padding: 12px;
    min-height: 0;
  }
  .flow-chat-bubble { max-width: 85%; font-size: 0.92rem; }
  .flow-chat-send {
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    gap: 8px;
    flex-shrink: 0;
  }
  .flow-chat-send input {
    width: auto;
    flex: 1;
    min-width: 0;
    min-height: 44px;
    border-radius: 24px;
    padding: 12px 16px;
  }
  .flow-chat-send button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* Tables → stacked cards */
  .flow-leads-table-wrap {
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
  }
  .flow-leads-table { display: block; min-width: 0; width: 100%; max-width: 100%; border: none; }
  .flow-leads-table thead { display: none; }
  .flow-leads-table tbody { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  .flow-leads-table tr {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--flow-card);
    border: 1px solid var(--flow-border);
    border-radius: 14px;
    padding: 12px 14px;
  }
  .flow-leads-table td {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px 0;
    border: none;
    font-size: 0.84rem;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .flow-leads-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.65rem;
    color: var(--flow-w40);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    flex-shrink: 0;
  }
  .flow-leads-table td[data-label=""]::before { display: none; }
  .flow-leads-table td[data-label=""] {
    flex-direction: row;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--flow-border);
    margin-top: 4px;
  }
  .flow-lead-details {
    max-width: 100%;
    text-align: left;
    line-height: 1.5;
  }
  .flow-lead-detail-line {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: var(--flow-w80);
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .flow-lead-detail-line:last-child { margin-bottom: 0; }
  .flow-lead-detail-line span {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--flow-w40);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  /* Money / books */
  .flow-books-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0.75rem;
    align-items: stretch;
    width: 100%;
  }
  .flow-month-nav {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  .flow-month-nav label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--flow-w40);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .flow-month-nav input[type="month"] {
    width: 100%;
    text-align: center;
    padding: 10px 6px;
    margin: 0;
  }
  .flow-month-btn {
    width: 48px !important;
    height: 48px;
    min-width: 48px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.25rem;
    line-height: 1;
  }
  .flow-books-toolbar > .flow-btn#btn-books-refresh {
    width: 100%;
  }
  .flow-month-label {
    margin-left: 0;
    text-align: center;
    font-size: 0.75rem;
    width: 100%;
  }
  .flow-books-grid { gap: 0.75rem; }
  .flow-books-row2 { grid-template-columns: 1fr; }

  /* Inventory */
  .flow-inventory-toolbar { gap: 8px; margin-bottom: 0.75rem; }
  .flow-inventory-toolbar .flow-btn { width: 100%; }
  .flow-inventory-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Leads — form first, compact */
  .flow-leads-layout { gap: 0.75rem; }

  /* Primary actions — scroll naturally, extra space above tab bar */
  .app-page .flow-btn-primary,
  .app-page .flow-btn-outline {
    margin-bottom: 0.5rem;
  }
  .app-page .flow-btn-primary:last-child,
  #btn-save-leadform,
  #btn-save-inventory,
  #btn-save-commerce,
  #btn-save-business,
  #btn-create-invoice,
  #btn-add-transaction {
    margin-bottom: 1.25rem;
  }

  .flow-connect-layout { gap: 10px; }
  .flow-qr-body { padding: 1.25rem 1rem; }
  .flow-qr-img-wrap img { max-width: min(240px, 70vw); height: auto; }
  .flow-info-card { padding: 12px 14px; }

  .flow-modal-bg { padding: 0; align-items: flex-end; }
  .flow-modal.premium-modal,
  .flow-pay-modal {
    max-width: none;
    width: 100%;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
    margin-bottom: 0;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .flow-auth-wrap { padding: 1.25rem 1rem; }
  .flow-auth-panel input { font-size: 16px; min-height: 48px; }
  .flow-auth-submit { min-height: 48px; width: 100%; }
}

@media (max-width: 380px) {
  .app-more-grid { grid-template-columns: repeat(2, 1fr); }
  .flow-books-stats .flow-stat-card,
  .flow-inventory-stats .flow-stat-card { flex: 0 0 56vw; }
}

/* ── Ops cockpit UI (fx) — dashboard, orders, bulk ── */
.fx-page {
  max-width: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.fx-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.fx-topbar--compact {
  padding-bottom: 0;
  border-bottom: none;
  margin-bottom: 14px;
}
.fx-topbar-main { min-width: 0; }
.fx-eyebrow {
  display: block;
  font-family: var(--flow-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--flow-w40);
  margin-bottom: 6px;
}
.fx-title {
  font-family: var(--flow-display);
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}
.fx-sub {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--flow-w40);
}
.fx-icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--flow-border);
  border-radius: 50%;
  background: var(--flow-w06);
  color: var(--flow-w60);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.fx-icon-btn:hover { border-color: var(--flow-border-hi); color: var(--flow-white); background: var(--flow-w12); }

.fx-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.fx-layout--fill { min-height: calc(100dvh - 160px); }
.fx-main {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}
.fx-rail { position: sticky; top: 16px; align-self: stretch; min-height: 0; }
.fx-rail--full {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.fx-rail--full .fx-rail-card {
  flex: 1;
  max-height: none;
  min-height: 0;
}

/* Roundish soft cards */
.fx-card, .fx-panel {
  background: oklch(0.16 0.014 255 / 0.92);
  border: 1px solid var(--flow-border);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset;
}
.fx-panel--rail { padding: 14px 16px; }
.fx-rail-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100dvh - 140px);
  padding: 14px 16px 16px;
}
.fx-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.fx-panel-title, .fx-rail-title {
  font-family: var(--flow-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.fx-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.fx-panel-meta {
  font-family: var(--flow-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--flow-w40);
}

.fx-wa-card { border-color: oklch(0.82 0.14 195 / 0.14); padding: 14px 16px; }
.fx-wa-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fx-wa-copy { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 2px; }
.fx-pulse { flex-shrink: 0; }
.fx-wa-label { font-size: 0.88rem; font-weight: 600; letter-spacing: -0.01em; }
.fx-wa-desc { font-size: 0.74rem; color: var(--flow-w40); line-height: 1.4; }
.fx-chip {
  font-family: var(--flow-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid var(--flow-border);
  border-radius: 999px;
  color: var(--flow-w60);
  flex-shrink: 0;
}
.fx-chip--live { border-color: oklch(0.72 0.17 145 / 0.35); color: var(--flow-green); background: oklch(0.72 0.17 145 / 0.08); }
.fx-chip--warn { border-color: oklch(0.82 0.14 95 / 0.3); color: var(--flow-yellow); background: oklch(0.82 0.14 95 / 0.06); }
.fx-wa-bar {
  height: 3px;
  margin: 10px 0 0;
  background: var(--flow-w06);
  border-radius: 999px;
  overflow: hidden;
  transition: opacity 0.3s;
}
.fx-wa-bar-fill {
  height: 100%;
  background: var(--flow-cyan);
  border-radius: 999px;
  transition: width 0.4s var(--flow-ease);
}
.fx-wa-steps {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.flow-wa-step {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: var(--flow-w06);
}
.flow-wa-step.done { background: oklch(0.82 0.14 195 / 0.35); }
.flow-wa-step.active { background: var(--flow-cyan); }
.fx-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--flow-border-hi);
  border-radius: 999px;
  background: var(--flow-cyan-dim);
  color: var(--flow-cyan);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.fx-cta:hover { background: oklch(0.82 0.14 195 / 0.18); border-color: var(--flow-cyan); transform: translateY(-1px); }
.fx-cta--inline { margin-left: auto; }

/* Bento stats — soft rounded cells, no hard grid lines */
.fx-bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.fx-stat {
  background: var(--flow-nested-surface);
  border: 1px solid oklch(1 0 0 / 0.05);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  transition: border-color 0.2s;
}
.fx-stat:hover { border-color: oklch(1 0 0 / 0.1); }
.fx-stat-num {
  display: block;
  font-family: var(--flow-mono);
  font-size: 1.1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--flow-white);
  letter-spacing: -0.02em;
}
.fx-stat-lbl {
  display: block;
  margin-top: 3px;
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  color: var(--flow-w40);
}

.fx-stats-card { padding-bottom: 12px; }
.fx-stats-card .fx-quick { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--flow-border); }

.fx-phase2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 0;
  align-items: stretch;
}
.fx-grow-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.fx-order-widget, .fx-schedule-widget {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  margin-top: 8px;
}
.fx-pipe-pills--inline {
  margin-bottom: 4px;
  padding-top: 0;
  border-top: none;
}
.fx-feed--fill {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.fx-ow-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--flow-nested-surface);
  border: 1px solid oklch(1 0 0 / 0.04);
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.fx-ow-row:hover { border-color: oklch(1 0 0 / 0.1); }
.fx-ow-row--schedule { grid-template-columns: 1fr auto; }
.fx-ow-main { min-width: 0; }
.fx-ow-main strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fx-ow-main span {
  display: block;
  font-size: 0.72rem;
  color: var(--flow-w40);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.fx-order-btn--sm {
  padding: 5px 10px;
  font-size: 0.62rem;
  white-space: nowrap;
}

.fx-reminder-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 12px 14px;
  border-radius: 14px;
  background: oklch(0.82 0.14 95 / 0.08);
  border: 1px solid oklch(0.82 0.14 95 / 0.2);
  font-size: 0.76rem;
  color: var(--flow-w60);
  line-height: 1.45;
}
.fx-reminder-banner strong { color: var(--flow-yellow); font-family: var(--flow-mono); }
.fx-reminder-banner span { color: var(--flow-w40); }
.fx-reminder-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--flow-yellow);
  flex-shrink: 0;
  margin-top: 5px;
  box-shadow: 0 0 8px oklch(0.82 0.14 95 / 0.4);
}
/* Quick nav — horizontal pills inside stats card */
.fx-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fx-quick-pill {
  padding: 8px 14px;
  border: 1px solid var(--flow-border);
  border-radius: 999px;
  background: var(--flow-subtle-bg);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--flow-w60);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.fx-quick-pill:hover {
  border-color: var(--flow-border-hi);
  color: var(--flow-white);
  background: var(--flow-w06);
}

/* Legacy metric grid (bulk/orders pages) */
.fx-metric-grid {
  display: grid;
  gap: 10px;
}
.fx-metric-grid--3 { grid-template-columns: repeat(3, 1fr); }
.fx-metric {
  background: var(--flow-nested-surface);
  border: 1px solid oklch(1 0 0 / 0.05);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
}
.fx-metric-num {
  display: block;
  font-family: var(--flow-mono);
  font-size: 1.1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--flow-white);
}
.fx-metric-lbl {
  display: block;
  margin-top: 3px;
  font-size: 0.65rem;
  color: var(--flow-w40);
}

.fx-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.fx-nav-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--flow-border);
  border-radius: 14px;
  background: var(--flow-bg);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--flow-w80);
  transition: border-color 0.2s, color 0.2s;
}
.fx-nav-tile:hover { border-color: var(--flow-border-hi); color: var(--flow-white); }
.fx-footnote {
  margin: 12px 0 0;
  font-size: 0.72rem;
  color: var(--flow-w40);
}

.fx-feed { display: flex; flex-direction: column; min-height: 0; }
.fx-feed--scroll {
  flex: 1;
  overflow-y: auto;
  max-height: 42vh;
  margin-bottom: 12px;
  padding-right: 2px;
}
.fx-feed-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px 4px;
  border-radius: 12px;
  transition: background 0.15s;
}
.fx-feed-row:hover { background: var(--flow-w06); }
.fx-tag {
  font-family: var(--flow-mono);
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 4px 6px;
  border-radius: 999px;
  text-align: center;
  border: 1px solid var(--flow-border);
  color: var(--flow-w40);
}
.fx-tag--sale { color: var(--flow-green); border-color: oklch(0.72 0.17 145 / 0.25); }
.fx-tag--lead { color: var(--flow-cyan); border-color: oklch(0.82 0.14 195 / 0.25); }
.fx-tag--message { color: var(--flow-w60); }
.fx-feed-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fx-feed-title { font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-feed-detail { font-size: 0.7rem; color: var(--flow-w40); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-feed-time { font-family: var(--flow-mono); font-size: 0.6rem; color: var(--flow-w25); padding-top: 2px; }
.fx-empty { padding: 16px 8px; margin: 0; font-size: 0.78rem; color: var(--flow-w40); text-align: center; }

.fx-pipe-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--flow-border);
}
.fx-pipe-pill {
  text-align: center;
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--flow-nested-surface);
  border: 1px solid oklch(1 0 0 / 0.05);
}
.fx-pipe-pill-num {
  display: block;
  font-family: var(--flow-mono);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.1;
}
.fx-pipe-pill-lbl {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--flow-w40);
}
.fx-pipe-pill--warn .fx-pipe-pill-num { color: var(--flow-yellow); }
.fx-pipe-pill--ok .fx-pipe-pill-num { color: var(--flow-green); }
.fx-pipe-pill--info .fx-pipe-pill-num { color: oklch(0.78 0.08 250); }
.fx-pipe-pill--live .fx-pipe-pill-num { color: var(--flow-cyan); }

.fx-link-btn {
  border: none;
  background: none;
  color: var(--flow-cyan);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.fx-link-btn--sm { font-size: 0.72rem; opacity: 0.9; }
.fx-link-btn:hover { text-decoration: underline; }

.fx-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--flow-border);
  border-radius: 16px;
  background: var(--flow-muted-surface);
}
.fx-seg-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--flow-w40);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.fx-seg-btn:hover { color: var(--flow-w80); }
.fx-seg-btn.active { background: var(--flow-card); color: var(--flow-white); box-shadow: 0 0 0 1px var(--flow-border); }

.fx-order-board {
  border: 1px solid var(--flow-border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--flow-card);
}
.fx-order-headrow {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.8fr 0.9fr 1fr;
  gap: 10px;
  padding: 10px 14px;
  font-family: var(--flow-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--flow-w40);
  border-bottom: 1px solid var(--flow-border);
  background: var(--flow-bg);
}
.fx-order-row {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.8fr 0.9fr 1fr;
  gap: 10px;
  padding: 12px 14px;
  align-items: center;
  border-bottom: 1px solid var(--flow-border);
  font-size: 0.8rem;
}
.fx-order-row:last-child { border-bottom: none; }
.fx-order-row:hover { background: var(--flow-w06); }
.fx-order-cell { min-width: 0; }
.fx-order-cell--name strong { display: block; font-weight: 600; }
.fx-order-cell--name span { display: block; font-family: var(--flow-mono); font-size: 0.68rem; color: var(--flow-w40); margin-top: 2px; }
.fx-order-cell--amt { font-family: var(--flow-mono); font-weight: 500; }
.fx-order-cell--act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fx-status {
  display: inline-block;
  font-family: var(--flow-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid var(--flow-border);
}
.fx-status--awaiting { color: var(--flow-yellow); border-color: oklch(0.82 0.14 95 / 0.25); }
.fx-status--paid { color: var(--flow-green); border-color: oklch(0.72 0.17 145 / 0.25); }
.fx-status--packed { color: oklch(0.78 0.08 250); border-color: oklch(0.7 0.1 250 / 0.25); }
.fx-status--shipped { color: var(--flow-cyan); border-color: oklch(0.82 0.14 195 / 0.25); }
.fx-status--cancelled { color: var(--flow-red); border-color: oklch(0.62 0.2 25 / 0.25); }
.fx-order-btn {
  padding: 6px 12px;
  border: 1px solid var(--flow-border);
  border-radius: 999px;
  background: var(--flow-w06);
  color: var(--flow-cyan);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.fx-order-btn:hover { border-color: var(--flow-cyan); background: var(--flow-cyan-dim); }

.fx-queue { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.fx-queue-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--flow-border);
  border-radius: 16px;
  background: var(--flow-nested-surface);
}
.fx-queue-main strong { display: block; font-size: 0.82rem; font-weight: 600; }
.fx-queue-main span { font-size: 0.72rem; color: var(--flow-w40); }
.fx-queue-status {
  font-family: var(--flow-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--flow-border);
}
.fx-queue-status--pending { color: var(--flow-yellow); }
.fx-queue-status--done { color: var(--flow-green); }
.fx-queue-status--running { color: var(--flow-cyan); }
.fx-queue-status--error { color: var(--flow-red); }
.fx-queue-cancel {
  border: none; background: none;
  font-size: 0.68rem; color: var(--flow-w40);
  text-decoration: underline; cursor: pointer;
}
.fx-bulk-progress .flow-bulk-stats { margin-bottom: 12px; }
.fx-bulk-progress .flow-bulk-stat-num { font-family: var(--flow-mono); }

/* Connect page legacy cells */
.flow-ios-info-cell {
  padding: 14px 16px;
  border-bottom: 0.5px solid oklch(1 0 0 / 0.07);
}
.flow-ios-info-cell:last-child { border-bottom: none; }
.flow-ios-info-cell h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--flow-white);
}
.flow-ios-info-cell p {
  font-size: 0.8rem;
  color: var(--flow-w40);
  line-height: 1.55;
  margin: 0;
}
.flow-ios-group {
  background: var(--flow-bg2);
  border: 1px solid var(--flow-border);
  border-radius: 10px;
  overflow: hidden;
}
.flow-wa-status-detail {
  margin: 0 18px 12px;
  font-size: 0.78rem;
  color: var(--flow-w40);
  line-height: 1.45;
}
.flow-wa-progress--connect {
  height: 3px;
  margin: 0 18px 14px;
  background: var(--flow-w06);
}
.flow-wa-progress-fill {
  height: 100%;
  background: var(--flow-cyan);
  transition: width 0.4s var(--flow-ease);
}
.flow-auth-link-btn {
  background: none; border: none; color: var(--flow-cyan);
  font-size: 0.82rem; cursor: pointer; padding: 0;
}
.flow-chat-pause-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--flow-border);
  background: transparent; color: var(--flow-w60);
  font-size: 0.72rem; cursor: pointer;
}
.flow-chat-pause-btn.paused {
  border-color: oklch(0.82 0.14 95 / 0.25);
  color: oklch(0.85 0.12 95);
  background: oklch(0.82 0.14 95 / 0.06);
}
.flow-inv-wa {
  border: none; background: oklch(1 0 0 / 0.06);
  color: var(--flow-cyan); padding: 4px 8px;
  border-radius: 6px; font-size: 0.72rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 5.5rem; position: relative; overflow: hidden;
}
.flow-inv-wa:disabled { cursor: wait; opacity: 0.92; }
.flow-inv-wa--sending { color: oklch(0.88 0.06 220); }
.flow-inv-wa--sent {
  color: oklch(0.78 0.14 145);
  background: oklch(0.78 0.14 145 / 0.12);
}
.flow-inv-wa-progress {
  flex: 0 0 2.75rem; height: 3px; border-radius: 2px;
  background: oklch(1 0 0 / 0.12); overflow: hidden;
}
.flow-inv-wa-bar {
  display: block; height: 100%; width: 35%;
  border-radius: inherit; background: var(--flow-cyan);
  animation: flow-inv-wa-indeterminate 1.1s ease-in-out infinite;
}
@keyframes flow-inv-wa-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.flow-inv-wa-lbl { white-space: nowrap; }

@media (max-width: 1100px) {
  .fx-layout, .fx-layout--fill { grid-template-columns: 1fr; min-height: auto; }
  .fx-rail--full { grid-row: auto; }
  .fx-rail { position: static; }
  .fx-rail-card { max-height: 360px; }
  .fx-feed--fill { max-height: 320px; }
  .fx-phase2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .fx-bento { grid-template-columns: repeat(2, 1fr); }
  .fx-pipe-pills { grid-template-columns: repeat(2, 1fr); }
  .fx-wa-row .fx-cta--inline { width: 100%; margin-left: 0; justify-content: center; margin-top: 6px; }
  .fx-order-headrow { display: none; }
  .fx-order-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px;
  }
  .fx-order-cell--act { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .fx-bento { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .fx-card, .fx-panel { border-radius: 18px; padding: 14px; }
}

/* ── Home dashboard (hd) — command center ── */
#page-home.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.hd-dashboard {
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 14px;
  flex: 1;
  min-height: 0;
  max-width: 1380px;
  width: 100%;
  padding-bottom: 8px;
}
.hd-wa-strip {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 14px 16px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--hd-surface);
  border: 1px solid var(--hd-surface-border);
  box-shadow: var(--hd-surface-shadow);
}
.hd-wa-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: #eff6ff;
  color: #2563eb;
  border: none;
}
.hd-wa-icon--live { background: #ecfdf5; color: #059669; }
.hd-wa-icon--scan { background: #eff6ff; color: #2563eb; }
.hd-wa-icon--off { background: #f3f4f6; color: #9ca3af; }
.hd-wa-icon i { width: 22px; height: 22px; }
.hd-wa-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hd-wa-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hd-wa-title { font-size: 0.95rem; font-weight: 700; color: var(--hd-text-primary); }
.hd-wa-desc { font-size: 0.76rem; color: var(--hd-text-secondary); }
.hd-wa-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hd-wa-stepper {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding-top: 4px;
}
.hd-wa-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 88px;
}
.hd-wa-step-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  background: #f3f4f6; color: #9ca3af;
  border: 2px solid #e5e7eb;
}
.hd-wa-step-item.done .hd-wa-step-num,
.hd-wa-step-item.active .hd-wa-step-num {
  background: #2563eb; color: #fff; border-color: #2563eb;
}
.hd-wa-step-lbl {
  font-size: 0.62rem; color: #9ca3af; text-align: center; line-height: 1.2;
  max-width: 90px;
}
.hd-wa-step-item.active .hd-wa-step-lbl,
.hd-wa-step-item.done .hd-wa-step-lbl { color: #374151; font-weight: 500; }
.hd-wa-step-line {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin-top: 13px;
  min-width: 24px;
}
.hd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.hd-btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.hd-btn--primary:hover { background: #1d4ed8; }
.hd-btn--outline {
  background: #fff;
  border-color: #d1d5db;
  color: #374151;
}
.hd-btn--outline:hover { background: #f9fafb; }
.hd-btn--ghost {
  width: 36px; height: 36px; padding: 0;
  border-radius: 10px;
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}
.hd-btn--ghost:hover { background: #e5e7eb; color: #374151; }

.hd-head {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.hd-title {
  font-family: var(--flow-display);
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.05;
  color: var(--hd-text-primary);
}
.hd-sub { margin: 5px 0 0; font-size: 0.78rem; color: var(--hd-text-muted); }
.hd-phase2-badges { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.hd-p2-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.74rem; font-weight: 500;
  padding: 2px 10px;
  color: #6b7280;
  background: none; border: none;
}
.hd-phase2-badges .hd-p2-badge + .hd-p2-badge { border-left: 1px solid #e5e7eb; }
.hd-phase2-badges .hd-p2-badge:first-child { padding-left: 0; }
.hd-p2-badge--warn { color: #ea580c; }
.hd-p2-badge--warn::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #f97316; flex-shrink: 0;
}
.hd-p2-badge--ok { color: #059669; }
.hd-p2-badge--ok::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #10b981; flex-shrink: 0;
}
.hd-p2-badge--remind {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  margin-left: 6px;
}

.hd-kpi-ribbon {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.hd-kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--hd-surface);
  border: 1px solid var(--hd-surface-border);
  box-shadow: var(--hd-surface-shadow);
}
.hd-kpi-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hd-kpi-icon i { width: 18px; height: 18px; }
.hd-kpi-icon--msgs { background: #eff6ff; color: #3b82f6; }
.hd-kpi-icon--chats { background: #ecfdf5; color: #10b981; }
.hd-kpi-icon--leads { background: #f3f4f6; color: #6b7280; }
.hd-kpi-icon--revenue { background: #ecfdf5; color: #059669; }
.hd-kpi-icon--income { background: #f5f3ff; color: #7c3aed; }
.hd-kpi-icon--stock { background: #f3f4f6; color: #374151; }
.hd-kpi > div { min-width: 0; }
.hd-kpi-num {
  display: block;
  font-family: var(--flow-display);
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--hd-text-primary);
  line-height: 1.1;
}
.hd-kpi-lbl { display: block; margin-top: 2px; font-size: 0.68rem; color: var(--hd-text-muted); }

.hd-kanban-wrap {
  grid-column: 1;
  grid-row: 4;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--hd-surface);
  border: 1px solid var(--hd-surface-border);
  box-shadow: var(--hd-surface-shadow);
}
.hd-kanban-wrap .hd-section-head h2 {
  color: var(--hd-kb-title);
}
.hd-kanban-wrap .hd-link {
  color: var(--hd-kb-link);
}
.hd-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.hd-section-head h2 {
  font-family: var(--flow-display);
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
}
.hd-link {
  border: none;
  background: none;
  color: var(--hd-kb-link);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.hd-link:hover { text-decoration: underline; }

.hd-kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}
.hd-kanban--page {
  min-height: calc(100dvh - 220px);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.hd-kanban-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  padding: 0 12px;
}
.hd-kanban-col:first-child { padding-left: 0; }
.hd-kanban-col:last-child { padding-right: 0; }
.hd-kanban-col:not(:last-child) {
  position: relative;
}
.hd-kanban-col:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 72px;
  background: var(--hd-kb-col-sep);
  border-radius: 1px;
  pointer-events: none;
}
.hd-kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--hd-kb-col-head-text);
  border-bottom: none;
  background: transparent;
}
.hd-kanban-col-head em {
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--hd-kb-col-count-text);
  background: var(--hd-kb-col-count-bg);
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
.hd-kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.hd-kanban-col-body:hover {
  scrollbar-color: var(--flow-scroll-thumb) transparent;
}
.hd-kanban-col-body::-webkit-scrollbar {
  width: 3px;
}
.hd-kanban-col-body::-webkit-scrollbar-track {
  background: transparent;
}
.hd-kanban-col-body::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
.hd-kanban-col-body:hover::-webkit-scrollbar-thumb {
  background: var(--flow-scroll-thumb);
}
.hd-kanban-col-body:hover::-webkit-scrollbar-thumb:hover {
  background: var(--flow-scroll-thumb-hover);
}
.hd-kanban-card {
  padding: 10px 11px;
  border-radius: 12px;
  background: var(--hd-kb-card-bg);
  border: 1px solid var(--hd-kb-card-border);
  box-shadow: var(--hd-kb-card-shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.hd-kanban-card:hover {
  border-color: oklch(1 0 0 / 0.12);
}
.hd-kanban-card-top { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.hd-kanban-card-top strong { font-size: 0.78rem; font-weight: 700; line-height: 1.3; color: var(--hd-kb-name); }
.hd-kanban-product { display: block; font-size: 0.68rem; color: var(--hd-kb-muted); margin-top: 2px; }
.hd-kanban-amt { display: block; font-size: 0.72rem; font-weight: 600; margin-top: 3px; color: var(--hd-kb-amt); }
.hd-kanban-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.hd-kanban-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.12s, filter 0.12s;
}
.hd-kanban-actions .hd-kanban-btn { margin-top: 0; }
.hd-kanban-btn:hover { opacity: 0.85; filter: brightness(0.97); }
.hd-kanban-btn--advance { color: var(--hd-kb-btn-advance-fg); background: var(--hd-kb-btn-advance-bg); }
.hd-kanban-btn--cancel { color: var(--hd-kb-btn-cancel-fg); background: var(--hd-kb-btn-cancel-bg); }
.hd-kanban-btn--remind { color: var(--hd-kb-btn-remind-fg); background: var(--hd-kb-btn-remind-bg); }
.hd-kanban-remind { font-size: 0.58rem; font-weight: 600; color: var(--hd-kb-remind-tag); white-space: nowrap; }
.hd-kanban-empty { font-size: 0.72rem; color: var(--hd-kb-empty); text-align: center; padding: 12px 0; margin: 0; }

.hd-side {
  grid-column: 2;
  grid-row: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.hd-card {
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--hd-surface);
  border: 1px solid var(--hd-surface-border);
  box-shadow: var(--hd-surface-shadow);
}
.hd-card--alert {
  background: var(--hd-alert-bg);
  border-color: var(--hd-alert-border);
}
.hd-card--bulk {
  background: var(--hd-bulk-bg);
  border-color: var(--hd-bulk-border);
}
.hd-feed {
  flex: 1; overflow-y: auto; min-height: 0;
  position: relative;
  padding-left: 4px;
}
.hd-feed::before {
  content: '';
  position: absolute;
  left: 19px; top: 20px; bottom: 12px;
  width: 1px;
  background: #e5e7eb;
}
.hd-feed-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  padding: 8px 4px;
  border-radius: 10px;
  align-items: start;
  position: relative;
}
.hd-feed-row:hover { background: rgba(0,0,0,0.02); }
.hd-feed-av {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.58rem; font-weight: 700; color: #fff;
  flex-shrink: 0; letter-spacing: 0;
  position: relative; z-index: 1;
  border: 2px solid var(--hd-surface);
}
.hd-feed-copy { min-width: 0; }
.hd-feed-name-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 1px; min-width: 0;
}
.hd-card--grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hd-feed-title { font-size: 0.76rem; font-weight: 700; color: var(--hd-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-feed-detail { display: block; font-size: 0.67rem; color: var(--hd-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-feed-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.hd-feed-meta time { font-size: 0.58rem; color: var(--hd-text-muted); white-space: nowrap; }
.hd-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hd-accent); flex-shrink: 0; }
.hd-tag {
  font-size: 0.5rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.hd-tag--sale { color: #059669; background: #ecfdf5; border: none; }
.hd-tag--lead { color: #2563eb; background: #eff6ff; border: none; }
.hd-tag--paid { color: #059669; background: #d1fae5; border: none; }
.hd-empty { padding: 8px 0; margin: 0; font-size: 0.72rem; color: var(--hd-text-muted); text-align: left; }

.hd-reminder { display: flex; gap: 12px; align-items: flex-start; }
.hd-reminder-bell {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fef3c7; color: #d97706;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hd-reminder-body { flex: 1; min-width: 0; }
.hd-reminder strong { display: block; font-size: 0.82rem; font-weight: 700; color: var(--hd-text-primary); }
.hd-reminder p { margin: 4px 0 0; font-size: 0.68rem; color: var(--hd-text-secondary); line-height: 1.45; }
.hd-reminder-sub { font-size: 0.65rem !important; color: var(--hd-text-muted) !important; }
.hd-bulk-row { display: flex; align-items: flex-start; gap: 12px; }
.hd-bulk-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: #f3e8ff; color: #7c3aed;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hd-bulk-copy { flex: 1; min-width: 0; }
.hd-bulk-copy strong { display: block; font-size: 0.82rem; font-weight: 700; color: var(--hd-text-primary); margin-bottom: 4px; }
.hd-bulk-copy .hd-empty { text-align: left; padding: 0; }
.hd-kanban-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 28px 0;
  color: var(--hd-kb-empty); font-size: 0.7rem;
  flex: 1;
}
.hd-kanban-empty-state i { opacity: 0.45; color: var(--hd-kb-empty); }
.hd-card-icon { display: inline-block; vertical-align: middle; margin-right: 4px; color: var(--flow-w40); }

.hd-schedule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 14px;
  background: var(--flow-nested-surface);
  border: 1px solid oklch(1 0 0 / 0.04);
  margin-bottom: 8px;
}
.hd-schedule-row strong { display: block; font-size: 0.78rem; }
.hd-schedule-row span { display: block; font-size: 0.68rem; color: var(--flow-w40); margin-top: 2px; }
.hd-schedule-cancel {
  border: none; background: none;
  font-size: 0.68rem; color: var(--flow-w40);
  text-decoration: underline; cursor: pointer; flex-shrink: 0;
}

.hd-dock {
  grid-column: 1 / -1;
  grid-row: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--hd-surface);
  border: 1px solid var(--hd-surface-border);
  box-shadow: var(--hd-surface-shadow);
  justify-content: center;
  max-width: 540px;
  margin: 4px auto 0;
  width: fit-content;
  justify-self: center;
}
.hd-dock-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 16px;
  border-radius: 12px;
  border: none;
  background: transparent;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--hd-text-muted);
  cursor: pointer;
  transition: color 0.15s;
  position: relative;
}
.hd-dock-btn svg { width: 16px; height: 16px; }
.hd-dock-btn:hover { color: var(--hd-text-primary); }
.hd-dock-btn.active { color: var(--hd-accent); }
.hd-dock-btn.active::after {
  content: '';
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 18px; height: 2px; border-radius: 2px;
  background: var(--hd-accent);
}

.hd-orders-page { max-width: 1400px; }
.hd-orders-page .hd-head { margin-bottom: 12px; }

@media (max-width: 1100px) {
  .hd-dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: auto;
  }
  .hd-kanban-wrap { grid-column: 1; grid-row: auto; }
  .hd-side { grid-column: 1; grid-row: auto; }
  .hd-kanban { min-height: 280px; }
  .hd-kpi-ribbon { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .hd-kpi-ribbon { grid-template-columns: repeat(2, 1fr); }
  .hd-kanban { grid-template-columns: repeat(2, 1fr); }
  .hd-wa-right { width: 100%; justify-content: flex-start; }
  .hd-head { flex-direction: column; align-items: flex-start; }
  .app-user-name { display: none; }
}

/* ══ Light mode ══════════════════════════════════════════════════════════════ */
/* NOTE: prefixed with html[...] (not bare [data-theme]) so specificity always
   beats landing-premium.css's ".flow-app .xxx" rules, which load after this
   file and would otherwise win ties and keep things dark. */
html[data-theme="light"] {
  --flow-bg: #eef0f7;
  --flow-bg2: #e4e7f2;
  --flow-bg3: #d8dcee;
  --flow-surface: rgba(255,255,255,0.92);
  --flow-card: rgba(255,255,255,0.97);
  --flow-white: #0c0c18;
  --flow-w80: rgba(12,12,24,0.82);
  --flow-w60: rgba(12,12,24,0.6);
  --flow-w40: rgba(12,12,24,0.42);
  --flow-w25: rgba(12,12,24,0.22);
  --flow-w12: rgba(12,12,24,0.09);
  --flow-w06: rgba(12,12,24,0.04);
  --flow-border: rgba(12,12,24,0.1);
  --flow-border-hi: oklch(0.45 0.14 195 / 0.4);
  --flow-scroll-thumb: rgba(0,0,0,0.18);
  --flow-scroll-thumb-hover: rgba(0,0,0,0.28);
  --flow-shadow: 0 8px 40px rgba(0,0,40,0.12);
  --flow-glow: 0 0 60px oklch(0.55 0.14 195 / 0.06);
  --flow-cyan-dim: oklch(0.55 0.14 195 / 0.1);
  /* Form & inset surfaces (light) */
  --flow-input-bg: #ffffff;
  --flow-inset-bg: #f4f6fb;
  --flow-bar-bg: #ffffff;
  --flow-subtle-bg: #f3f5fa;
  --flow-bubble-in-bg: #eef1f8;
  --flow-preview-bg: #f8f9fc;
  --flow-muted-surface: #f3f5fa;
  --flow-nested-surface: #f8f9fc;
  color-scheme: light;
  --hd-kb-col-shadow: 0 2px 10px rgba(12,12,24,0.06);
  --hd-surface: #fff;
  --hd-surface-border: rgba(12,12,24,0.08);
  --hd-surface-shadow: 0 1px 3px rgba(12,12,24,0.04);
  --hd-text-primary: #111827;
  --hd-text-secondary: #6b7280;
  --hd-text-muted: #9ca3af;
  --hd-accent: #2563eb;
  --hd-alert-bg: #fffbeb;
  --hd-alert-border: #fde68a;
  --hd-bulk-bg: #faf5ff;
  --hd-bulk-border: #e9d5ff;
  /* Order pipeline kanban (light) */
  --hd-kb-wrap-bg: transparent;
  --hd-kb-wrap-border: transparent;
  --hd-kb-wrap-shadow: none;
  --hd-kb-title: #111827;
  --hd-kb-link: #2563eb;
  --hd-kb-col-bg: transparent;
  --hd-kb-col-border: transparent;
  --hd-kb-col-shadow: none;
  --hd-kb-col-head-bg: transparent;
  --hd-kb-col-head-text: #374151;
  --hd-kb-col-count-bg: #f3f4f6;
  --hd-kb-col-count-text: #6b7280;
  --hd-kb-col-divider: transparent;
  --hd-kb-col-sep: rgba(12, 12, 24, 0.08);
  --hd-kb-card-bg: #fff;
  --hd-kb-card-border: #f3f4f6;
  --hd-kb-card-shadow: 0 1px 2px rgba(12,12,24,0.03);
  --hd-kb-name: #111827;
  --hd-kb-muted: #9ca3af;
  --hd-kb-amt: #374151;
  --hd-kb-btn-advance-fg: #059669;
  --hd-kb-btn-advance-bg: #ecfdf5;
  --hd-kb-btn-cancel-fg: #2563eb;
  --hd-kb-btn-cancel-bg: #eff6ff;
  --hd-kb-btn-remind-fg: #d97706;
  --hd-kb-btn-remind-bg: #fffbeb;
  --hd-kb-remind-tag: #f97316;
  --hd-kb-empty: #9ca3af;
}
html[data-theme="light"] body {
  background: var(--flow-bg);
  color: var(--flow-white);
}
/* landing-premium.css's ".flow-app" rule sets a hardcoded dark bg/text on
   body — neutralize it explicitly since it shares the .flow-app class. */
html[data-theme="light"] body.flow-app {
  background: var(--flow-bg);
  color: var(--flow-white);
}
html[data-theme="light"] .app-topbar {
  background: rgba(255,255,255,0.9);
  border-bottom-color: var(--flow-border);
}
html[data-theme="light"] .app-topbar-logo span { color: oklch(0.5 0.14 195); }
html[data-theme="light"] .app-sidebar {
  background: rgba(255,255,255,0.8);
  border-right-color: var(--flow-border);
}
html[data-theme="light"] .app-nav-item.active {
  background: oklch(0.55 0.14 195 / 0.12);
  border-color: oklch(0.55 0.14 195 / 0.22);
  color: oklch(0.4 0.14 195);
}
html[data-theme="light"] .app-nav-item:hover:not(.active) {
  background: rgba(0,0,0,0.045);
}
html[data-theme="light"] .app-nav-label { color: var(--flow-w40); }
html[data-theme="light"] .app-sidebar-footer a { color: var(--flow-w40); }
html[data-theme="light"] .app-user-name { color: var(--flow-w80); }

/* Auth / connect / bulk / other pages that share .flow-app dark overrides */
html[data-theme="light"] .flow-auth-brand {
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, oklch(0.55 0.14 195 / 0.08), transparent 55%),
    linear-gradient(160deg, #eef0f7, #e4e7f2);
  border-right-color: var(--flow-border);
}
html[data-theme="light"] .flow-auth-brand h1,
html[data-theme="light"] .flow-auth-brand .flow-logo { color: var(--flow-white); }
html[data-theme="light"] .flow-auth-brand h1 em { color: oklch(0.5 0.14 195); }
html[data-theme="light"] .flow-auth-panel-wrap { background: var(--flow-bg); }
html[data-theme="light"] .app-page-title,
html[data-theme="light"] .hd-title,
html[data-theme="light"] .hd-section-head h2 { color: var(--flow-white); }
html[data-theme="light"] .app-page-desc { color: var(--flow-w60); }
html[data-theme="light"] .app-card,
html[data-theme="light"] .premium-card,
html[data-theme="light"] .flow-qr-card,
html[data-theme="light"] .flow-inbox-list,
html[data-theme="light"] .flow-chat-panel,
html[data-theme="light"] .flow-info-card,
html[data-theme="light"] .flow-connect-info,
html[data-theme="light"] .fx-panel,
html[data-theme="light"] .fx-card,
html[data-theme="light"] .flow-ios-group {
  background: rgba(255,255,255,0.9);
  border-color: var(--flow-border);
}
html[data-theme="light"] .flow-modal.premium-modal {
  background: #ffffff;
  border-color: var(--flow-border);
}

/* Command-center dashboard */
html[data-theme="light"] .hd-wa-strip {
  background: var(--hd-surface);
  border-color: var(--hd-surface-border);
}
html[data-theme="light"] .hd-wa-icon--off { background: rgba(0,0,20,0.05); }
html[data-theme="light"] .hd-kpi {
  background: var(--hd-surface);
  border-color: var(--hd-surface-border);
}
html[data-theme="light"] .hd-kpi-num { color: var(--hd-text-primary); }
html[data-theme="light"] .hd-kanban-card:hover { box-shadow: 0 2px 12px rgba(0,0,40,0.08); }
html[data-theme="light"] .hd-side .hd-card {
  background: var(--hd-surface);
  border-color: var(--hd-surface-border);
}
html[data-theme="light"] .hd-dock {
  background: var(--hd-surface);
  border-color: var(--hd-surface-border);
}
html[data-theme="light"] .hd-dock-btn:hover {
  background: rgba(0,0,20,0.05);
  color: var(--flow-white);
}
html[data-theme="light"] .hd-schedule-row {
  background: rgba(0,0,20,0.03);
  border-color: rgba(0,0,20,0.07);
}
html[data-theme="light"] .app-user-avatar {
  background: rgba(0,0,20,0.07);
  border-color: var(--flow-border);
}
html[data-theme="light"] .app-user-avatar:hover { background: rgba(0,0,20,0.1); }
html[data-theme="light"] .app-user-dropdown {
  background: rgba(255,255,255,0.99);
  border-color: var(--flow-border);
  box-shadow: 0 8px 32px rgba(0,0,40,0.14);
}
html[data-theme="light"] .hd-feed-row:hover { background: rgba(0,0,20,0.04); }
html[data-theme="light"] .hd-btn--ghost {
  background: rgba(0,0,20,0.06);
  color: rgba(12,12,24,0.6);
}
html[data-theme="light"] .hd-btn--ghost:hover { color: var(--flow-white); }
html[data-theme="light"] .hd-btn--primary {
  background: oklch(0.55 0.14 195 / 0.12);
  border-color: oklch(0.55 0.14 195 / 0.3);
  color: oklch(0.42 0.14 195);
}
html[data-theme="light"] .hd-chip { color: var(--flow-w60); border-color: var(--flow-border); }
/* KPI icons keep pastel colors in both themes */
html[data-theme="light"] .hd-wa-bar { background: rgba(0,0,20,0.08); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--flow-scroll-thumb); }
html[data-theme="light"] .app-main {
  background: #eef0f7;
}
html[data-theme="light"] #page-home {
  background: transparent;
}
/* Dark dashboard — ensure page bg shows through floating kanban */
html[data-theme="dark"] .app-main,
:root:not([data-theme="light"]) .app-main {
  background: var(--flow-bg);
}
html[data-theme="dark"] .hd-wa-step-num,
:root:not([data-theme="light"]) .hd-wa-step-num {
  background: oklch(1 0 0 / 0.06);
  color: var(--flow-w40);
  border-color: oklch(1 0 0 / 0.1);
}
html[data-theme="dark"] .hd-wa-step-item.active .hd-wa-step-num,
html[data-theme="dark"] .hd-wa-step-item.done .hd-wa-step-num,
:root:not([data-theme="light"]) .hd-wa-step-item.active .hd-wa-step-num,
:root:not([data-theme="light"]) .hd-wa-step-item.done .hd-wa-step-num {
  background: var(--hd-accent);
  color: #fff;
  border-color: var(--hd-accent);
}
html[data-theme="dark"] .hd-wa-step-lbl,
:root:not([data-theme="light"]) .hd-wa-step-lbl { color: var(--flow-w40); }
html[data-theme="dark"] .hd-wa-step-item.active .hd-wa-step-lbl,
html[data-theme="dark"] .hd-wa-step-item.done .hd-wa-step-lbl,
:root:not([data-theme="light"]) .hd-wa-step-item.active .hd-wa-step-lbl,
:root:not([data-theme="light"]) .hd-wa-step-item.done .hd-wa-step-lbl {
  color: var(--flow-w80);
}
html[data-theme="dark"] .hd-wa-step-line,
:root:not([data-theme="light"]) .hd-wa-step-line { background: oklch(1 0 0 / 0.08); }
html[data-theme="dark"] .hd-kpi-icon--msgs,
:root:not([data-theme="light"]) .hd-kpi-icon--msgs { background: oklch(0.55 0.12 255 / 0.18); color: oklch(0.72 0.12 255); }
html[data-theme="dark"] .hd-kpi-icon--chats,
:root:not([data-theme="light"]) .hd-kpi-icon--chats { background: oklch(0.72 0.17 145 / 0.14); color: oklch(0.72 0.17 145); }
html[data-theme="dark"] .hd-kpi-icon--leads,
:root:not([data-theme="light"]) .hd-kpi-icon--leads { background: oklch(1 0 0 / 0.06); color: var(--flow-w40); }
html[data-theme="dark"] .hd-kpi-icon--revenue,
:root:not([data-theme="light"]) .hd-kpi-icon--revenue { background: oklch(0.72 0.17 145 / 0.14); color: oklch(0.72 0.17 145); }
html[data-theme="dark"] .hd-kpi-icon--income,
:root:not([data-theme="light"]) .hd-kpi-icon--income { background: oklch(0.55 0.15 305 / 0.18); color: oklch(0.72 0.12 305); }
html[data-theme="dark"] .hd-kpi-icon--stock,
:root:not([data-theme="light"]) .hd-kpi-icon--stock { background: oklch(1 0 0 / 0.06); color: var(--flow-w60); }

/* Light mode — form controls, chat chrome, nested surfaces */
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: rgba(12, 12, 24, 0.38);
}
html[data-theme="light"] .flow-inbox-refresh-btn:hover {
  background: var(--flow-cyan-dim);
  color: oklch(0.42 0.14 195);
}
html[data-theme="light"] .flow-chat-send {
  border-top-color: var(--flow-border);
}
html[data-theme="light"] .flow-btn-primary {
  background: oklch(0.55 0.14 195);
  color: #fff;
}
html[data-theme="light"] .flow-btn-primary:hover {
  background: oklch(0.5 0.14 195);
  box-shadow: 0 4px 16px oklch(0.55 0.14 195 / 0.22);
}
html[data-theme="light"] .flow-btn-outline {
  background: #fff;
  color: var(--flow-w80);
}
html[data-theme="light"] .flow-btn-outline:hover {
  background: var(--flow-cyan-dim);
  color: oklch(0.42 0.14 195);
}
html[data-theme="light"] .fx-stat,
html[data-theme="light"] .fx-metric,
html[data-theme="light"] .fx-ow-row {
  border-color: var(--flow-border);
}
html[data-theme="light"] .fx-stat:hover,
html[data-theme="light"] .fx-ow-row:hover {
  border-color: var(--flow-border-hi);
}
html[data-theme="light"] .inv-theme-swatch {
  border-color: var(--flow-border);
}
html[data-theme="light"] .inv-theme-swatch:hover {
  border-color: rgba(12, 12, 24, 0.18);
}
html[data-theme="light"] select,
html[data-theme="light"] input[type="date"],
html[data-theme="light"] input[type="month"],
html[data-theme="light"] input[type="datetime-local"] {
  background: var(--flow-input-bg);
  color: var(--flow-white);
}
@media (max-width: 900px) {
  html[data-theme="light"] .app-mobile-nav {
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -2px 16px rgba(0, 0, 40, 0.08);
  }
  html[data-theme="light"] .app-more-panel {
    background: rgba(255, 255, 255, 0.99);
  }
}
