/* ===== Welfin CRM — glass design system (load after app.css) ===== */
/* Fonts: static/fonts/fonts.css (self-hosted woff2; CSP font-src 'self'). */

:root {
  /* Typography — Figtree is soft/rounded; Noto covers EN/HI/BN body copy */
  --g-font: "Figtree", "Noto Sans", "Segoe UI", sans-serif;
  --g-font-body: "Noto Sans", "Noto Sans Devanagari", "Noto Sans Bengali", var(--g-font);
  --g-fs-xs: 0.8125rem; /* 13 */
  --g-fs-sm: 0.9375rem; /* 15 */
  --g-fs-md: 1.0625rem; /* 17 */
  --g-fs-lg: 1.3125rem; /* 21 */
  --g-fs-xl: 1.75rem;    /* 28 */
  --g-fs-2xl: 2.125rem;  /* 34 */
  --g-lh-tight: 1.3;
  --g-lh-body: 1.65;
  --g-lh-transcript: 1.75;

  /* Shape / motion */
  --g-radius-sm: 12px;
  --g-radius: 18px;
  --g-radius-lg: 26px;
  --g-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --g-dur: 200ms;
  --g-blur: 32px;
  --g-saturate: 120%;
  --g-space: 24px;
  --g-bottom-nav-h: calc(4.25rem + env(safe-area-inset-bottom));

  /* Dark glass — calmer slate/teal, less neon purple */
  --g-bg-1: #0e141c;
  --g-bg-2: #152028;
  --g-blob-a: rgba(56, 120, 160, 0.22);
  --g-blob-b: rgba(90, 110, 170, 0.16);
  --g-blob-c: rgba(45, 150, 140, 0.18);
  --g-glass: rgba(255, 255, 255, 0.055);
  --g-glass-strong: rgba(255, 255, 255, 0.09);
  --g-glass-text: rgba(14, 20, 28, 0.72);
  --g-border: rgba(255, 255, 255, 0.1);
  --g-highlight: rgba(255, 255, 255, 0.22);
  --g-text: #e6ebf2;
  --g-muted: #9aa6b8;
  --g-shadow:
    0 8px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 var(--g-highlight);
  --g-accent: #7aa2ff;
  --g-accent-2: #3ecfbe;
  --g-grad: linear-gradient(135deg, #3d7ea6 0%, #4a6fa5 55%, #2a9d8f 100%);
  --g-danger: #f08090;
  --g-ok: #5dcea0;
  --g-warn: #e6b84d;
  --g-info: #6eb0e8;
  --g-ring: 0 0 0 3px rgba(122, 162, 255, 0.35);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --g-bg-1: #eef2f6;
  --g-bg-2: #e6eef3;
  --g-blob-a: rgba(56, 120, 160, 0.14);
  --g-blob-b: rgba(90, 110, 170, 0.1);
  --g-blob-c: rgba(45, 150, 140, 0.12);
  --g-glass: rgba(255, 255, 255, 0.55);
  --g-glass-strong: rgba(255, 255, 255, 0.78);
  --g-glass-text: rgba(255, 255, 255, 0.92);
  --g-border: rgba(30, 50, 70, 0.1);
  --g-highlight: rgba(255, 255, 255, 0.9);
  --g-text: #1c2430;
  --g-muted: #5a6778;
  --g-shadow:
    0 8px 28px rgba(30, 50, 70, 0.08),
    inset 0 1px 0 var(--g-highlight);
  --g-accent: #3b6fd4;
  --g-accent-2: #0f8f82;
  --g-danger: #c93a52;
  --g-ok: #0d8a5b;
  --g-warn: #b8860b;
  --g-info: #2563a8;
  --g-ring: 0 0 0 3px rgba(59, 111, 212, 0.28);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --g-glass: rgba(22, 28, 55, 0.9);
    --g-glass-strong: rgba(28, 34, 64, 0.94);
    --g-glass-text: rgba(22, 28, 55, 0.96);
  }
  :root[data-theme="light"] {
    --g-glass: rgba(255, 255, 255, 0.92);
    --g-glass-strong: rgba(255, 255, 255, 0.96);
    --g-glass-text: rgba(255, 255, 255, 0.98);
  }
}

/* ----- Atmosphere ----- */
.g-app {
  min-height: 100%;
  font-family: var(--g-font);
  font-size: var(--g-fs-md);
  font-weight: 400;
  line-height: var(--g-lh-body);
  letter-spacing: 0.01em;
  color: var(--g-text);
  background: var(--g-bg-1);
  position: relative;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Beat app.css Inter inheritance on CRM screens */
.g-app,
.g-app button,
.g-app input,
.g-app select,
.g-app textarea {
  font-family: var(--g-font);
}

.g-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(50% 45% at 10% 12%, var(--g-blob-a), transparent 72%),
    radial-gradient(42% 40% at 90% 18%, var(--g-blob-b), transparent 74%),
    radial-gradient(55% 48% at 50% 100%, var(--g-blob-c), transparent 75%),
    linear-gradient(165deg, var(--g-bg-1), var(--g-bg-2));
}

.g-atmosphere::before,
.g-atmosphere::after {
  content: "";
  position: absolute;
  width: min(55vw, 480px);
  height: min(55vw, 480px);
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.35;
  transform: translate3d(0, 0, 0);
  animation: g-blob 28s var(--g-ease) infinite alternate;
}

.g-atmosphere::before {
  top: -8%;
  left: -6%;
  background: var(--g-blob-a);
}

.g-atmosphere::after {
  right: -10%;
  bottom: 5%;
  background: var(--g-blob-c);
  animation-duration: 28s;
  animation-direction: alternate-reverse;
}

@keyframes g-blob {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, 6%, 0) scale(1.08); }
}

@media (max-width: 767px) {
  .g-atmosphere::before,
  .g-atmosphere::after {
    filter: blur(28px);
    opacity: 0.4;
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .g-atmosphere::before,
  .g-atmosphere::after,
  .g-card,
  .g-btn,
  .g-skel::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ----- Glass surfaces ----- */
.g-card {
  position: relative;
  background: var(--g-glass);
  -webkit-backdrop-filter: blur(var(--g-blur)) saturate(var(--g-saturate));
  backdrop-filter: blur(var(--g-blur)) saturate(var(--g-saturate));
  border: 1px solid transparent;
  border-radius: var(--g-radius);
  box-shadow: var(--g-shadow);
  color: var(--g-text);
  background-clip: padding-box;
  transition: transform var(--g-dur) var(--g-ease), box-shadow var(--g-dur) var(--g-ease), filter var(--g-dur) var(--g-ease);
}
.g-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, var(--g-highlight), transparent 45%, color-mix(in srgb, var(--g-accent) 18%, transparent) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none !important;
  opacity: 0.55;
  z-index: 0;
}
.g-card > * {
  position: relative;
  z-index: 1;
}
.g-card::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--g-highlight), transparent);
  pointer-events: none;
  opacity: 0.55;
  z-index: 1;
}

.g-card--lg { border-radius: var(--g-radius-lg); }
.g-card--glow:hover,
.g-card--hover:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.22),
    0 0 0 1px color-mix(in srgb, var(--g-accent) 16%, transparent),
    inset 0 1px 0 var(--g-highlight);
}

.g-panel-text {
  /* Stronger tint behind long copy (transcripts, email bodies) for WCAG AA */
  background: var(--g-glass-text);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-sm);
  color: var(--g-text);
  font-family: var(--g-font-body);
  line-height: var(--g-lh-transcript);
}

/* ----- Type ----- */
.g-title { font-size: var(--g-fs-xl); font-weight: 600; letter-spacing: -0.015em; line-height: var(--g-lh-tight); margin: 0; }
.g-page-title { font-size: clamp(1.45rem, 2.2vw, 2rem); font-weight: 600; letter-spacing: -0.02em; line-height: var(--g-lh-tight); margin: 0; }
.g-subtitle { font-size: var(--g-fs-lg); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.2rem; }
.g-label { font-size: var(--g-fs-sm); font-weight: 500; color: var(--g-muted); letter-spacing: 0.01em; }
.g-muted { color: var(--g-muted); font-weight: 400; }
.g-lang-hi, .g-lang-bn { font-family: var(--g-font-body); }

/* ----- Buttons ----- */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--g-fs-sm);
  font-weight: 600;
  cursor: pointer;
  color: var(--g-text);
  background: transparent;
  transition: transform var(--g-dur) var(--g-ease), opacity var(--g-dur) var(--g-ease), box-shadow var(--g-dur) var(--g-ease);
}
.g-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.g-btn:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-btn--primary {
  background: var(--g-grad);
  color: #fff;
  border: 0;
  box-shadow: 0 6px 18px rgba(45, 110, 140, 0.28);
}
.g-btn--primary:hover:not(:disabled) { transform: translateY(-1px); }
.g-btn--secondary {
  background: var(--g-glass-strong);
  border-color: var(--g-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.g-btn--ghost { background: transparent; color: var(--g-muted); }
.g-btn--ghost:hover:not(:disabled) { color: var(--g-text); background: var(--g-glass); }
.g-btn--danger { background: rgba(251, 113, 133, 0.18); color: var(--g-danger); border-color: rgba(251, 113, 133, 0.35); }

.g-icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--g-muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--g-dur) var(--g-ease), color var(--g-dur) var(--g-ease);
}
.g-icon-btn:hover { background: var(--g-glass); color: var(--g-text); }
.g-icon-btn:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-icon-btn--sm { width: 36px; height: 36px; border-radius: 10px; }

/* ----- Forms ----- */
.g-field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; text-align: left; }
.g-field > label { font-size: var(--g-fs-sm); font-weight: 600; color: var(--g-muted); }
.g-input,
.g-select,
.g-textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--g-border);
  background: var(--g-glass-strong);
  color: var(--g-text);
  font: inherit;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.g-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--g-muted) 50%),
    linear-gradient(135deg, var(--g-muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
}
.g-select:focus {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--g-accent) 50%),
    linear-gradient(135deg, var(--g-accent) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
}
.g-select option {
  background: var(--g-bg-2);
  color: var(--g-text);
}
.g-textarea { min-height: 96px; resize: vertical; line-height: var(--g-lh-body); }
.g-input:focus,
.g-select:focus,
.g-textarea:focus {
  outline: none;
  border-color: var(--g-accent);
  box-shadow: var(--g-ring);
}
.g-input::placeholder { color: var(--g-muted); opacity: 0.8; }
.g-input[aria-invalid="true"] { border-color: var(--g-danger); }
.g-field__error { color: var(--g-danger); font-size: var(--g-fs-xs); }
/* Never show the browser's own calendar glyph if a native date input slips through. */
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.g-daterange {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}
.g-daterange .g-input { width: auto; min-width: 9.5rem; flex: 1; }
.g-dash-range {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 0;
}
.g-dash-range .g-daterange {
  width: 100%;
  justify-content: flex-end;
}
@media (max-width: 639.98px) {
  .g-dash-range { align-items: stretch; width: 100%; }
  .g-dash-range .g-daterange { justify-content: stretch; }
  .g-dash-range .g-daterange .g-input,
  .g-dash-range .g-daterange .wf-date { min-width: 0; width: 100%; }
}

/* Text date field + glass calendar. The panel is portaled to body (.wf-pop). */
.wf-date {
  position: relative;
  display: block;
  flex: 1 1 11rem;
  min-width: 11rem;
}
.g-daterange .wf-date { flex: 1 1 11rem; min-width: 11rem; }
.g-daterange .wf-date .g-input {
  width: 100%;
  min-width: 0;
  flex: none;
  padding-right: 2.6rem;
}
.wf-date__btn {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--g-muted);
  cursor: pointer;
  padding: 0;
}
.wf-date__btn:hover,
.wf-date__btn:focus-visible {
  color: var(--g-accent);
  background: var(--hover);
  outline: none;
}
.wf-cal.wf-menu {
  z-index: var(--z-popover);
  padding: 10px;
  overflow: auto;
  background: color-mix(in srgb, var(--g-bg-2) 88%, transparent);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow);
  color: var(--g-text);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
:root[data-theme="light"] .wf-cal.wf-menu {
  background: rgba(255, 255, 255, 0.96);
  color: var(--g-text);
}

/* ----- Chips / badges ----- */
.g-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 32px;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--g-border);
  background: var(--g-glass);
  color: var(--g-muted);
  font-size: var(--g-fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.g-chip.is-active,
.g-chip[aria-pressed="true"] {
  color: #fff;
  background: var(--g-grad);
  border-color: transparent;
}
.g-chip:focus-visible { outline: none; box-shadow: var(--g-ring); }

.g-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  line-height: 1.25;
}
.g-badge--demo {
  background: rgba(230, 184, 77, 0.14);
  color: var(--g-warn);
  border-color: rgba(230, 184, 77, 0.28);
}
.g-badge--ok { background: rgba(93, 206, 160, 0.14); color: var(--g-ok); }
.g-badge--warn { background: rgba(230, 184, 77, 0.14); color: var(--g-warn); }
.g-badge--danger { background: rgba(240, 128, 144, 0.14); color: var(--g-danger); }
.g-badge--info { background: rgba(122, 162, 255, 0.14); color: var(--g-accent); }
.g-badge--sent {
  background: rgba(96, 165, 250, 0.16);
  color: var(--g-info);
  border-color: rgba(96, 165, 250, 0.35);
}

/* ----- Tabs ----- */
.g-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 14px;
  background: var(--g-glass);
  border: 1px solid var(--g-border);
  overflow-x: auto;
}
.g-tab {
  flex: 1;
  min-height: 40px;
  min-width: 5.5rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--g-muted);
  font: inherit;
  font-size: var(--g-fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.g-tab[aria-selected="true"] {
  background: var(--g-glass-strong);
  color: var(--g-text);
  box-shadow: var(--g-shadow);
}
.g-tab:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-tabpanel[hidden] { display: none; }

/* ----- Avatar ----- */
.g-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: var(--g-fs-sm);
  font-weight: 700;
  color: #fff;
  background: var(--g-grad);
  flex: none;
  border: 1px solid var(--g-border);
}
.g-avatar--sm { width: 32px; height: 32px; font-size: var(--g-fs-xs); }
.g-avatar--lg { width: 56px; height: 56px; font-size: var(--g-fs-lg); }

/* ----- Toast / modal / drawer ----- */
.g-toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: var(--z-toast);
  display: grid;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}
.g-toast {
  pointer-events: auto;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--g-glass-strong);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  animation: g-fade-up var(--g-dur) var(--g-ease);
}
@keyframes g-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.g-modal-backdrop,
.g-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(8, 10, 24, 0.55);
  display: grid;
  place-items: end center;
  padding: 0;
}
@media (min-width: 768px) {
  .g-modal-backdrop { place-items: center; padding: 1.5rem; }
}
.g-modal {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  padding: 1.25rem;
  border-radius: var(--g-radius-lg) var(--g-radius-lg) 0 0;
}
@media (min-width: 768px) {
  .g-modal { border-radius: var(--g-radius-lg); }
}
.g-drawer {
  width: min(380px, 100%);
  height: 100%;
  margin-left: auto;
  overflow: auto;
  padding: 1rem;
  border-radius: var(--g-radius-lg) 0 0 var(--g-radius-lg);
}

/* ----- Skeleton / empty ----- */
.g-skel {
  display: block;
  border-radius: 10px;
  background: var(--g-glass);
  position: relative;
  overflow: hidden;
  min-height: 0.85rem;
}
.g-skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: translateX(-100%);
  animation: g-shimmer 1.4s ease infinite;
}
@keyframes g-shimmer {
  to { transform: translateX(100%); }
}

.g-empty {
  text-align: center;
  padding: 2rem 1.25rem;
  color: var(--g-muted);
}
.g-empty__title { color: var(--g-text); font-size: var(--g-fs-lg); font-weight: 650; margin: 0 0 0.35rem; }

/* ----- Status ticks ----- */
.g-ticks {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  color: var(--g-muted);
}
.g-ticks[data-status="delivered"],
.g-ticks[data-status="read"] { color: var(--g-accent-2); }
.g-ticks[data-status="failed"] { color: var(--g-danger); }
.g-ticks svg { width: 18px; height: 18px; }

/* ----- Timeline ----- */
.g-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--g-border);
}
.g-timeline__item {
  position: relative;
  padding: 0 0 1.25rem 1.1rem;
}
.g-timeline__item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.55rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--g-grad);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.25);
}
.g-timeline__day {
  font-size: var(--g-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g-muted);
  margin: 0.5rem 0 0.75rem;
}

/* ----- Audio player ----- */
.g-audio {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
}
.g-audio__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.g-audio__time {
  font-variant-numeric: tabular-nums;
  font-size: var(--g-fs-xs);
  color: var(--g-muted);
  min-width: 5.5rem;
}
.g-audio__seek {
  width: 100%;
  accent-color: var(--g-accent);
}
.g-audio__speeds { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }

/* ----- Styleguide layout helpers ----- */
.g-styleguide {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem 1rem 3rem;
}
.g-styleguide > header,
.g-styleguide-header {
  margin-bottom: 1.5rem;
}
.g-styleguide > main > section:first-child,
.g-styleguide section {
  margin-bottom: 1.5rem;
}
.g-styleguide h2 {
  font-size: var(--g-fs-lg);
  margin: 0 0 0.75rem;
}
.g-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.g-stack { display: grid; gap: 0.75rem; }
.g-fade-in {
  animation: g-fade-up 220ms var(--g-ease);
}

/* ===== App shell (primary nav) ===== */
/* One viewport, not a minimum. 100vh is the fallback; 100dvh tracks mobile browser chrome.
   The shell is 100% of that body so a second 100vh is not stacked on the top bar or padding. */
html:has(body > .g-shell) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.g-app:has(> .g-shell) {
  margin: 0;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}
.g-shell {
  display: flex;
  box-sizing: border-box;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 0;
}
.g-shell__main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.g-nav {
  width: 232px;
  flex: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 0.7rem;
  border-right: 1px solid var(--g-border);
  background: var(--g-glass);
  -webkit-backdrop-filter: blur(var(--g-blur)) saturate(var(--g-saturate));
  backdrop-filter: blur(var(--g-blur)) saturate(var(--g-saturate));
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}
.g-nav__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem 0.9rem;
  color: var(--g-text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.g-nav__brand:hover { color: var(--g-text); }
.g-nav__label {
  margin: 0.35rem 0.55rem 0.25rem;
  font-size: var(--g-fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--g-muted);
}
.g-nav__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  color: var(--g-muted);
  text-decoration: none;
  font-size: var(--g-fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
}
.g-nav__link:hover {
  color: var(--g-text);
  background: var(--g-glass-strong);
}
.g-nav__link.is-active {
  color: var(--g-text);
  background: var(--g-glass-strong);
  border-color: color-mix(in srgb, var(--g-accent) 30%, var(--g-border));
  box-shadow:
    inset 0 1px 0 var(--g-highlight),
    0 0 14px color-mix(in srgb, var(--g-accent) 14%, transparent);
}
.g-nav__link:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-nav__foot {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--g-border);
  display: grid;
  gap: 0.35rem;
}
.g-nav--collapsed { width: 72px; }
.g-nav--collapsed .g-nav__text,
.g-nav--collapsed .g-nav__label,
.g-nav--collapsed .g-nav__brand-name { display: none; }
.g-nav--collapsed .g-nav__link { justify-content: center; padding-inline: 0.4rem; }

.g-topbar {
  position: relative;
  z-index: var(--z-header);
  height: 56px;
  flex: none;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--g-border);
  background: var(--g-glass);
  -webkit-backdrop-filter: blur(16px) saturate(var(--g-saturate));
  backdrop-filter: blur(16px) saturate(var(--g-saturate));
}
.g-topbar__title {
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--g-fs-md);
}
.g-topbar__spacer { flex: 1; }
.g-topbar__search {
  display: none;
  align-items: center;
  gap: 0.4rem;
  min-width: 12rem;
  max-width: 18rem;
  flex: 1;
  padding: 0 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--g-border);
  background: var(--g-glass-strong);
  color: var(--g-muted);
}
.g-topbar__search .g-input {
  border: 0;
  background: transparent;
  min-height: 36px;
  padding: 0.35rem 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (min-width: 768px) {
  .g-topbar__search { display: inline-flex; }
}
.g-user-menu { position: relative; }
.g-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.2rem 0.45rem 0.2rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--g-text);
  cursor: pointer;
  font: inherit;
  font-size: var(--g-fs-sm);
  font-weight: 600;
}
.g-user-btn:hover,
.g-user-btn[aria-expanded="true"] {
  background: var(--g-glass);
  border-color: var(--g-border);
}
.g-user-btn:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-user-btn__name {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 639.98px) {
  .g-user-btn__name { display: none; }
}
.g-user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: var(--z-popover);
  min-width: 180px;
  padding: 0.35rem;
  display: grid;
}
/* display:grid above must not override the HTML hidden attribute */
.g-user-menu__panel[hidden] {
  display: none !important;
}
.g-user-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--g-text);
  text-decoration: none;
  font: inherit;
  font-size: var(--g-fs-sm);
  cursor: pointer;
}
.g-user-menu__item:hover,
.g-user-menu__item:focus-visible {
  background: var(--g-glass-strong);
  outline: none;
}

.g-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sidebar);
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom));
  background: var(--g-glass-strong);
  border-top: 1px solid var(--g-border);
  -webkit-backdrop-filter: blur(18px) saturate(var(--g-saturate));
  backdrop-filter: blur(18px) saturate(var(--g-saturate));
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
}
.g-bottom-nav__inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  max-width: 520px;
  margin: 0 auto;
}
.g-bottom-nav__inner--5 {
  grid-template-columns: repeat(5, 1fr);
  max-width: 640px;
}
.g-bottom-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 48px;
  border-radius: 12px;
  color: var(--g-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 650;
}
.g-bottom-nav__link.is-active { color: var(--g-text); background: var(--g-glass); }
.g-bottom-nav__link:focus-visible { outline: none; box-shadow: var(--g-ring); }

.g-page {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--g-space);
}
.g-page--flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

@media (max-width: 1023.98px) {
  .g-nav { width: 72px; }
  .g-nav .g-nav__text,
  .g-nav .g-nav__label,
  .g-nav .g-nav__brand-name { display: none; }
  .g-nav .g-nav__link { justify-content: center; }
  .g-nav .g-nav__brand { justify-content: center; padding-inline: 0.25rem; }
}
@media (max-width: 767.98px) {
  .g-nav { display: none; }
  .g-bottom-nav { display: block; }
  .g-shell { padding-bottom: var(--g-bottom-nav-h); }
}

/* ===== Login (glass) ===== */
body.login-page.g-app {
  display: grid;
  place-items: center;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}
body.login-page .login-bg { display: none; }
body.login-page .login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
}
body.login-page .login-card {
  background: var(--g-glass);
  -webkit-backdrop-filter: blur(var(--g-blur)) saturate(var(--g-saturate));
  backdrop-filter: blur(var(--g-blur)) saturate(var(--g-saturate));
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  box-shadow: var(--g-shadow);
  color: var(--g-text);
  padding: 32px 24px;
  text-align: center;
  position: relative;
}
body.login-page .login-card::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--g-highlight), transparent);
}
body.login-page .login-title { color: var(--g-text); }
body.login-page .login-sub { color: var(--g-muted); }
body.login-page .field input {
  background: var(--g-glass-strong);
  border-color: var(--g-border);
  color: var(--g-text);
}
body.login-page .field label { color: var(--g-muted); }
body.login-page .btn-brand {
  background: var(--g-grad);
  box-shadow: 0 6px 18px rgba(45, 110, 140, 0.28);
}

/* ===== Chat glass restyle (IDs/behaviour unchanged) ===== */
body.chat-page.g-app {
  overflow: hidden;
}
body.chat-page .g-page--chat {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
  padding: 0;
}
body.chat-page .app {
  background: transparent;
  height: auto;
  min-height: 0;
  min-width: 0;
  flex: 1;
}
body.chat-page .sidebar {
  background: var(--g-glass);
  border-right-color: var(--g-border);
  -webkit-backdrop-filter: blur(18px) saturate(var(--g-saturate));
  backdrop-filter: blur(18px) saturate(var(--g-saturate));
}
body.chat-page .sidebar-head,
body.chat-page .h-title,
body.chat-page .sidebar-foot {
  background: transparent;
  border-color: var(--g-border);
}
body.chat-page .btn-new,
body.chat-page .chip,
body.chat-page .composer,
body.chat-page .user-menu,
body.chat-page .mp-panel,
body.chat-page .menu,
body.chat-page .popover,
body.chat-page .sheet {
  background: var(--g-glass-strong);
  border-color: var(--g-border);
  box-shadow: var(--g-shadow);
  color: var(--g-text);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
body.chat-page .topbar {
  background: var(--g-glass);
  border-bottom-color: var(--g-border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
body.chat-page .app-name,
body.chat-page .greeting,
body.chat-page .user-name,
body.chat-page .h-text { color: var(--g-text); }
body.chat-page .greeting-sub,
body.chat-page .note,
body.chat-page .h-meta,
body.chat-page .history-empty { color: var(--g-muted); }
body.chat-page .h-item.active {
  background: var(--g-glass-strong);
  box-shadow: inset 0 0 0 1px var(--g-border);
}
body.chat-page .composer-wrap {
  background: transparent;
}
body.chat-page textarea#prompt {
  background: transparent;
  color: var(--g-text);
}
body.chat-page .a-content {
  background: var(--g-glass-text);
  border: 1px solid var(--g-border);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
}
body.chat-page .bubble {
  box-shadow: var(--g-shadow);
}

/* ===== Inbox / CRM screens ===== */
.g-inbox {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .g-inbox {
    display: grid;
    grid-template-columns: 240px minmax(0, 1.35fr) minmax(280px, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
}

/* Page-number pagination */
.g-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding: 0.5rem 0;
}
.g-pager__meta {
  margin: 0;
  font-size: var(--g-fs-sm);
  color: var(--g-muted);
}
.g-pager__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.g-pager__btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0.25rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--g-border);
  background: var(--g-glass);
  color: var(--g-text);
  font: inherit;
  font-size: var(--g-fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.g-pager__btn:hover:not(:disabled) {
  background: var(--g-glass-strong);
}
.g-pager__btn.is-active {
  background: var(--g-grad);
  color: #fff;
  border-color: transparent;
}
.g-pager__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.g-pager__ellipsis {
  color: var(--g-muted);
  padding: 0 0.2rem;
}
.g-inbox__filters,
.g-inbox__list,
.g-inbox__preview {
  min-height: 0;
  overflow: auto;
  padding: 0.85rem;
}
.g-inbox__filters { border-bottom: 1px solid var(--g-border); }
@media (min-width: 1024px) {
  .g-inbox__filters {
    border-bottom: 0;
    border-right: 1px solid var(--g-border);
  }
  .g-inbox__list { border-right: 1px solid var(--g-border); }
  .g-filters-mobile-only { display: none !important; }
}
@media (max-width: 1023.98px) {
  .g-inbox__filters { flex: none; max-height: 42%; }
  .g-inbox__list { flex: 1 1 auto; }
  .g-inbox__preview { display: none; }
  .g-inbox.is-preview .g-inbox__list,
  .g-inbox.is-preview .g-inbox__filters { display: none; }
  .g-inbox.is-preview .g-inbox__preview {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
}
.g-conv {
  width: 100%;
  text-align: left;
  display: block;
  gap: 0.25rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--g-radius);
  background: var(--g-glass);
  color: var(--g-text);
  cursor: pointer;
  font: inherit;
  transition: background var(--g-dur) var(--g-ease), border-color var(--g-dur) var(--g-ease), box-shadow var(--g-dur) var(--g-ease);
}
.g-conv__layout {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  min-width: 0;
}
.g-conv__main { flex: 1; min-width: 0; display: grid; gap: 0.2rem; }
.g-conv:hover,
.g-conv.is-active {
  border-color: color-mix(in srgb, var(--g-accent) 40%, var(--g-border));
  background: var(--g-glass-strong);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--g-accent) 18%, transparent);
}
.g-conv:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-conv__top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: space-between;
}
.g-conv__name { font-weight: 650; font-size: var(--g-fs-sm); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-conv__time { color: var(--g-muted); font-size: var(--g-fs-xs); flex: none; }
.g-conv__preview {
  color: var(--g-muted);
  font-size: var(--g-fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-channel-icon { text-transform: capitalize; }
.g-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--g-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--g-accent) 25%, transparent);
  flex: none;
}
.g-bubbles { display: grid; gap: 0.55rem; }
.g-bubble {
  max-width: min(92%, 420px);
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  background: var(--g-glass-strong);
  border: 1px solid var(--g-border);
  color: var(--g-text);
  font-family: var(--g-font-body);
  line-height: var(--g-lh-body);
}
.g-bubble--out { margin-left: auto; background: color-mix(in srgb, var(--g-accent) 22%, var(--g-glass-strong)); }
.g-status-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}
.g-status-steps li {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--g-border);
  font-size: var(--g-fs-xs);
  color: var(--g-muted);
}
.g-status-steps li.is-done { color: var(--g-ok); border-color: color-mix(in srgb, var(--g-ok) 40%, var(--g-border)); }
.g-status-steps li.is-fail { color: var(--g-danger); }
.g-attach-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.g-attach-list a,
.g-attach-list span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--g-border);
  background: var(--g-glass);
  color: var(--g-text);
  text-decoration: none;
}
.g-two-col {
  display: grid;
  gap: 1rem;
}
@media (min-width: 1024px) {
  .g-two-col { grid-template-columns: 1fr 280px; align-items: start; }
}
.g-transcript-line {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--g-text);
  font: inherit;
  font-family: var(--g-font-body);
  line-height: var(--g-lh-transcript);
  cursor: pointer;
}
.g-transcript-line:hover,
.g-transcript-line.is-active { background: var(--g-glass-strong); }
.g-transcript-line:focus-visible { outline: none; box-shadow: var(--g-ring); }
.g-transcript-line time { color: var(--g-muted); font-size: var(--g-fs-xs); font-variant-numeric: tabular-nums; }
.g-feature-off {
  opacity: 0.7;
  pointer-events: none;
}

/* Focus / reduced-motion / narrow phones */
.g-btn:focus-visible,
.g-chip:focus-visible,
.g-conv:focus-visible,
.g-nav__link:focus-visible,
.g-bottom-nav__link:focus-visible {
  outline: none;
  box-shadow: var(--g-ring);
}
@media (max-width: 359.98px) {
  .g-topbar__title { font-size: var(--g-fs-sm); }
  .g-page { padding-inline: 0.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .g-fade-in,
  .g-toast,
  .g-card--hover:hover {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* Utility classes — keep CSP strict (no inline style= / element.style) */
.g-search-field {
  flex: 1;
  max-width: 28rem;
  min-width: 0;
}
.g-search-field--grow { flex: 1; min-width: 0; }
.g-search-field--sm { max-width: 14rem; min-width: 0; }
.g-nav__user {
  font-size: 0.75rem;
  padding: 0 0.45rem;
}
.g-skel--xs { height: 14px; width: 40%; }
.g-skel--sm { height: 80px; }
.g-skel--md { height: 90px; }
.g-skel--lg { height: 100px; }
.g-skel--xl { height: 120px; }
.g-skel--line-1 { height: 12px; width: 70%; }
.g-skel--line-2 { height: 18px; width: 78%; }
.g-skel--line-3 { height: 24px; width: 86%; }
.g-skel--line-4 { height: 14px; width: 94%; }
.g-chip--static { cursor: default; }
.g-flex-1 { flex: 1; min-width: 0; }
.g-link-card {
  color: inherit;
  text-decoration: none;
  display: block;
}
.g-link-card:hover { color: inherit; }
.g-toast.is-leaving { opacity: 0; transition: opacity 200ms var(--g-ease); }
.g-avatar[data-tone="indigo"] { background: #5b7fc7; }
.g-avatar[data-tone="teal"] { background: #2a9d8f; }
.g-avatar[data-tone="sky"] { background: #4a90b8; }
.g-avatar[data-tone="amber"] { background: #c9963a; }
.g-avatar[data-tone="pink"] { background: #c2788e; }
.g-avatar[data-tone="violet"] { background: #7a7eb8; }
.g-avatar[data-tone="green"] { background: #3d9a6e; }

/* ===== Dashboard ===== */
.g-dashboard { max-width: 1440px; margin: 0 auto; width: 100%; }
.g-dashboard .g-page-title { font-size: clamp(1.25rem, 1.8vw, 1.65rem); }
.g-dash-hero { position: relative; overflow: hidden; padding: 1rem 1.15rem !important; margin-bottom: 1rem !important; }
.g-dash-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem !important;
}
@media (min-width: 768px) {
  .g-dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .g-dash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.g-kpi { padding: 0.75rem 0.85rem; min-width: 0; }
.g-kpi__value { font-size: clamp(1.15rem, 1.6vw, 1.45rem) !important; }
.g-kpi__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.g-kpi__value {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.g-spark { flex: none; opacity: 0.9; }
.g-trend {
  font-size: var(--g-fs-xs);
  font-weight: 650;
}
.g-trend.is-up { color: var(--g-ok); }
.g-trend.is-down { color: var(--g-danger); }
.g-trend.is-flat { color: var(--g-muted); }

.g-dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem !important;
}
@media (min-width: 768px) {
  .g-dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .g-dash-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .g-dash-grid > .g-card:nth-child(1) { grid-column: span 4; }
  .g-dash-grid > .g-card:nth-child(2) { grid-column: span 2; }
  .g-dash-grid > .g-card:nth-child(3) { grid-column: span 3; }
  .g-dash-grid > .g-card:nth-child(4) { grid-column: span 3; }
  .g-dash-grid > .g-card:nth-child(5),
  .g-dash-grid > .g-card:nth-child(6) { grid-column: span 3; }
}
.g-dash-grid > .g-card { padding: 0.85rem !important; }
.g-dash-grid .g-subtitle { font-size: 1rem; }
.g-dash-grid .g-muted.small { margin-bottom: 0; }
.g-chart-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 180px;
  margin-top: 0.35rem;
  isolation: isolate;
}
.g-chart-wrap canvas {
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  cursor: crosshair;
}
.g-chart-wrap--sm { height: 150px; }

/* DOM tooltip (body-level) — readable over glass cards */
.g-chart-tip {
  position: absolute;
  z-index: var(--z-popover);
  min-width: 140px;
  max-width: 280px;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--g-border);
  background: var(--g-glass-strong);
  color: var(--g-text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  font-family: var(--g-font);
  font-size: 0.8125rem;
  line-height: 1.45;
  pointer-events: none;
}
:root[data-theme="light"] .g-chart-tip {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 28px rgba(30, 50, 70, 0.14);
}
:root:not([data-theme="light"]) .g-chart-tip {
  background: rgba(16, 22, 32, 0.96);
}
.g-chart-tip__title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.g-chart-tip__row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0;
}
.g-chart-tip__swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.g-chart-tip__footer {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--g-border);
  font-weight: 600;
  color: var(--g-muted);
}

.g-dash-lists {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}
@media (min-width: 768px) {
  .g-dash-lists { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .g-dash-lists { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.g-dash-lists > .g-card { padding: 0.85rem !important; max-height: 260px; overflow: auto; }
.g-dash-lists .g-stack { gap: 0.35rem; }
.g-dash-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  transition: background var(--g-dur) var(--g-ease), border-color var(--g-dur) var(--g-ease);
}
.g-dash-item:hover {
  background: var(--g-glass-strong);
  border-color: var(--g-border);
  color: inherit;
}
.g-dash-item__title {
  font-weight: 650;
  font-size: var(--g-fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-dash-item__meta { font-size: var(--g-fs-xs); }
.g-dash-item.is-overdue .g-dash-item__title,
.g-dash-item.is-overdue .g-dash-item__meta { color: var(--g-danger); }
.g-list-empty { margin: 0.25rem 0; font-size: var(--g-fs-sm); }

.g-enter {
  animation: g-fade-up 420ms var(--g-ease) both;
  animation-delay: var(--g-enter-delay, 0ms);
}
@keyframes g-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .g-enter,
  .g-kpi__value {
    animation: none !important;
  }
}

@media (max-width: 389.98px) {
  .g-page { padding-inline: 0.75rem; }
  .g-dash-kpis,
  .g-dash-grid,
  .g-dash-lists { gap: 0.85rem; }
  .g-chart-wrap { height: 200px; }
}

/* Overflow guard across breakpoints */
.g-shell,
.g-shell__main,
.g-dashboard,
.g-inbox,
.g-card {
  max-width: 100%;
}
.g-select,
.g-input,
.g-search-field {
  max-width: 100%;
}
