/* Native hidden can otherwise lose to author-level display declarations. */
[hidden] { display: none !important; }

/* Design foundation: definitive tokens and global element defaults. */
:root {
  /* Color roles. */
  --bg: #ffffff;
  --ink: #0d0d0d;
  --muted: #6e6e80;
  --panel: #fff;
  --panel-strong: #fff;
  --dark: #0d0d0d;
  --line: #e5e5e5;
  --green: #10a37f;
  --green-dark: #0d8f70;
  --blue: #10a37f;
  --purple: #8b5cf6;
  --orange: #f59e0b;
  --color-surface-subtle: #f9f9f9;
  --color-surface-hover: #f2f2f2;
  --color-surface-selected: #ececec;
  --color-accent: #10a37f;
  --color-accent-hover: #0d8f70;
  --color-accent-soft: #e7f7f2;
  --color-accent-border: #a9dfd1;
  --color-text-on-accent: #fff;
  --color-text-secondary: #5d5d5d;
  --color-control-border: #d9d9d9;
  --color-danger: #b42318;
  --color-danger-soft: rgba(180, 35, 24, .08);
  --color-danger-border: rgba(180, 35, 24, .28);
  --color-success: #08783d;
  --color-warning: #a15c00;
  --color-disabled-text: #5f6368;
  --color-disabled-surface: #e8eaed;
  --focus-ring-color: #10a37f;
  --focus-ring-offset: 2px;
  --focus-ring: 0 0 0 3px var(--focus-ring-color);
  --color-overlay: rgba(32, 33, 36, .48);
  --color-transparent: transparent;

  /* Elevation, borders and shape. */
  --shadow: 0 1px 2px rgba(32, 33, 36, .06);
  --color-bg: var(--bg);
  --color-ink: var(--ink);
  --color-muted: var(--muted);
  --color-surface: var(--panel);
  --color-surface-strong: var(--panel-strong);
  --color-border: var(--line);
  --shadow-panel: var(--shadow);
  --shadow-soft: 0 1px 3px rgba(32, 33, 36, .08);
  --shadow-modal: 0 8px 30px rgba(32, 33, 36, .08);
  --border-default: 1px solid var(--color-border);
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --radius-sm: .6rem;
  --radius-md: .75rem;
  --radius-lg: .9rem;
  --radius-xl: 1rem;
  --radius-pill: 999px;
  --z-sticky: 5;
  --z-toast: 30;
  --z-modal: 1000;
  --font-family-base: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-size-xs: .75rem;
  --font-size-sm: .875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 2rem;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --transition-interactive: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
  font-family: var(--font-family-base);
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; color: var(--color-ink); background: var(--color-bg); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body::before { display: none; }

button { cursor: pointer; }

button, a, input, select, textarea, summary, [role="button"], [data-chat] {
  -webkit-tap-highlight-color: transparent;
}

::placeholder { color: #70757a; opacity: 1; }

:where(button, a, input, select, textarea, summary, [role="button"], [data-chat]):focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

:where(button, input, select, textarea):disabled,
:where(button, input, select, textarea)[aria-disabled="true"] {
  color: var(--color-disabled-text);
  background-color: var(--color-disabled-surface);
  border-color: #bdc1c6;
  cursor: not-allowed;
  opacity: 1;
}

[aria-busy="true"] { cursor: progress; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

h1, h2, h3, p { margin-top: 0; }

h1 { font-size: clamp(2rem, 4vw, 3.25rem); max-width: 62rem; line-height: 1.08; letter-spacing: -.04em; margin-bottom: 1rem; }

h2 { margin-bottom: .35rem; font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.2; letter-spacing: -.025em; }

h3 { line-height: 1.25; letter-spacing: -.02em; }

.eyebrow { margin-bottom: var(--space-1); color: var(--color-muted); text-transform: uppercase; letter-spacing: .1em; font-size: .68rem; font-weight: var(--font-weight-semibold); }

button:hover { transform: none; }

.switch-status { display: block; margin-top: .25rem; font-size: .72rem; }

.online { color: var(--color-success); }

.pending { color: var(--color-warning); }

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

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.integration-guide h4 { margin: 0 0 .35rem; }

.integration-guide p { color: var(--muted); margin-bottom: .65rem; }

.column-title { display: flex; align-items: center; gap: .55rem; margin-bottom: .75rem; }

.column-title span { width: .75rem; height: .75rem; border-radius: 99px; background: var(--stage); box-shadow: 0 0 18px var(--stage); }

.column-title small { margin-left: auto; }

.thread { display: grid; gap: .7rem; max-height: 25rem; overflow-y: auto; padding-right: .3rem; }

.panel-divider { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

[data-panel][hidden], [data-view][hidden] { display: none !important; }

.qr-box { display: grid; place-items: center; gap: .6rem; min-height: 10rem; border: 1px dashed var(--line); border-radius: .9rem; background: rgba(255,255,255,.58); color: var(--muted); text-align: center; padding: .9rem; }

.qr-box img { width: min(100%, 14rem); border-radius: .8rem; background: #fff; padding: .6rem; box-shadow: 0 12px 28px rgba(41,32,20,.12); }

.qr-box.online { border-color: rgba(34,197,94,.45); color: #08783d; background: rgba(34,197,94,.08); }

.qr-box.offline { border-color: rgba(180,35,24,.28); color: #b42318; background: rgba(180,35,24,.08); }

.simple-form { grid-template-columns: 1fr; }

.simple-actions { justify-content: flex-start; }

.simple-note { color: var(--muted); line-height: 1.5; }

.active-stage { border-color: rgba(34,197,94,.8); box-shadow: inset 0 0 0 1px rgba(34,197,94,.55); }

.customer-fields p { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-bottom: 1px dashed rgba(18,16,13,.11); }

.customer-fields p:last-child { border-bottom: 0; }

.customer-fields span { color: var(--ink); font-weight: 850; text-align: right; }

/* UX refinements: prioritize operator action over decorative analytics in the right panel. */

.action-card { background: linear-gradient(135deg, rgba(37,211,102,.14), rgba(255,250,240,.82)); }

.action-card p { color: #075e54; font-size: 1rem; font-weight: 900; }

.signal-list { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }

.signal-list li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .65rem .75rem; border: 1px solid rgba(18,16,13,.08); border-radius: .85rem; background: rgba(255,255,255,.58); }

.signal-list span { color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }

.signal-list strong { font-size: .95rem; }

.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

.security-note { display: block; color: var(--muted); font-weight: 750; line-height: 1.5; }

/* Fixed viewport scroll architecture: the document never scrolls; named regions own overflow. */

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 0;
}

.qr-box.compact { min-height: 7rem; }

.qr-box.compact img { width: min(100%, 10rem); }

.toggle-line { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-weight: 850; }
