/* UniConecta - design tokens & globals
   Sistema visual do hub: cool gray-green, bright brand, dark rail. */

:root {
  /* Palette: Floresta (default) */
  --bg: #f6f8f8;
  --surface: #ffffff;
  --surface-2: #f1f4f4;
  --surface-3: #e6ebea;
  --ink: #0c1412;
  --ink-2: #39433f;
  --ink-3: #68736f;
  --ink-4: #98a29e;
  --muted: var(--ink-3);
  --line: #e3e8e7;
  --line-2: #d3dad8;

  --brand: #0b6b47;
  --brand-2: #0e8459;
  --brand-3: #16a06b;
  --brand-soft: #e6f4ee;
  --brand-soft-2: #c9e8da;

  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #edecff;

  --success: #0f7a45;
  --warn: #b45309;
  --error: #c2192b;
  --success-soft: #e4f3ea;
  --warn-soft: #fbeee0;
  --error-soft: #fbe8ea;

  --rail: #0b3a2a;
  --rail-active: #16a06b;
  --nav-bg: var(--surface);
  --nav-line: var(--line);
  --nav-title: var(--ink);
  --nav-ink: var(--ink-2);
  --nav-ink-2: var(--ink-4);
  --nav-hover: var(--surface-2);
  --nav-active-bg: var(--brand-soft);
  --nav-active-ink: var(--brand);
  --nav-badge-bg: var(--surface-3);
  --nav-badge-ink: var(--ink-3);
  --nav-alert-bg: var(--error-soft);
  --nav-alert-ink: var(--error);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 0 rgba(15, 30, 20, 0.04), 0 1px 2px rgba(15, 30, 20, 0.04);
  --shadow-sm:
    0 2px 6px rgba(15, 30, 20, 0.05),
    0 1px 2px rgba(15, 30, 20, 0.04);
  --shadow-md:
    0 8px 24px rgba(15, 30, 20, 0.07),
    0 2px 6px rgba(15, 30, 20, 0.04);
  --shadow-lg:
    0 24px 60px rgba(15, 30, 20, 0.10),
    0 8px 24px rgba(15, 30, 20, 0.06);

  --font-sans:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --font-serif: "Instrument Serif", ui-serif, Georgia, serif;

  --density: 1;

  /* Nav chrome widths, overridden when panels are collapsed (see html[data-*]) */
  --uc-rail-w: 64px;
  --uc-sidebar-w: 252px;
}

html[data-rail-collapsed="true"] {
  --uc-rail-w: 0px;
}

html[data-sidebar-collapsed="true"] {
  --uc-sidebar-w: 0px;
}

/* Palette: Floresta — explicit alias of :root */
[data-palette="floresta"] {
  --rail: #0b3a2a;
  --rail-active: #16a06b;
}

/* Palette: Marca — Unimed chrome (dark green nav) */
[data-palette="marca"] {
  --rail: #00432c;
  --rail-active: rgba(255, 255, 255, 0.18);
  --nav-bg: #00543a;
  --nav-line: rgba(255, 255, 255, 0.13);
  --nav-title: #ffffff;
  --nav-ink: rgba(255, 255, 255, 0.82);
  --nav-ink-2: rgba(255, 255, 255, 0.54);
  --nav-hover: rgba(255, 255, 255, 0.09);
  --nav-active-bg: rgba(255, 255, 255, 0.17);
  --nav-active-ink: #ffffff;
  --nav-badge-bg: rgba(255, 255, 255, 0.17);
  --nav-badge-ink: #ffffff;
  --nav-alert-bg: rgba(255, 255, 255, 0.24);
  --nav-alert-ink: #ffffff;
}

/* Palette: Cobalto */
[data-palette="cobalto"] {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --surface-3: #e3e9f4;
  --line: #dde3ef;
  --line-2: #cdd5e4;
  --brand: #0b2a52;
  --brand-2: #1d4ed8;
  --brand-3: #3b66e0;
  --brand-soft: #e6edfb;
  --brand-soft-2: #d3deef;
  --accent: #d97706;
  --accent-2: #f59e0b;
  --accent-soft: #fdf2dc;
  --success-soft: #e4f3ea;
  --warn-soft: #fbeee0;
  --error-soft: #fbe8ea;
  --rail: #0b2a52;
  --rail-active: #3b66e0;
  --nav-bg: var(--surface);
  --nav-line: var(--line);
  --nav-title: var(--ink);
  --nav-ink: var(--ink-2);
  --nav-ink-2: var(--ink-4);
  --nav-hover: var(--surface-2);
  --nav-active-bg: var(--brand-soft);
  --nav-active-ink: var(--brand);
  --nav-badge-bg: var(--surface-3);
  --nav-badge-ink: var(--ink-3);
  --nav-alert-bg: var(--error-soft);
  --nav-alert-ink: var(--error);
}

/* Palette: Carbono */
[data-palette="carbono"] {
  --bg: #0b0f0e;
  --surface: #141918;
  --surface-2: #1b2221;
  --surface-3: #232b2a;
  --ink: #eef2f0;
  --ink-2: #c2cbc7;
  --ink-3: #94a09b;
  --ink-4: #6d7873;
  --line: #232b2a;
  --line-2: #333d3b;
  --brand: #2d8a6a;
  --brand-2: #35a37d;
  --brand-3: #4bbd95;
  --brand-soft: #152622;
  --brand-soft-2: #1b3630;
  --accent: #8b83ff;
  --accent-2: #a49dff;
  --accent-soft: #1e1c3a;
  --success: #4ade80;
  --warn: #fbbf24;
  --error: #f87171;
  --success-soft: #16281e;
  --warn-soft: #2a2113;
  --error-soft: #2c1919;
  --rail: #0f1615;
  --rail-active: #1f2c29;
  --nav-bg: var(--surface);
  --nav-line: var(--line);
  --nav-title: var(--ink);
  --nav-ink: var(--ink-2);
  --nav-ink-2: var(--ink-4);
  --nav-hover: var(--surface-2);
  --nav-active-bg: var(--brand-soft);
  --nav-active-ink: var(--brand-3);
  --nav-badge-bg: var(--surface-3);
  --nav-badge-ink: var(--ink-3);
  --nav-alert-bg: var(--error-soft);
  --nav-alert-ink: var(--error);
  --shadow-xs: 0 1px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* Palette: Aurora */
[data-palette="aurora"] {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3ece1;
  --surface-3: #eadfc9;
  --line: #e6dcc7;
  --line-2: #d7c9ab;
  --brand: #582c4a;
  --brand-2: #7a3f68;
  --brand-3: #9a5285;
  --brand-soft: #f5e9f0;
  --brand-soft-2: #ead4e0;
  --accent: #c2410c;
  --accent-2: #ea580c;
  --accent-soft: #fde7d3;
  --success-soft: #e4f3ea;
  --warn-soft: #fbeee0;
  --error-soft: #fbe8ea;
  --rail: #3a1d32;
  --rail-active: #9a5285;
  --nav-bg: var(--surface);
  --nav-line: var(--line);
  --nav-title: var(--ink);
  --nav-ink: var(--ink-2);
  --nav-ink-2: var(--ink-4);
  --nav-hover: var(--surface-2);
  --nav-active-bg: var(--brand-soft);
  --nav-active-ink: var(--brand);
  --nav-badge-bg: var(--surface-3);
  --nav-badge-ink: var(--ink-3);
  --nav-alert-bg: var(--error-soft);
  --nav-alert-ink: var(--error);
}

[data-density="compact"] {
  --density: 0.85;
}

* {
  box-sizing: border-box;
}
html, body, #root {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button {
  font-family: inherit;
  cursor: pointer;
}
input, textarea, select {
  font-family: inherit;
  color: inherit;
}
::selection {
  background: var(--brand-soft-2);
  color: var(--brand);
}

/* utility */
.mono {
  font-family: var(--font-mono);
  font-feature-settings: "zero", "ss03";
}
.serif {
  font-family: var(--font-serif);
}

/* Material icon ligatures, body font-feature-settings disables glyph rendering */
.material-icons,
.material-icons-outlined,
.material-icons-round {
  font-weight: normal;
  font-style: normal;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  line-height: 1;
}
.material-icons {
  font-family: "Material Icons", sans-serif;
}
.material-icons-outlined {
  font-family: "Material Icons Outlined", sans-serif;
}
.material-icons-round {
  font-family: "Material Icons Round", sans-serif;
}

.scroll {
  overflow-y: auto;
}
.scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.scroll::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
.scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* base layout */
.app-root {
  height: 100vh;
  width: 100vw;
  display: grid;
  grid-template-columns: var(--uc-rail-w) var(--uc-sidebar-w) minmax(0, 1fr);
  grid-template-rows: 56px 1fr;
  background: var(--bg);
  transition: grid-template-columns 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-root[data-nav="rail"] {
  grid-template-columns: var(--uc-rail-w) 0 minmax(0, 1fr);
}
.app-root[data-nav="top"] {
  grid-template-columns: 0 0 minmax(0, 1fr);
}
.app-root[data-nav="launcher"] {
  grid-template-columns: var(--uc-rail-w) 0 minmax(0, 1fr);
}
.app-root[data-nav="combined"] {
  grid-template-columns: var(--uc-rail-w) var(--uc-sidebar-w) minmax(0, 1fr);
}
/* Embedded modules: context sidebar only (platform rail rendered by outer shell) */
.app-root[data-nav="sidebar"] {
  grid-template-columns: 0 var(--uc-sidebar-w) minmax(0, 1fr);
}

.uc-embedded-module-main {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
}
.uc-embedded-module-main > .app-root,
.uc-embedded-module-main > uniconecta-island > .app-root {
  flex: 1;
  min-height: 0;
  min-width: 0;
  height: auto;
  width: 100%;
  max-width: 100%;
}

body.uc-embedded {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

body.uc-embedded > .app-root,
body.uc-embedded .app-root {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: none;
}

.main:has(.app-main-wrap) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main:has(.app-main-wrap) > .app-main-wrap,
.main:has(.app-main-wrap) > uniconecta-island > .app-main-wrap {
  flex: 1;
  min-height: 0;
}

/* rail */
.rail {
  grid-row: 1 / span 2;
  grid-column: 1;
  background: var(--rail);
  border-right: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  min-width: 0;
  z-index: 5;
  position: relative;
}
.rail-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 64px;
  min-width: 64px;
  height: 100%;
  padding: 14px 0 12px;
  gap: 6px;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
html[data-rail-collapsed="true"] .rail-inner {
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
}
.rail-logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-3);
  color: #fff;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.2s;
  overflow: hidden;
}
.rail-logo:hover {
  transform: scale(1.05);
}
.rail-logo img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
}
.rail-divider {
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  margin: 6px 0;
}
.rail-item {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  position: relative;
  background: transparent;
  border: 0;
  text-decoration: none;
  transition: all 0.15s;
}
.rail-item:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.rail-item[data-active="true"] {
  background: var(--rail-active);
  color: #fff;
}
.rail-item[data-active="true"]::before {
  display: none;
}
.rail-tooltip {
  position: absolute;
  left: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}
.rail-item:hover .rail-tooltip {
  opacity: 1;
}
.rail-spacer {
  flex: 1;
  min-height: 8px;
}
.rail-collapse-btn {
  width: 40px;
  height: 34px;
  margin-top: 4px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.rail-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: scale(1.04);
}
.rail-collapse-btn:active {
  transform: scale(0.97);
}

/* sidebar */
.sidebar {
  grid-row: 1 / span 2;
  grid-column: 2;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
  z-index: 4;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  width: 252px;
  min-width: 252px;
  height: 100%;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.22s ease, transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
html[data-sidebar-collapsed="true"] .sidebar {
  border-right-width: 0;
  border-right-color: transparent;
}
html[data-sidebar-collapsed="true"] .sidebar-inner {
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
}
.sidebar-header {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--nav-line);
}
.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--nav-title);
}
.sidebar-subtitle {
  font-size: 11.5px;
  color: var(--nav-ink-2);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-top: 2px;
}
.sidebar-app-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-module-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--brand);
  color: var(--surface);
}
.sidebar-header--module {
  min-height: 0;
  padding: 18px 18px 14px;
  flex-shrink: 0;
  gap: 10px;
}
.sidebar-module-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  color: var(--nav-title);
}
.sidebar-collapse-btn {
  width: 30px;
  height: 30px;
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--nav-ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.sidebar-collapse-btn:hover {
  background: var(--nav-hover);
  color: var(--nav-title);
  transform: scale(1.05);
}
.sidebar-collapse-btn:active {
  transform: scale(0.96);
}
.sidebar--module .sidebar-section:first-child {
  padding-top: 4px;
}

/* Collapsed nav, floating expand controls */
.nav-chrome-expand {
  position: fixed;
  z-index: 92;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  color: var(--ink-2);
  cursor: pointer;
  opacity: 0;
  transform: translateX(-8px) scale(0.94);
  animation: nav-chrome-expand-in 0.32s cubic-bezier(0.34, 1.25, 0.64, 1)
    forwards;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    border-color 0.18s ease;
}
@keyframes nav-chrome-expand-in {
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
.nav-chrome-expand:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-soft-2);
  box-shadow: var(--shadow-md);
  transform: scale(1.06);
}
.nav-chrome-expand:active {
  transform: scale(0.96);
}
.nav-chrome-expand--rail {
  top: 11px;
  left: 10px;
}
.nav-chrome-expand--sidebar {
  top: 11px;
  left: calc(var(--uc-rail-w) + 10px);
}
html[data-rail-collapsed="true"] .nav-chrome-expand--sidebar {
  top: 11px;
  left: 48px;
}

/*
 * Floating expand controls sit over the topbar edge when panels are
 * collapsed. Reserve gutter in the topbar so breadcrumbs stay readable
 * while keeping .main full-bleed with zero left trench.
 */
html[data-rail-collapsed="true"] .topbar,
html[data-sidebar-collapsed="true"] .topbar {
  padding-left: 54px;
}
html[data-rail-collapsed="true"][data-sidebar-collapsed="true"] .topbar {
  padding-left: 92px;
}
@media (prefers-reduced-motion: reduce) {
  .app-root {
    transition: none;
  }
  .rail-inner,
  .sidebar-inner,
  .nav-chrome-expand,
  .rail-collapse-btn,
  .sidebar-collapse-btn {
    transition: none;
    animation: none;
  }
  .nav-chrome-expand {
    opacity: 1;
    transform: none;
  }
}
.sidebar-section {
  padding: 8px 8px 4px;
}
.sidebar-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--nav-ink-2);
  font-weight: 600;
  padding: 0 8px 7px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--nav-ink);
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: all 0.12s;
  min-width: 0;
}
.sidebar-item > span:not(.sidebar-item-badge):not(.material-icons-round) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.sidebar-item > svg,
.sidebar-item > .material-icons-round {
  flex-shrink: 0;
  width: 1.15em;
  text-align: center;
}
.sidebar-item:hover {
  background: var(--nav-hover);
  color: var(--nav-title);
}
.sidebar-item[data-active="true"] {
  background: var(--nav-active-bg);
  color: var(--nav-active-ink);
  font-weight: 600;
}
.sidebar-item-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--nav-badge-bg);
  color: var(--nav-badge-ink);
  font-family: var(--font-mono);
}
.sidebar-item[data-active="true"] .sidebar-item-badge {
  background: var(--nav-badge-bg);
  color: var(--nav-active-ink);
}

/* topbar */
.topbar {
  grid-row: 1;
  grid-column: 3;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  min-width: 0;
  z-index: 3;
}
.app-root[data-nav="top"] > .topbar,
.app-root[data-nav="top"] > uniconecta-island > .topbar {
  grid-column: 1 / -1;
}
.app-root[data-nav="launcher"] > .topbar,
.app-root[data-nav="launcher"] > uniconecta-island > .topbar {
  grid-column: 2 / -1;
}
.app-root[data-nav="sidebar"] > .topbar,
.app-root[data-nav="sidebar"] > uniconecta-island > .topbar {
  grid-column: 2 / -1;
}
.app-root[data-nav="sidebar"] > .sidebar,
.app-root[data-nav="sidebar"] > uniconecta-island > .sidebar {
  grid-row: 2;
  grid-column: 2;
}
.app-root[data-nav="sidebar"] > .main,
.app-root[data-nav="sidebar"] > uniconecta-island > .main {
  grid-row: 2;
  grid-column: 3;
}
.app-root[data-nav="combined"] > .topbar,
.app-root[data-nav="combined"] > uniconecta-island > .topbar {
  grid-column: 2 / -1;
}
.app-root[data-nav="combined"] > .sidebar,
.app-root[data-nav="combined"] > uniconecta-island > .sidebar {
  grid-row: 2;
  grid-column: 2;
}
.app-root[data-nav="combined"] > .main,
.app-root[data-nav="combined"] > uniconecta-island > .main {
  grid-row: 2;
  grid-column: 3;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-3);
}
.breadcrumb-sep {
  color: var(--ink-4);
}
.breadcrumb-current {
  color: var(--ink);
  font-weight: 600;
}
.cmdk-trigger {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.cmdk-trigger:hover {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink-2);
}
.cmdk-trigger .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-3);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.icon-btn .dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--error);
  border-radius: 50%;
  border: 0;
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-soft-2);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.tenant-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}
.tenant-pill:hover {
  background: var(--surface-3);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.user-chip:hover {
  background: var(--surface-2);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-3) 100%);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* main */
.main {
  grid-row: 2;
  grid-column: 3;
  overflow: auto;
  position: relative;
  min-height: 0;
  min-width: 0;
}
.main:has(.chat-workspace) {
  overflow: hidden;
}
.main:has(.reembolso-shell) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main:has(.hub-users) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main:has(.reembolso-shell) .page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main:has(.reembolso-shell) .page-header {
  flex-shrink: 0;
}
.main:has(.reembolso-shell) .page-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}
.chat-mobile-menu {
  display: none;
}
@media (max-width: 1024px) {
  .chat-mobile-menu {
    display: grid;
  }
}
.app-root[data-nav="top"] > .main,
.app-root[data-nav="top"] > uniconecta-island > .main {
  grid-column: 1 / -1;
}
.app-root[data-nav="launcher"] > .main,
.app-root[data-nav="launcher"] > uniconecta-island > .main {
  grid-column: 2 / -1;
}
.app-root[data-nav="sidebar"] > .main,
.app-root[data-nav="sidebar"] > uniconecta-island > .main {
  grid-column: 3;
}

/* topbar app-switcher (for top nav mode) */
.top-app-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  margin-right: 8px;
  height: 100%;
}
.top-app-item {
  height: 100%;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  border: 0;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.top-app-item[data-active="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 500;
}
.top-app-item:hover {
  color: var(--ink);
}

/* shared cards / chips / buttons */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.card-soft {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.chip-brand {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-soft-2);
}
.chip-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft);
}
.chip-success {
  background: #e7f5ec;
  color: var(--success);
  border-color: #cae6d3;
}
.chip-warn {
  background: #fdf3e0;
  color: var(--warn);
  border-color: #f1dfb3;
}
.chip-error {
  background: #fbe7e7;
  color: var(--error);
  border-color: #f0c8c8;
}
[data-palette="carbono"] .chip-success {
  background: #1a2a1f;
  border-color: #2d4a36;
  color: #84e8a4;
}
[data-palette="carbono"] .chip-warn {
  background: #2b220f;
  border-color: #4a3a1a;
  color: #f59e0b;
}
[data-palette="carbono"] .chip-error {
  background: #2b1414;
  border-color: #4a2222;
  color: #fca5a5;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  background: var(--surface-3);
}
.btn-primary {
  background: var(--brand);
  color: var(--surface);
}
[data-palette="carbono"] .btn-primary {
  color: #0e1110;
}
.btn-primary:hover {
  background: var(--brand-2);
}
.btn-ghost {
  background: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-outline {
  background: transparent;
  border-color: var(--line-2);
}
.btn-outline:hover {
  background: var(--surface-2);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.btn-lg {
  padding: 11px 18px;
  font-size: 14px;
}

input.input, textarea.input, select.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--brand-3);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* skeleton / shimmer */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}
.skel {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 6px;
}

/* page transitions */
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.page {
  animation: pageIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* page chrome */
.page-header {
  padding: 26px 32px 18px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.page-sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin: 0;
}
.page-body {
  padding: 24px 32px;
}

/* grid helpers */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.grow {
  flex: 1;
}
.spacer {
  flex: 1;
}

/* kpi card */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.kpi-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-feature-settings: "tnum" 1;
}
.kpi-delta {
  font-size: 12px;
  font-weight: 500;
}
.kpi-delta.up {
  color: var(--success);
}
.kpi-delta.down {
  color: var(--error);
}

/* table */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .tbl td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td.wrap {
  white-space: normal;
}
.tbl th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
}
.tbl tr:hover td {
  background: var(--surface-2);
}
.tbl tr:last-child td {
  border-bottom: 0;
}

/* command palette */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 20, 16, 0.35);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: start center;
  padding-top: 12vh;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.cmdk {
  width: min(620px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pageIn 0.2s ease;
}
.cmdk-input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 16px 18px 16px 46px;
  font-size: 15px;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7470' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: 18px 50%;
}
.cmdk-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}
.cmdk-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  padding: 10px 10px 6px;
  font-weight: 600;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13.5px;
}
.cmdk-item[data-active="true"] {
  background: var(--brand-soft);
}
.cmdk-item-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.cmdk-item[data-active="true"] .cmdk-item-icon {
  background: var(--brand);
  color: var(--surface);
}
[data-palette="carbono"] .cmdk-item[data-active="true"] .cmdk-item-icon {
  color: #0e1110;
}
.cmdk-item-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.cmdk-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
  background: var(--surface-2);
}
.cmdk-footer .kbd {
  font-family: var(--font-mono);
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  font-size: 10.5px;
}

/* ====== Login ====== */
.login-stage {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
  overflow: hidden;
}
.login-left {
  position: relative;
  background: linear-gradient(
    160deg,
    var(--brand) 0%,
    var(--brand-2) 55%,
    var(--brand-3) 100%
  );
  color: var(--surface);
  padding: 44px 56px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-palette="carbono"] .login-left {
  color: #0e1110;
}
[data-palette="aurora"] .login-left {
  color: var(--surface);
}
.login-mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.7;
}
.login-mesh svg {
  width: 100%;
  height: 100%;
}
.login-hero-logo {
  height: 44px;
  width: 44px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.32),
    0 8px 22px rgba(0, 0, 0, 0.14);
}
.login-right {
  display: grid;
  place-items: center;
  padding: 32px;
}
.login-form-wrap {
  width: min(420px, 100%);
}
.login-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-greet {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.login-greet-sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin: 0 0 24px;
}
.sso-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 10px;
}
.sso-btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-4);
}
.divider-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.divider-or::before, .divider-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  margin: 0 0 6px;
}
.field {
  margin-bottom: 14px;
}

.login-password-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.login-password-row .field-label {
  margin: 0;
}
.login-help-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 4px;
  color: var(--brand-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
}
.login-help-link:hover {
  text-decoration: underline;
}
.login-submit {
  min-height: 48px;
  font-size: 15px;
}
.login-foot {
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.login-foot a {
  color: var(--brand-2);
  text-decoration: none;
  font-weight: 600;
}

/* ====== Launcher (home) ====== */
.launcher {
  padding: 40px clamp(24px, 5vw, 64px);
  max-width: 1400px;
  margin: 0 auto;
}
.launcher-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.launcher-greeting {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}
.launcher-greeting em,
.launcher-greeting-name {
  font-style: normal;
  font-weight: 600;
  color: var(--brand);
}
.launcher--compact .launcher-hero {
  margin-bottom: 24px;
}
.launcher--compact .app-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-bottom: 24px;
}
.launcher--compact .launcher-block {
  margin-bottom: 20px;
}
.branding-settings-grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 1100px) {
  .branding-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .branding-settings-grid > .settings-panel:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
.launcher-sub {
  font-size: 14.5px;
  color: var(--ink-3);
  margin: 0;
  max-width: 620px;
}
.launcher-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}
.launcher-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.launcher-block-head > .material-icons-round {
  font-size: 20px;
  color: var(--brand);
}
.launcher-block-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label .line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}
.app-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}
.app-tile:hover {
  border-color: var(--ink-4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.app-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--surface);
  position: relative;
}
[data-palette="carbono"] .app-tile-icon {
  color: #0e1110;
}
.app-tile-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.app-tile-desc {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0;
  line-height: 1.45;
}
.app-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

/* horizontal scrolling app rows - grid with auto-fit to avoid awkward inner scroll */
.row-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.strip-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.18s;
}
.strip-card:hover {
  border-color: var(--ink-4);
  transform: translateY(-2px);
}

/* Reembolso specific */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}
.timeline-item {
  position: relative;
  padding-bottom: 18px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--surface);
}
.timeline-item.done::before {
  background: var(--success);
}
.timeline-item.active::before {
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.timeline-item-title {
  font-size: 13.5px;
  font-weight: 500;
}
.timeline-item-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* chat */
.chat-stage {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
}
.chat-messages {
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.msg {
  display: flex;
  gap: 12px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.msg-avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.msg-avatar.ai {
  background: var(--brand);
  color: var(--surface);
}
[data-palette="carbono"] .msg-avatar.ai {
  color: #0e1110;
}
.msg-avatar.user {
  background: var(--surface-3);
  color: var(--ink);
}
.msg-body {
  flex: 1;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.msg-body p {
  margin: 0 0 8px;
}
.msg-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}
.cite {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  margin: 0 2px;
  white-space: nowrap;
}
.chat-composer {
  padding: 16px 32px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.composer-box {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within {
  border-color: var(--brand-3);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.composer-input {
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 14px;
  resize: none;
  background: transparent;
  color: var(--ink);
  min-height: 24px;
  max-height: 140px;
  font-family: var(--font-sans);
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.composer-actions .grow {
  flex: 1;
}

/* chat suggestion cards */
.chat-suggestions {
  max-width: 760px;
  margin: 8vh auto 0;
  text-align: center;
}
.chat-suggestions h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.chat-suggestions h2 em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--brand);
}
.suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 28px;
}
.suggestion-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.suggestion-card:hover {
  border-color: var(--brand-3);
  background: var(--surface-2);
}
.suggestion-card .tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 4px;
  display: block;
}

/* chat workspace - history panel + stage inside platform main */
.chat-workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.chat-workspace.history-collapsed {
  grid-template-columns: 52px 1fr;
}
.chat-history {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.chat-history-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.chat-history-head.row {
  flex-direction: row;
  align-items: center;
}
.chat-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px;
}
.chat-history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
}
.chat-history-item:hover {
  background: var(--surface-2);
}
.chat-history-item[data-active="true"] {
  background: var(--brand-soft);
  color: var(--brand);
}
.chat-history-item-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-history-item-meta {
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.chat-history-item[data-active="true"] .chat-history-item-title {
  color: var(--brand);
}
.msg-body .chat-inline-link {
  color: var(--brand-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.msg-body .chat-md-table-wrap {
  margin: 12px 0;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.msg-body .chat-md-table {
  min-width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.msg-body .chat-md-table th,
.msg-body .chat-md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.msg-body .chat-md-table th {
  background: var(--surface-2);
  font-weight: 600;
}
.msg-body .chat-md-code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  border: 1px solid var(--line);
}
.msg-body .chat-md-pre {
  margin: 12px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0e1110;
  color: #e8ede9;
  padding: 14px;
  font-size: 13px;
  font-family: var(--font-mono);
  overflow-x: auto;
}
.chat-history-backdrop {
  display: none;
}
@media (max-width: 1024px) {
  .chat-workspace {
    grid-template-columns: 1fr;
  }
  .chat-history {
    position: fixed;
    inset: 0 auto 0 56px;
    width: min(320px, 85vw);
    z-index: 45;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .chat-history--open {
    transform: translateX(0);
  }
  .chat-history-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 44;
    border: 0;
  }
  .chat-workspace.history-collapsed .chat-history {
    transform: translateX(-110%);
  }
}

/* charts */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
}
.bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--brand-2);
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-label {
  width: 140px;
  color: var(--ink-2);
}
.bar-val {
  width: 60px;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

/* dot/sparkline */
.spark-row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
}
.spark-bar {
  flex: 1;
  background: var(--brand-soft-2);
  border-radius: 2px;
}
.spark-bar.hi {
  background: var(--brand);
}

/* logos */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  user-select: none;
}
.brand-lockup-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}
.brand-lockup-word {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand-lockup-word span {
  font-weight: 400;
  opacity: 0.75;
}

/* hero animated mesh blobs */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: float 14s ease-in-out infinite;
}
@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(40px, -30px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 30px) scale(0.95);
  }
}

/* spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.spin {
  animation: spin 1s linear infinite;
}

/* ====== Info hint (compact contextual help) ====== */
.info-hint {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  flex-shrink: 0;
}
.info-hint > summary {
  list-style: none;
  cursor: pointer;
}
.info-hint > summary::-webkit-details-marker {
  display: none;
}
.info-hint-trigger {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.info-hint-trigger .material-icons-round {
  font-size: 15px;
}
.info-hint-trigger:hover,
.info-hint[open] .info-hint-trigger {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  background: var(--brand-soft);
}
.info-hint--warn .info-hint-trigger {
  color: #b45309;
  background: #fffbeb;
  border-color: #fcd34d;
}
.info-hint--warn .info-hint-trigger:hover,
.info-hint--warn[open] .info-hint-trigger {
  color: #92400e;
  background: #fef3c7;
}
.info-hint-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  width: min(300px, calc(100vw - 48px));
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 10px);
  box-shadow: var(--shadow-lg);
  font-weight: 400;
  text-align: left;
}
.info-hint--align-start .info-hint-popover {
  left: 0;
  transform: none;
}
.info-hint--align-end .info-hint-popover {
  left: auto;
  right: 0;
  transform: none;
}
.info-hint:not([open]) .info-hint-popover {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.info-hint[open] .info-hint-popover,
.info-hint:hover .info-hint-popover,
.info-hint:focus-within .info-hint-popover {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.info-hint-popover-title {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.info-hint-popover-body p {
  margin: 0 0 6px;
}
.info-hint-popover-body p:last-child {
  margin-bottom: 0;
}
.info-hint-popover-body a {
  color: var(--brand);
}
.hub-apps-section-head .info-hint,
.page-title .info-hint,
.launcher-block-head .info-hint {
  margin-top: 1px;
}

/* tooltip generic */
[data-tip] {
  position: relative;
}
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 100;
}
[data-palette="carbono"] [data-tip]:hover::after {
  color: #0e1110;
  background: var(--ink);
}

/* notifications panel */
.notif-panel {
  position: absolute;
  top: 52px;
  right: 20px;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  animation: pageIn 0.2s ease;
  overflow: hidden;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.notif-item:hover {
  background: var(--surface-2);
}
.notif-item:last-child {
  border-bottom: 0;
}
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-dot.read {
  background: var(--line-2);
}

/* status pill (online dot) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-3);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

/* sub-tabs */
.subtabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  background: var(--surface);
}
.subtab {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--ink-3);
  border: 0;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-weight: 500;
}
a.subtab {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
label.subtab {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.subtab:hover {
  color: var(--ink);
}
.subtab[data-active="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* tweaks adjustments */
#__tweaks-panel {
  z-index: 9999;
}

/* Harmonize legacy admin islands inside shell */
.shell-admin {
  color: var(--ink);
}
.shell-admin .text-gray-900,
.shell-admin .text-gray-800,
.shell-admin .text-gray-700 {
  color: var(--ink) !important;
}
.shell-admin .text-gray-600,
.shell-admin .text-gray-500,
.shell-admin .text-gray-400 {
  color: var(--ink-3) !important;
}
.shell-admin .bg-white,
.shell-admin .bg-white\/70,
.shell-admin .bg-gray-50,
.shell-admin .bg-gray-50\/50 {
  background: var(--surface) !important;
}
.shell-admin .border-gray-100,
.shell-admin .border-gray-200,
.shell-admin .border-white {
  border-color: var(--line) !important;
}
.shell-admin .rounded-2xl,
.shell-admin .rounded-xl,
.shell-admin .rounded-lg {
  border-radius: 14px !important;
}
.shell-admin .shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}
.shell-admin input:not([type="checkbox"]):not([type="radio"]),
.shell-admin select,
.shell-admin textarea {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--font-sans);
}
.shell-admin input:focus,
.shell-admin select:focus,
.shell-admin textarea:focus {
  outline: none;
  border-color: var(--brand-3);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.shell-admin table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.shell-admin table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.shell-admin table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.shell-admin table tr:hover td {
  background: var(--surface-2);
}
.shell-admin .font-display {
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
}
.shell-admin .material-icons,
.shell-admin .material-icons-round,
.shell-admin .material-icons-outlined {
  font-family: "Material Icons Round", "Material Icons", sans-serif !important;
  font-size: inherit;
  line-height: 1;
  vertical-align: middle;
}
.shell-admin a.text-primary-600,
.shell-admin .text-primary-600 {
  color: var(--brand) !important;
}
.shell-admin .bg-primary-600,
.shell-admin .bg-primary-50 {
  background: var(--brand-soft) !important;
}
.shell-admin .dashboard-quick-action-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  color: var(--surface) !important;
  border: 0 !important;
  text-decoration: none;
}
.shell-admin .dashboard-quick-action-accent {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3))
    !important;
  color: var(--surface) !important;
  border: 0 !important;
  text-decoration: none;
}
.shell-admin .dashboard-quick-action-indigo {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  color: var(--surface) !important;
  border: 0 !important;
  text-decoration: none;
}
.shell-admin .hero-gradient-text {
  color: var(--brand);
  font-family: var(--font-serif);
  font-style: italic;
}
.shell-admin .icon-box-primary {
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
}

.subtab {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* ====== Standalone / portal pages ====== */
.standalone-stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  overflow-y: auto;
  z-index: 99999;
}
.standalone-card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: var(--shadow-md);
}
.standalone-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 16px;
  font-size: 26px;
}
.standalone-title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.standalone-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin: 0 0 20px;
  line-height: 1.5;
}
.alert-panel {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.alert-panel-warn {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.alert-panel-info {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 25%, transparent);
  color: var(--ink-2);
}
.alert-panel-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.env-key-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.env-key-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12.5px;
}
.env-key-item code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  word-break: break-all;
}
.suggestion-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.suggestion-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-2);
}
.suggestion-list li::before {
  content: "✓";
  color: var(--brand);
  font-weight: 700;
  flex-shrink: 0;
}
.portal-stage {
  min-height: 100vh;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}
.portal-card {
  width: min(640px, 100%);
}
.portal-hero {
  text-align: center;
  margin-bottom: 28px;
}
.portal-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: inline-grid;
  place-items: center;
  margin-bottom: 16px;
  font-size: 32px;
}
.portal-title {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.portal-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin: 0;
  line-height: 1.5;
}
.login-stage--auth-only {
  grid-template-columns: 1fr;
}
.login-stage--auth-only .login-right {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg) 0%, var(--surface-2) 100%);
}

/* Shell primary buttons - must win over legacy theme CSS */
.btn.btn-primary {
  background: var(--brand) !important;
  color: var(--surface) !important;
}
[data-palette="carbono"] .btn.btn-primary {
  color: #0e1110 !important;
}
.btn.btn-primary:hover {
  background: var(--brand-2) !important;
}
.btn.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-new-btn {
  width: 100%;
  justify-content: center;
  border-color: var(--brand-soft-2);
  color: var(--brand);
  background: var(--brand-soft);
}
.chat-new-btn:hover {
  background: var(--brand-soft-2);
  border-color: var(--brand-3);
}

/* ====== Admin / settings shared components ====== */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.settings-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    180deg,
    var(--surface) 0%,
    color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 100%
  );
}
.settings-panel-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.settings-panel-icon .material-icons-round {
  font-size: 18px;
}
.settings-panel-titles {
  flex: 1;
  min-width: 0;
}
.settings-panel-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-panel-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1px solid var(--line);
}
.settings-panel-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.5;
}
.settings-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.settings-panel-body {
  padding: 4px 18px 14px;
}
.settings-panel-body .stack-option {
  margin-bottom: 8px;
}
.settings-panel-body .stack-option:last-child {
  margin-bottom: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}

.settings-inline-tabs {
  margin: -24px -32px 0;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.settings-tab-rd {
  position: fixed;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.settings-page
  #settings-tab-system:checked
  ~ nav label[for="settings-tab-system"],
.settings-page
  #settings-tab-kb-nav:checked
  ~ nav label[for="settings-tab-kb-nav"],
.settings-page
  #settings-tab-hub-branding:checked
  ~ nav label[for="settings-tab-hub-branding"],
.settings-page
  #settings-tab-modules:checked
  ~ nav label[for="settings-tab-modules"],
.settings-page
  #settings-tab-hub-apps:checked
  ~ nav label[for="settings-tab-hub-apps"],
.settings-page
  #settings-tab-hub-platform:checked
  ~ nav label[for="settings-tab-hub-platform"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.settings-tab-panels {
  padding-top: 0;
}
.settings-tab-panel {
  display: none;
}
.settings-page
  #settings-tab-system:checked
  ~ .settings-tab-panels
  [data-panel="system"],
.settings-page
  #settings-tab-kb-nav:checked
  ~ .settings-tab-panels
  [data-panel="kb-nav"],
.settings-page
  #settings-tab-hub-branding:checked
  ~ .settings-tab-panels
  [data-panel="hub-branding"],
.settings-page
  #settings-tab-modules:checked
  ~ .settings-tab-panels
  [data-panel="modules"],
.settings-page
  #settings-tab-hub-apps:checked
  ~ .settings-tab-panels
  [data-panel="hub-apps"],
.settings-page
  #settings-tab-hub-platform:checked
  ~ .settings-tab-panels
  [data-panel="hub-platform"] {
  display: block;
  padding-top: 20px;
  animation: settingsTabIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-tab-panel[hidden] {
  display: none !important;
}
.settings-tab-panel:not([hidden]) {
  animation: settingsTabIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== Hub mini apps admin ====== */
.hub-support-banner {
  display: flex;
  gap: 16px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--brand-soft-2);
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--surface) 55%);
}
.hub-support-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.hub-support-banner-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.hub-support-banner-body p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 720px;
}
.hub-apps-section {
  margin-top: 4px;
}
.hub-apps-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.hub-apps-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.hub-apps-section-title .material-icons-round {
  font-size: 18px;
  color: var(--brand);
}
.hub-apps-section-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  max-width: 640px;
  line-height: 1.5;
}
.hub-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.hub-app-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hub-app-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-sm);
}
.hub-app-card[data-active="false"] {
  opacity: 0.72;
}
.hub-apps-org-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.45;
}
.hub-app-card-top .module-lic-toggle {
  flex-shrink: 0;
}
.hub-app-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.hub-app-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.hub-app-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.hub-app-card-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.hub-app-card-sub {
  margin: 0;
  font-size: 11px;
  color: var(--ink-3);
}
.hub-app-card-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.45;
  flex: 1;
}
.hub-app-meta {
  margin: 4px 0 0;
  display: grid;
  gap: 6px;
  font-size: 11.5px;
}
.hub-app-meta div {
  display: flex;
  gap: 8px;
}
.hub-app-meta dt {
  color: var(--ink-3);
  min-width: 88px;
  margin: 0;
}
.hub-app-meta dd {
  margin: 0;
  color: var(--ink-2);
  word-break: break-all;
}
.hub-app-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.hub-app-card-warn {
  margin: 0;
  font-size: 11px;
  color: var(--warning, #b45309);
  display: flex;
  align-items: center;
  gap: 4px;
}
.hub-apps-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-3);
}
.hub-apps-empty .material-icons-round {
  font-size: 40px;
  opacity: 0.35;
}
.hub-apps-filters .btn[data-active="true"] {
  color: var(--brand);
  background: var(--brand-soft);
}
.hub-reports-editor .hub-report-row {
  background: var(--surface-2);
}

/* Power BI hub embed */
.pbi-hub-rd {
  position: fixed;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.pbi-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.pbi-hub-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
}
.pbi-hub-frame-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.pbi-hub-frame {
  width: 100%;
  min-height: min(72vh, 720px);
  border: 0;
  display: block;
}
.pbi-hub-panel {
  display: none;
}
.pbi-hub-panel-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-3);
}

@keyframes settingsTabIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child {
  border-bottom: 0;
}
.settings-row.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.settings-row-text {
  min-width: 0;
}
.settings-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.settings-row-helper {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
  max-width: 540px;
}
.settings-row-control {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
@media (max-width: 960px) {
  .provider-grid {
    grid-template-columns: 1fr;
  }
  .audit-overview-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 640px) {
  .settings-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .settings-row-control {
    justify-content: flex-start;
  }
}
.audit-overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.stack-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.stack-option:hover {
  background: var(--surface-2);
}
.stack-option[data-active="true"] {
  border-color: var(--brand-soft-2);
  background: var(--brand-soft);
}
.stack-option-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--brand);
  flex-shrink: 0;
}

.engine-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: var(--surface);
}
.engine-banner--warn {
  background: linear-gradient(135deg, #92400e 0%, #b45309 100%);
}
.engine-banner-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.engine-banner-meta {
  margin: 0;
  font-size: 12px;
  opacity: 0.85;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.provider-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.provider-card:hover {
  border-color: var(--line-2);
}
.provider-card[data-active="true"] {
  border-color: var(--brand-3);
  box-shadow: var(--shadow-sm);
}
.provider-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.provider-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.provider-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
  flex: 1;
}
.provider-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.setup-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.setup-step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--brand-soft-2);
}
.setup-step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
[data-palette="carbono"] .setup-step-num {
  color: #0e1110;
}
.setup-step-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--brand);
}
.setup-step-body {
  padding: 18px 20px;
}
.setup-step-body p {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.setup-step-body ol {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.setup-step-body ol a {
  color: var(--brand);
  font-weight: 500;
}
.setup-ready {
  text-align: center;
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--brand-soft-2);
  background: var(--brand-soft);
}
.setup-ready h2 {
  margin: 12px 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand);
}
.setup-ready p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-2);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(13, 20, 16, 0.35);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-panel-lg {
  max-width: 560px;
}
.modal-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

.admin-table-card .admin-table-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-table-card .admin-table-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.perm-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  background: var(--surface-2);
  color: var(--ink-4);
}
.perm-toggle[data-on="true"] {
  background: var(--brand-soft);
  color: var(--brand);
}
.perm-toggle:hover {
  background: var(--surface-3);
}
.perm-toggle[data-on="true"]:hover {
  background: var(--brand-soft-2);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-soft-2);
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.shell-admin .bg-primary-600.text-white,
.shell-admin .bg-gray-700.text-white,
.shell-admin .bg-gray-900.text-white {
  background: var(--brand) !important;
  color: var(--surface) !important;
  border: 0 !important;
  border-radius: 8px !important;
  font-weight: 500 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}
.shell-admin .bg-primary-600.text-white:hover,
.shell-admin .bg-gray-700.text-white:hover,
.shell-admin .bg-gray-900.text-white:hover {
  background: var(--brand-2) !important;
}
.shell-admin .bg-gray-100.text-gray-700 {
  background: var(--surface-2) !important;
  color: var(--ink-2) !important;
}
.shell-admin .engine-banner .chip-success {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--surface);
}

/* =============================================================================
   MOBILE-FIRST RESPONSIVE SYSTEM
   Loaded last so it overrides desktop defaults declared above.
   Breakpoints:
     1100px - tablet landscape (collapse split panels)
      900px - tablet portrait & phones (rail/sidebar → off-canvas drawer)
      640px - phone (single column, compact paddings, full-screen modals)
      480px - small phone (extra compact)
   ============================================================================= */

/* Improve touch target across the board */
.icon-btn,
.btn,
.btn-sm,
.sidebar-item,
.rail-item,
.subtab,
.suggestion-card {
  -webkit-tap-highlight-color: transparent;
}

/* Hamburger button + mobile-only helpers, hidden on desktop */
.mobile-nav-toggle,
.mobile-nav-backdrop,
.mobile-search-btn {
  display: none;
}
body.mobile-nav-locked {
  overflow: hidden;
  touch-action: none;
}

/* =========================================================================
   Reembolso detail drawer — overlays content so table/KPIs keep full width
   ========================================================================= */
.reembolso-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}
.reembolso-shell-main {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  min-height: 0;
  grid-column: 1;
}
.reembolso-shell-main .card:has(> .tbl),
.reembolso-shell-main .card:has(> uniconecta-island > .tbl) {
  overflow-x: auto;
  max-width: 100%;
}
.reembolso-detail-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(13, 20, 16, 0.38);
  backdrop-filter: blur(2px);
  z-index: 77;
  border: 0;
  padding: 0;
  cursor: pointer;
  animation: mobileNavFadeIn 0.2s ease;
}
.reembolso-shell-detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  z-index: 78;
  box-shadow: -8px 0 32px rgba(15, 30, 20, 0.14);
  transform: translateX(110%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.reembolso-shell-detail[data-open="true"] {
  transform: translateX(0);
}

@media (max-width: 1200px) {
  .reembolso-shell-detail {
    width: min(480px, 100vw);
  }
}

.reembolso-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.reembolso-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

/* Generic reusable KPI grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(var(--kpi-cols, 4), minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

/* =========================================================================
   ≤ 900px: TABLET PORTRAIT / PHONE
   - Rail + sidebar become off-canvas drawer
   - Hamburger appears in topbar
   - Topbar simplifies
   ========================================================================= */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
  }

  .nav-chrome-expand,
  .rail-collapse-btn,
  .sidebar-collapse-btn {
    display: none !important;
  }

  /* Expand gutters are desktop-only (controls are hidden below). */
  html[data-rail-collapsed="true"] .topbar,
  html[data-sidebar-collapsed="true"] .topbar {
    padding-left: 12px;
  }
  html[data-rail-collapsed="true"][data-sidebar-collapsed="true"] .main {
    padding-left: 0;
  }

  html[data-rail-collapsed="true"] .rail-inner,
  html[data-sidebar-collapsed="true"] .sidebar-inner {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  /* Layout grid collapses to single column with shorter topbar */
  .app-root,
  .app-root[data-nav="rail"],
  .app-root[data-nav="launcher"],
  .app-root[data-nav="combined"],
  .app-root[data-nav="sidebar"],
  .app-root[data-nav="top"] {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 56px 1fr !important;
  }

  /* Rail becomes off-canvas */
  .rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 64px;
    transform: translateX(calc(-100% - 8px));
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 82;
    box-shadow: none;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 64px;
    width: min(280px, calc(100vw - 64px - 16px));
    transform: translateX(calc(-100% - 72px));
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 81;
    box-shadow: none;
    border-left: 1px solid var(--line);
  }

  /* Open state */
  .app-root[data-mobile-nav-open="true"] .rail {
    transform: translateX(0);
    box-shadow: 6px 0 22px rgba(15, 30, 20, 0.18);
  }
  .app-root[data-mobile-nav-open="true"] .sidebar {
    transform: translateX(0);
    box-shadow: 6px 0 22px rgba(15, 30, 20, 0.16);
  }

  /* Backdrop element rendered by PlatformTopbar */
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(13, 20, 16, 0.42);
    backdrop-filter: blur(2px);
    z-index: 79;
    border: 0;
    padding: 0;
    cursor: pointer;
    animation: mobileNavFadeIn 0.2s ease;
  }
  @keyframes mobileNavFadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  /* Main + topbar always full width (direct grid children & island-wrapped) */
  .app-root > .main,
  .app-root > uniconecta-island > .main,
  .app-root[data-nav] > .main,
  .app-root[data-nav] > uniconecta-island > .main {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    min-width: 0;
  }
  .app-root > .topbar,
  .app-root > uniconecta-island > .topbar,
  .app-root[data-nav] > .topbar,
  .app-root[data-nav] > uniconecta-island > .topbar {
    grid-column: 1 / -1 !important;
    padding: 0 12px;
    gap: 6px;
    min-width: 0;
  }

  /* Show hamburger — 44px minimum touch target */
  .mobile-nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
  }

  /* Module / hub context links need ≥44px tap height on phones */
  .sidebar-item {
    min-height: 44px;
    padding-top: 11px;
    padding-bottom: 11px;
  }
  .mobile-nav-toggle:hover {
    background: var(--surface-2);
  }
  .mobile-nav-toggle:active {
    background: var(--surface-3);
    transform: scale(0.96);
  }

  /* Topbar + contextual info: ≥44px hit areas on phones */
  .topbar .icon-btn,
  .topbar-bell,
  .user-menu-trigger-btn {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
  }
  .tenant-switcher-trigger {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0 10px !important;
    box-sizing: border-box;
    border-radius: 10px;
  }
  .tenant-switcher-trigger > svg {
    display: none;
  }
  .topbar .avatar {
    width: 30px;
    height: 30px;
  }
  .info-hint > summary {
    min-width: 24px;
    min-height: 24px;
    display: inline-grid;
    place-items: center;
    position: relative;
  }
  .info-hint > summary::after {
    content: "";
    position: absolute;
    inset: -10px;
  }
  .info-hint-trigger {
    width: 24px;
    height: 24px;
  }

  /* Topbar: hide bulky elements */
  .cmdk-trigger {
    display: none !important;
  }
  .mobile-search-btn {
    display: inline-grid;
    margin-left: auto;
  }
  .breadcrumbs {
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    flex: 1;
  }
  .breadcrumbs > span:not(.breadcrumb-current),
  .breadcrumbs > svg:not(:last-of-type) {
    display: none;
  }
  .breadcrumbs > svg {
    display: none;
  }
  .breadcrumbs .breadcrumb-current {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
  }
  .topbar-actions {
    gap: 2px;
    flex-shrink: 0;
  }
  .topbar-actions > div[style*="border-right"] {
    /* tenant switcher container */
    border-right: 0 !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
  }
  .tenant-switcher-trigger-text,
  .tenant-brand-chip > div,
  .user-menu-trigger-text {
    display: none;
  }
  .topbar-divider {
    display: none;
  }
  .user-menu-trigger-chevron {
    display: none;
  }
  .user-menu-trigger {
    padding: 0 !important;
  }

  /* Page header collapses to stacked layout */
  .page-header {
    padding: 16px 18px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header > * {
    width: 100%;
  }
  .page-header .row {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .page-title {
    font-size: 22px;
  }
  .page-sub {
    font-size: 13px;
  }
  .page-body {
    padding: 18px 16px 28px;
  }
  .subtabs {
    padding: 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .subtabs::-webkit-scrollbar {
    display: none;
  }
  .subtab {
    flex-shrink: 0;
    min-height: 44px;
    padding: 11px 12px;
    font-size: 13px;
    box-sizing: border-box;
  }

  /* Launcher (home) */
  .launcher {
    padding: 22px 16px 32px;
  }
  .launcher-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 22px;
  }
  .launcher-greeting {
    font-size: 26px;
  }
  .launcher-sub {
    font-size: 13.5px;
  }
  .launcher-time {
    text-align: left;
    width: 100%;
  }
  .launcher-time > div:first-child {
    font-size: 18px !important;
  }
  .launcher-block {
    margin-top: 22px;
  }
  .launcher-block-mini {
    margin-top: 26px;
    padding-top: 18px;
  }
  .launcher-block-head {
    gap: 10px;
    margin-bottom: 14px;
  }
  .launcher-block-title {
    font-size: 15px;
  }
  .launcher-block-desc {
    font-size: 12.5px;
  }
  .app-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 26px;
  }
  .app-tile {
    padding: 16px 16px 14px;
  }
  .row-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .section-label {
    font-size: 10.5px;
    margin-bottom: 10px;
  }

  /* KPI grids stack 2x */
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
    margin-bottom: 18px;
  }
  .kpi {
    padding: 14px 14px;
  }
  .kpi-label {
    font-size: 11px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .reembolso-charts {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Tables horizontally scrollable */
  .card {
    overflow: hidden;
  }
  .card:has(> .tbl),
  .card:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tbl th, .tbl td {
    padding: 10px 12px;
    font-size: 12.5px;
  }
  .shell-admin table {
    font-size: 12.5px;
  }
  .shell-admin table th,
  .shell-admin table td {
    padding: 10px 12px;
  }

  /* Chat workspace + composer */
  .chat-messages {
    padding: 18px 14px;
    gap: 16px;
  }
  .msg {
    gap: 10px;
  }
  .chat-composer {
    padding: 12px 14px 16px;
  }
  .composer-box {
    padding: 10px 12px;
  }
  .composer-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .composer-actions .composer-model {
    max-width: 100%;
    flex-basis: 100%;
    order: 99;
  }
  .composer-actions .grow {
    display: none;
  }
  .composer-actions .btn-primary {
    margin-left: auto;
  }
  .chat-suggestions {
    margin-top: 4vh;
    padding: 0 16px;
  }
  .chat-suggestions h2 {
    font-size: 22px;
  }
  .suggestion-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 22px;
  }
  .suggestion-card {
    padding: 14px 16px;
    font-size: 13.5px;
  }

  /* Login */
  .login-stage {
    grid-template-columns: 1fr;
    overflow-y: auto;
    overflow-x: hidden;
    position: static;
    min-height: 100dvh;
    height: auto;
    -webkit-overflow-scrolling: touch;
  }
  .login-stage--auth-only .login-right {
    min-height: auto;
    align-content: start;
    padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
  }
  .login-left {
    padding: 20px 20px 16px;
    min-height: 0;
    max-height: none;
  }
  .login-left h1 {
    font-size: clamp(26px, 7vw, 34px) !important;
  }
  .login-right {
    padding: 16px 18px max(56px, env(safe-area-inset-bottom, 0px));
    place-items: start center;
  }
  .login-form {
    padding: 22px;
    border-radius: 14px;
  }
  .login-form .input {
    min-height: 48px;
    font-size: 16px; /* avoid iOS zoom */
  }
  .login-greet {
    font-size: 22px;
  }
  .login-foot {
    margin-bottom: 8px;
  }

  /* Hub apps form */
  .hub-app-form-grid,
  .hub-app-form-grid-2,
  .hub-app-form-grid-3,
  .hub-app-form-grid-name-slug {
    grid-template-columns: 1fr !important;
  }
  .hub-type-grid {
    grid-template-columns: 1fr !important;
  }

  /* Provider grid / Stack option */
  .provider-grid {
    grid-template-columns: 1fr !important;
  }
  .audit-overview-grid {
    grid-template-columns: 1fr !important;
  }

  /* Engine banner */
  .engine-banner {
    padding: 14px 16px;
  }
  .engine-banner-title {
    font-size: 15px;
  }

  /* Notifications panel */
  .notif-panel {
    width: calc(100vw - 24px) !important;
    right: 12px !important;
    top: 60px !important;
  }

  /* Modal portal nav */
  .standalone-card {
    padding: 22px;
    border-radius: 14px;
  }

  /* Animate less aggressively to avoid horizontal scroll glitches */
  .page {
    animation: none;
  }

  /* Sidebar text wrap protection inside drawer */
  .sidebar-item span:not(.sidebar-item-badge) {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* =========================================================================
   ≤ 640px: PHONE, extra compact + full-screen modals
   ========================================================================= */
@media (max-width: 640px) {
  .page-header {
    padding: 14px 14px 12px;
  }
  .page-body {
    padding: 14px 12px 26px;
  }
  .page-title {
    font-size: 20px;
  }

  .launcher {
    padding: 18px 12px 28px;
  }
  .launcher-greeting {
    font-size: 22px;
  }

  /* KPIs - cleaner 2-col with tighter spacing */
  .reembolso-kpis,
  .kpi-grid {
    gap: 8px;
  }
  .kpi {
    padding: 12px;
  }
  .kpi-value {
    font-size: 20px;
  }

  /* Subtle btn shrink */
  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .btn-lg {
    padding: 10px 16px;
    font-size: 13.5px;
  }

  /* Modals slide-up sheet style */
  .modal-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal-panel,
  .modal-panel-lg,
  .modal-panel-xl {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px 18px 26px;
    animation: mobileSheetIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes mobileSheetIn {
    from {
      transform: translateY(100%);
      opacity: 0.85;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Settings rows stack */
  .settings-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .settings-row-control {
    justify-content: flex-start;
  }

  /* Sub-tabs full row — keep horizontal margins in sync with page-body
     padding so the first/last settings tab is not clipped. */
  .subtabs {
    padding: 0 12px;
  }
  .settings-inline-tabs.subtabs {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Command palette */
  .cmdk-backdrop {
    padding-top: 4vh;
  }
  .cmdk {
    width: calc(100vw - 20px);
  }
  .cmdk-input {
    padding: 14px 16px 14px 44px;
    font-size: 14px;
  }

  /* Chat avatars smaller */
  .msg-avatar {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  .msg-body {
    font-size: 14px;
    line-height: 1.55;
  }

  /* Suggestion cards in 1-col already */
  .suggestion-grid {
    margin-top: 18px;
  }
}

/* =========================================================================
   ≤ 480px: SMALL PHONE, hide non-essential composer controls etc.
   ========================================================================= */
@media (max-width: 480px) {
  .composer-actions .icon-btn[title*="Anexar"],
  .composer-actions .icon-btn[title*="Busca"] {
    display: none;
  }
  .composer-actions .composer-model {
    max-width: 100%;
  }
  .launcher-greeting {
    font-size: 20px;
  }
  .page-title {
    font-size: 18px;
  }
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Reembolso detail panel specifics */
.reembolso-detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.reembolso-detail-close {
  display: none;
}
.reembolso-detail-backdrop {
  display: none;
}
@media (max-width: 1100px) {
  .reembolso-detail-close {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 0;
    color: var(--ink-2);
    cursor: pointer;
  }
  .reembolso-detail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(13, 20, 16, 0.42);
    backdrop-filter: blur(2px);
    z-index: 77;
    border: 0;
    padding: 0;
    cursor: pointer;
    animation: mobileNavFadeIn 0.2s ease;
  }
}
@media (max-width: 640px) {
  .reembolso-detail-fields {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .reembolso-shell-detail {
    width: 100vw !important;
  }
}

/* ------- Chat history mobile drawer fix (≤ 900px overrides legacy 1024px) ------- */
@media (max-width: 900px) {
  .chat-history {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    width: min(320px, 88vw) !important;
    transform: translateX(-100%) !important;
    z-index: 84;
    box-shadow: 6px 0 22px rgba(15, 30, 20, 0.18);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .chat-history--open {
    transform: translateX(0) !important;
  }
  .chat-history-backdrop {
    z-index: 83;
  }
  .chat-workspace {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================================
   Reembolso detail panel - mobile-first design with sticky header/actions
   ========================================================================= */
.detail-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--surface);
}
.reembolso-shell-detail .detail-panel {
  height: 100%;
  max-height: 100%;
}

/* Topbar appears only on mobile drawer overlay */
.detail-panel-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.detail-panel-topbar-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.detail-panel-back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}
.detail-panel-back:hover {
  background: var(--surface-2);
}

/* Hero card */
.detail-panel-hero {
  padding: 22px 22px 18px;
  background: linear-gradient(
    180deg,
    var(--brand-soft) 0%,
    color-mix(in srgb, var(--brand-soft) 35%, var(--surface)) 100%
  );
  border-bottom: 1px solid
    color-mix(in srgb, var(--brand-soft-2) 60%, var(--line));
}
.detail-panel-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.detail-panel-protocol {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--brand);
  padding: 4px 9px;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--brand-soft-2);
  font-weight: 600;
}
.detail-panel-status-chip {
  margin-left: auto;
}
.detail-panel-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.detail-panel-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-panel-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.detail-panel-meta-line .mono {
  color: var(--ink-2);
}
.detail-panel-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-4);
}
.detail-panel-link-btn {
  width: 100%;
  justify-content: center;
  background: var(--surface);
  border-color: var(--brand-soft-2);
  color: var(--brand);
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
}
.detail-panel-link-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand-3);
}

/* Body sections */
.detail-panel-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.detail-panel-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.detail-panel-section-title {
  margin: 0 0 14px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-panel-section-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 11px;
}
.detail-panel-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.detail-panel-fields > * {
  min-width: 0;
}

.detail-panel-pendencia {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 13px;
  line-height: 1.5;
}
.detail-panel-pendencia-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.detail-panel-pendencia-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.detail-panel-suggestion {
  padding: 16px 18px;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--brand-soft) 0%,
    color-mix(in srgb, var(--brand-soft-2) 65%, var(--surface)) 100%
  );
  border: 1px solid var(--brand-soft-2);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.detail-panel-suggestion-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-panel-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

.detail-panel-doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-panel-doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.detail-panel-doc-item:hover {
  background: var(--surface);
  border-color: var(--line);
}
.detail-panel-doc-icon {
  font-size: 18px !important;
  color: var(--brand);
  flex-shrink: 0;
}
.detail-panel-doc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

/* Timeline */
.detail-panel-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-panel-timeline-item {
  position: relative;
  padding-left: 22px;
  display: grid;
  grid-template-columns: auto 1fr;
}
.detail-panel-timeline-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: -14px;
  width: 2px;
  background: var(--line);
}
.detail-panel-timeline-item:last-child::before {
  display: none;
}
.detail-panel-timeline-dot {
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-2);
}
.detail-panel-timeline-item[data-active="true"] .detail-panel-timeline-dot {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.detail-panel-timeline-status {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.detail-panel-timeline-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.detail-panel-timeline-note {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.5;
}

/* Action bar - desktop default (inline at end of body) */
.detail-panel-actions {
  display: flex;
  gap: 8px;
  margin: 8px 18px 18px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}
.detail-panel-action-spacer {
  display: none;
}
.detail-panel-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 10px 14px;
}
.detail-panel-action-approve {
  flex: 1.4 !important;
}

/* =========================================================================
   ≤ 1100px: Drawer overlay mode - sticky header & sticky bottom actions
   ========================================================================= */
@media (max-width: 1100px) {
  .detail-panel {
    height: 100vh;
    min-height: 100vh;
  }
  .detail-panel-topbar {
    display: flex;
  }
  .detail-panel-status-chip {
    display: none;
  }
  .detail-panel-hero {
    padding: 18px 18px 16px;
  }
  .detail-panel-body {
    padding: 16px 14px 14px;
  }
  .detail-panel-section {
    padding: 14px 16px;
  }

  .detail-panel-actions {
    position: sticky;
    bottom: 0;
    margin: 0;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }
  .detail-panel-action-spacer {
    display: block;
    height: 8px;
  }
}

/* =========================================================================
   ≤ 640px: Phone - single column fields, tighter spacing
   ========================================================================= */
@media (max-width: 640px) {
  .detail-panel-hero {
    padding: 18px 16px 16px;
  }
  .detail-panel-name {
    font-size: 16px;
  }
  .detail-panel-fields {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .detail-panel-body {
    gap: 12px;
    padding: 14px 12px 12px;
  }
  .detail-panel-section {
    padding: 14px;
    border-radius: 12px;
  }
  .detail-panel-actions {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .detail-panel-action-deny {
    flex: 0 0 auto !important;
    padding: 10px 12px !important;
  }
}

/* =========================================================================
   KPI grid: auto-fit so cards never get crushed when sidebars/details are open
   ========================================================================= */
.reembolso-kpis {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
}
.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.kpi {
  min-width: 0;
}
.kpi-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 380px) {
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Allow KPI values to wrap if needed, prevent truncation of important numbers */
.kpi-value {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.1;
  font-size: clamp(20px, 2.4vw, 30px);
  word-break: keep-all;
}
.kpi-label {
  /* Allow label to wrap to 2 lines max instead of being cut */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
}
/* Slightly higher min so we don't cram 4 cards in <600px */
.reembolso-kpis,
.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
}

@media (max-width: 900px) {
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .kpi-value {
    font-size: 22px;
  }
}
@media (max-width: 380px) {
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================================
   KPI grid: clean column counts (1 → 2 → 4) instead of awkward 3+1 wrap
   ========================================================================= */
.reembolso-kpis,
.kpi-grid {
  grid-template-columns: 1fr !important;
}
@media (min-width: 480px) {
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
/* When viewport is wide enough that both detail panel AND 4 KPI cols can coexist */
@media (min-width: 1500px) {
  .reembolso-kpis,
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
/* Kanban view: no detail panel, allow 4 cols sooner */
.reembolso-shell:not(.reembolso-shell-split) .reembolso-kpis {
  /* Reembolso shell only adds the detail panel container when in table view.
     When kanban view (no .reembolso-shell-detail), the main fills full width. */
}

/* ====== Hub settings: hide duplicate tabs when sidebar owns CONFIGURAÇÃO ====== */
@media (min-width: 1280px) {
  html:not([data-sidebar-collapsed="true"])
    .settings-page:has(#settings-tab-hub-branding)
    > nav.settings-inline-tabs {
    display: none;
  }
  .settings-page
    #settings-tab-hub-branding:checked
    ~ .settings-tab-panels
    [data-panel="hub-branding"],
  .settings-page
    #settings-tab-modules:checked
    ~ .settings-tab-panels
    [data-panel="modules"],
  .settings-page
    #settings-tab-hub-apps:checked
    ~ .settings-tab-panels
    [data-panel="hub-apps"],
  .settings-page
    #settings-tab-hub-platform:checked
    ~ .settings-tab-panels
    [data-panel="hub-platform"] {
    padding-top: 4px;
  }
}

/* Mobile/tablet: segment-style settings switcher */
@media (max-width: 1279px) {
  .settings-inline-tabs.subtabs {
    display: flex;
    gap: 4px;
    margin: 0 0 16px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--ink) 4%, var(--surface));
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Edge fades (data-overflow set by SettingsTabBar) signal more tabs. */
    --settings-tab-fade: 28px;
  }
  .settings-inline-tabs.subtabs::-webkit-scrollbar {
    display: none;
  }
  .settings-inline-tabs.subtabs[data-overflow="right"] {
    -webkit-mask-image: linear-gradient(
      to right,
      #000 0%,
      #000 calc(100% - var(--settings-tab-fade)),
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      #000 0%,
      #000 calc(100% - var(--settings-tab-fade)),
      transparent 100%
    );
  }
  .settings-inline-tabs.subtabs[data-overflow="left"] {
    -webkit-mask-image: linear-gradient(
      to left,
      #000 0%,
      #000 calc(100% - var(--settings-tab-fade)),
      transparent 100%
    );
    mask-image: linear-gradient(
      to left,
      #000 0%,
      #000 calc(100% - var(--settings-tab-fade)),
      transparent 100%
    );
  }
  .settings-inline-tabs.subtabs[data-overflow="both"] {
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      #000 var(--settings-tab-fade),
      #000 calc(100% - var(--settings-tab-fade)),
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0%,
      #000 var(--settings-tab-fade),
      #000 calc(100% - var(--settings-tab-fade)),
      transparent 100%
    );
  }
  .settings-inline-tabs .subtab {
    flex: 1 0 auto;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-bottom: 0 !important;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }
  .settings-page
    #settings-tab-hub-branding:checked
    ~ nav
    label[for="settings-tab-hub-branding"],
  .settings-page
    #settings-tab-modules:checked
    ~ nav
    label[for="settings-tab-modules"],
  .settings-page
    #settings-tab-hub-apps:checked
    ~ nav
    label[for="settings-tab-hub-apps"],
  .settings-page
    #settings-tab-hub-platform:checked
    ~ nav
    label[for="settings-tab-hub-platform"] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.06));
    border-bottom-color: transparent;
  }
}

/* ====== Hub toggle ====== */
.hub-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.hub-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.hub-toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 14%, var(--surface));
  border: 1px solid var(--line);
  transition: background 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}
.hub-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}
.hub-toggle input:checked + .hub-toggle-switch {
  background: var(--brand);
  border-color: var(--brand);
}
.hub-toggle input:checked + .hub-toggle-switch::after {
  transform: translateX(18px);
}
.hub-toggle input:disabled + .hub-toggle-switch {
  opacity: 0.45;
  cursor: not-allowed;
}
.hub-toggle input:focus-visible + .hub-toggle-switch {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: 2px;
}

/* ====== Modules manager ====== */
.modules-manager {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modules-manager-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (min-width: 768px) {
  .modules-manager-head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}
.modules-manager-intro {
  min-width: 0;
  flex: 1;
}
.modules-manager-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42rem;
}
.modules-info-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}
.modules-info-callout .material-icons-round {
  color: var(--brand);
  font-size: 18px;
  margin-top: 1px;
}

.modules-tenant-picker {
  position: relative;
  min-width: min(100%, 280px);
}
.modules-tenant-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.04));
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.modules-tenant-trigger:hover,
.modules-tenant-trigger[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.06));
}
.modules-tenant-trigger-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  color: var(--brand);
  font-size: 20px;
}
.modules-tenant-trigger-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.modules-tenant-trigger-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.modules-tenant-trigger-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modules-tenant-trigger-chevron {
  color: var(--muted);
  font-size: 20px;
}
.modules-tenant-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  min-width: 260px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.12));
}
.modules-tenant-group + .modules-tenant-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.modules-tenant-group-label {
  padding: 4px 8px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.modules-tenant-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.modules-tenant-option:hover,
.modules-tenant-option.is-active {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}
.modules-tenant-option-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 20%, transparent);
  flex-shrink: 0;
}
.modules-tenant-option.is-active .modules-tenant-option-dot {
  background: var(--brand);
}
.modules-tenant-option-label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modules-tenant-dept-badge {
  font-size: 10px !important;
}
.modules-tenant-parent-chip {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.modules-session-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--line));
  background: color-mix(in srgb, #f59e0b 10%, var(--surface));
  font-size: 13px;
  color: var(--ink);
}
.modules-session-banner .material-icons-round {
  color: #d97706;
  font-size: 20px;
}
.modules-session-banner-text {
  flex: 1;
  min-width: 180px;
  line-height: 1.4;
}

.modules-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .modules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

.module-lic-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.04));
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}
.module-lic-card.is-active {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--brand) 6%, var(--surface)) 0%,
    var(--surface) 48%
  );
  box-shadow: 0 8px 24px -16px color-mix(in srgb, var(--brand) 55%, transparent);
}
.module-lic-card.is-registry-off {
  opacity: 0.72;
}
.module-lic-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.module-lic-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--brand);
}
.module-lic-icon .material-icons-round {
  font-size: 22px;
}
.module-lic-meta {
  min-width: 0;
  flex: 1;
}
.module-lic-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.module-lic-desc {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.module-lic-toggle {
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.module-lic-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.module-lic-card.is-active .module-lic-status {
  color: var(--brand);
}
.module-lic-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, #f59e0b 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #f59e0b 28%, var(--line));
  font-size: 12px;
  color: #92400e;
}
.module-lic-warn .material-icons-round {
  font-size: 16px;
  margin-top: 1px;
}
.module-lic-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.module-lic-advanced {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.module-lic-foot .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
}
.module-lic-settings textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 12px;
  font-size: 12px;
}
.modules-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}
.modules-empty-icon {
  font-size: 40px;
  color: color-mix(in srgb, var(--brand) 35%, var(--muted));
}

/* ====== Hub users ====== */
.main:has(.hub-users) .page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main:has(.hub-users) .page-header {
  flex-shrink: 0;
}
.main:has(.hub-users) .page-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hub-users {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.hub-users-banner {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #854d0e;
  font-size: 13px;
}
.hub-users-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}
.hub-users-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}
.hub-users-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 65%, var(--surface));
}
.hub-users-list-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
}
.hub-users-list-head h2 {
  margin: 0;
  font-size: 18px;
}
.hub-users-list-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.hub-users-list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}
.hub-users-list-body ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hub-user-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.hub-user-row:hover,
.hub-user-row.is-active {
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
}
.hub-user-row.is-draft {
  outline: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
}
.hub-user-row strong,
.hub-user-row small {
  display: block;
}
.hub-user-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.hub-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--brand) 16%, var(--surface));
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
}
.hub-users-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 24px;
}
.hub-users-detail-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.hub-users-detail-head p {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.hub-users-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 20px 0 16px;
}
.hub-users-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
}
.hub-users-form input {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
}
.hub-users-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.hub-users-preset {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.hub-users-preset.is-active {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: var(--brand);
}
.hub-users-modules {
  display: grid;
  gap: 12px;
}
.hub-users-module {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 40%, var(--surface));
  overflow: hidden;
}
.hub-users-module header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.hub-users-module header .material-icons-round {
  color: var(--brand);
}
.hub-users-module h3 {
  margin: 0;
  font-size: 15px;
}
.hub-users-module header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.hub-users-module ul {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  gap: 4px;
}
.hub-users-perm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.hub-users-perm:hover {
  background: var(--surface);
}
.hub-users-perm input {
  margin-top: 3px;
  accent-color: var(--brand);
}
.hub-users-perm strong,
.hub-users-perm small {
  display: block;
}
.hub-users-perm small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.hub-users-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .main:has(.hub-users),
  .main:has(.hub-users) .page,
  .main:has(.hub-users) .page-body,
  .hub-users-layout,
  .hub-users-detail {
    overflow: visible;
    height: auto;
    flex: none;
  }
  .main:has(.hub-users) {
    overflow-y: auto;
  }
  .hub-users-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hub-users-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 280px;
  }
}
