:root {
  color-scheme: light;
  --ink: #0A1F44;
  --muted: #5f6b7a;
  --line: rgba(10, 31, 68, 0.1);
  --panel: #ffffff;
  --page: #F5F5F7;
  --soft: #f8fafc;
  --teal: #1E74E6;
  --teal-dark: #0A1F44;
  --mint: rgba(153, 229, 80, 0.16);
  --coral: #F97316;
  --gold: #FACC15;
  --blue: #1E74E6;
  --violet: #A78BFA;
  --accent: #99E550;
  --surface: #111415;
  --on-surface: #F5F5F7;
  --shadow: 0 16px 34px rgba(10, 31, 68, 0.1);
  --shadow-sm: 0 2px 12px rgba(10, 31, 68, 0.08);
  --radius-btn: 4px;
  --radius-card: 8px;
  --radius-panel: 8px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width, 300px) minmax(0, 1fr);
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body[data-authenticated="false"] .sidebar,
body[data-authenticated="false"] .next-action-bar {
  display: none;
}

body[data-authenticated="false"] {
  grid-template-columns: minmax(0, 1fr);
}

body[data-authenticated="false"] .workspace {
  min-height: 100vh;
  padding: 0;
}

body[data-authenticated="false"] .module-page:not(#login) {
  display: none;
}

body[data-authenticated="true"] #login {
  display: none;
}

body.sidebar-collapsed {
  --sidebar-width: 92px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6) 18px;
  background: var(--ink);
  color: var(--on-surface);
  border-right: 1px solid rgba(245, 245, 247, 0.1);
  position: sticky;
  top: 0;
  overflow: hidden auto;
}

.sidebar-top {
  display: grid;
  gap: 18px;
}

.sidebar-bottom {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: 0;
  min-width: 0;
  padding: 2px 2px var(--space-4);
  border-bottom: 1px solid rgba(245, 245, 247, 0.1);
}

.sidebar-toggle {
  margin-left: auto;
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid rgba(245, 245, 247, 0.14);
  border-radius: var(--radius-btn);
  background: rgba(245, 245, 247, 0.08);
  color: var(--on-surface);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.sidebar-toggle:hover {
  border-color: rgba(153, 229, 80, 0.42);
  background: rgba(153, 229, 80, 0.16);
  color: var(--accent);
}

.brand-mark {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-card);
  background: rgba(245, 245, 247, 0.96);
  box-shadow: 0 12px 26px rgba(30, 116, 230, 0.2);
}

.brand-mark img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: var(--on-surface);
  font-family: Lexend, Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.1;
}

.brand span {
  color: rgba(245, 245, 247, 0.68);
  font-size: 13px;
  line-height: 1.2;
}

.brand .brand-mark {
  background: rgba(245, 245, 247, 0.96);
}

.nav-list {
  display: grid;
  gap: var(--space-2);
  margin-bottom: 0;
}

.nav-list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(245, 245, 247, 0.68);
  text-decoration: none;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 650;
}

.nav-list a strong {
  flex: 1;
  min-width: 0;
  font: inherit;
}

.nav-list a em {
  min-width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(245, 245, 247, 0.08);
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  padding: 0 8px;
}

.nav-list a em.is-ok {
  color: #20715f;
  background: #e5f6ef;
}

.nav-list a em.needs-attention {
  color: #8b4d00;
  background: #fff2d8;
}

.nav-list a.active,
.nav-list a:hover {
  background: rgba(153, 229, 80, 0.14);
  color: var(--on-surface);
}

.nav-list a.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
}

.nav-list a span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-btn);
  background: rgba(245, 245, 247, 0.08);
  color: var(--accent);
  text-align: center;
  font-size: 13px;
}

.nav-list a.active span,
.nav-list a:hover span {
  background: rgba(245, 245, 247, 0.12);
  color: var(--accent);
}

.sidebar-panel {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 22px;
}

.sidebar-panel h2 {
  font-size: 14px;
  margin: 0 0 16px;
}

.profile-summary {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.profile-summary-kicker {
  width: fit-content;
  border-radius: 999px;
  background: rgba(153, 229, 80, 0.16);
  color: var(--accent) !important;
  padding: 3px 7px;
  font-size: 10px !important;
  font-weight: 900;
  line-height: 1;
}

.profile-summary strong {
  color: var(--on-surface) !important;
  font-size: 14px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary span,
.profile-summary em,
.profile-summary-purpose {
  color: rgba(245, 245, 247, 0.68) !important;
  font-size: 11px;
  line-height: 1.35;
}

.profile-summary-purpose {
  display: block;
  font-weight: 750;
}

.profile-summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-summary-metrics em {
  width: fit-content;
  border-radius: 999px;
  background: rgba(245, 245, 247, 0.08);
  border: 1px solid rgba(245, 245, 247, 0.1);
  padding: 5px 8px;
  color: var(--accent) !important;
  font-style: normal;
  font-weight: 850;
}

.account-menu summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-card);
  padding: 10px;
  background: rgba(245, 245, 247, 0.06);
  border: 1px solid rgba(245, 245, 247, 0.1);
  box-shadow: none;
}

.account-menu summary::-webkit-details-marker,
.sidebar-drawer summary::-webkit-details-marker {
  display: none;
}

.account-avatar {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-card);
  background: var(--accent);
  color: var(--ink);
  padding: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}

.account-action-button {
  min-height: 38px;
  border: 1px solid rgba(245, 245, 247, 0.1);
  border-radius: var(--radius-card);
  background: rgba(245, 245, 247, 0.06);
  color: var(--on-surface) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  font: inherit;
}

.account-action-button span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-btn);
  background: rgba(153, 229, 80, 0.16);
  color: var(--accent) !important;
  font-size: 12px;
}

.account-action-button strong {
  color: var(--on-surface) !important;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.account-action-button:hover,
.account-action-button.is-active {
  border-color: rgba(153, 229, 80, 0.35);
  background: rgba(153, 229, 80, 0.14);
  box-shadow: none;
}

.sidebar-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 30px;
  cursor: pointer;
  list-style: none;
}

.sidebar-drawer summary span,
.sidebar-drawer summary small {
  color: rgba(245, 245, 247, 0.68);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-drawer summary small {
  border: 1px solid rgba(245, 245, 247, 0.1);
  border-radius: 999px;
  padding: 4px 7px;
  color: rgba(245, 245, 247, 0.68);
  text-transform: none;
}

.quick-access-drawer {
  margin-top: 6px;
  border-top: 1px solid rgba(245, 245, 247, 0.1);
  padding-top: 16px;
}

body[data-role="viewer"] .nav-list a[data-tab="fuentes"],
body[data-role="viewer"] .nav-list a[data-tab="queryBuilder"],
body[data-role="viewer"] .nav-list a[data-tab="gobierno"],
body[data-role="viewer"] .nav-list a[data-tab="perfil"],
body[data-role="viewer"] .topbar-actions,
body[data-role="viewer"] #fuentes,
body[data-role="viewer"] #queryBuilder,
body[data-role="viewer"] #gobierno,
body[data-role="viewer"] #perfil,
body[data-role="viewer"] .dashboard-toolbar,
body[data-role="viewer"] .dashboard-note-box,
body[data-role="viewer"] .dashboard-card label,
body[data-role="viewer"] .dashboard-item-actions,
body[data-role="viewer"] #createDashboard,
body[data-role="viewer"] #saveDashboardWorkspace,
body[data-role="viewer"] #generateAiDashboard,
body[data-role="viewer"] #toggleDashboardEdit,
body[data-role="viewer"] #duplicateDashboard,
body[data-role="viewer"] #shareDashboard,
body[data-role="viewer"] .dashboard-properties,
body[data-role="viewer"] .canvas-toolbar {
  display: none;
}

.sidebar-return-button {
  display: none;
  width: 100%;
  min-height: 34px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.quick-dashboard-list {
  display: grid;
  gap: 8px;
}

.quick-shortcut {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: stretch;
}

.quick-dashboard {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(245, 245, 247, 0.1);
  border-radius: var(--radius-btn);
  background: rgba(245, 245, 247, 0.06);
  color: var(--on-surface);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 750;
}

.quick-dashboard small,
.quick-dashboard span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-dashboard small {
  color: rgba(245, 245, 247, 0.62);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-dashboard:hover {
  background: rgba(153, 229, 80, 0.14);
}

.quick-remove {
  width: 28px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffd6d0;
  cursor: pointer;
  font-weight: 900;
}

.quick-empty {
  display: grid;
  gap: 8px;
}

.quick-empty span {
  color: rgba(245, 245, 247, 0.62);
  font-size: 12px;
  font-weight: 750;
}

body.sidebar-collapsed .sidebar {
  gap: 14px;
  padding: 18px 14px;
  overflow: visible;
}

body.sidebar-collapsed .sidebar-top {
  gap: 18px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
  padding: 0 0 18px;
}

body.sidebar-collapsed .brand > div,
body.sidebar-collapsed .quick-access-drawer,
body.sidebar-collapsed .sidebar-bottom {
  display: none;
}

body.sidebar-collapsed .brand-mark {
  flex-basis: 42px;
  width: 42px;
  height: 42px;
  box-shadow: 0 12px 26px rgba(30, 116, 230, 0.14);
}

body.sidebar-collapsed .brand-mark img {
  width: 33px;
  height: 33px;
}

body.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  top: 62px;
  right: -12px;
  z-index: 75;
  width: 26px;
  min-width: 26px;
  height: 26px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--teal);
  color: #ffffff;
  font-size: 18px;
  box-shadow: 0 10px 20px rgba(10, 31, 68, 0.2);
}

body.sidebar-collapsed .nav-list {
  gap: 12px;
}

body.sidebar-collapsed .nav-list a {
  width: 50px;
  min-height: 50px;
  justify-content: center;
  gap: 0;
  padding: 0;
  border-radius: 16px;
  margin-inline: auto;
}

body.sidebar-collapsed .nav-list a strong {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 80;
  width: max-content;
  max-width: 180px;
  transform: translateY(-50%);
  border: 1px solid rgba(245, 245, 247, 0.12);
  border-radius: var(--radius-btn);
  background: #111415;
  box-shadow: 0 14px 28px rgba(10, 31, 68, 0.26);
  color: var(--on-surface);
  padding: 8px 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

body.sidebar-collapsed .nav-list a:hover strong,
body.sidebar-collapsed .nav-list a:focus-visible strong {
  opacity: 1;
  transform: translate(4px, -50%);
}

body.sidebar-collapsed .nav-list a em {
  display: none;
}

body.sidebar-collapsed .nav-list a.active::before {
  left: -14px;
  height: 26px;
}

body.sidebar-collapsed .nav-list a span {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

body.sidebar-collapsed .nav-list a.active,
body.sidebar-collapsed .nav-list a:hover {
  background: rgba(153, 229, 80, 0.12);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sidebar label {
  color: var(--muted);
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(30, 116, 230, 0.18);
}

input:disabled {
  background: var(--page);
  color: var(--muted);
  cursor: not-allowed;
}

.workspace {
  padding: 48px;
  min-width: 0;
}

.next-action-bar {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.25fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 14px 18px;
  border: 1px solid rgba(30, 116, 230, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(135deg, #ffffff 0%, rgba(153, 229, 80, 0.08) 100%),
    #ffffff;
  box-shadow: 0 18px 42px rgba(10, 31, 68, 0.08);
}

.next-action-copy {
  display: grid;
  gap: 6px;
}

.next-action-bar span {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.next-action-bar strong {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.15;
}

.next-action-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.next-action-bar.is-complete {
  grid-template-columns: minmax(260px, 1fr) auto;
  background: linear-gradient(135deg, #ffffff, rgba(153, 229, 80, 0.06));
}

.next-action-bar.is-complete .workspace-progress {
  display: none;
}

.next-action-bar.is-complete .next-action-copy {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 14px;
}

.next-action-bar.is-complete .next-action-copy span,
.next-action-bar.is-complete .next-action-copy p {
  grid-column: 1 / -1;
}

.workspace-progress {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.workspace-progress-meter {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, #ffffff 0 58%, transparent 59%),
    conic-gradient(var(--accent) var(--workspace-progress), rgba(10, 31, 68, 0.1) 0);
  color: var(--ink);
}

.workspace-progress-meter strong {
  font-size: 14px;
  line-height: 1;
}

.workspace-progress-meter span {
  color: var(--muted);
  font-size: 9px;
}

.workspace-progress-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 6px;
  align-items: center;
}

.workspace-progress-steps button {
  min-height: 30px;
  max-width: 100%;
  border: 1px solid rgba(10, 31, 68, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.workspace-progress-steps button i {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(10, 31, 68, 0.08);
  color: var(--ink);
  font-style: normal;
  line-height: 1;
}

.workspace-progress-steps button.is-done {
  border-color: rgba(153, 229, 80, 0.52);
  background: rgba(153, 229, 80, 0.14);
  color: var(--ink);
}

.workspace-progress-steps button.is-done i {
  background: var(--accent);
}

.next-action-cta {
  min-width: 150px;
  white-space: nowrap;
}

.viewer-header {
  display: grid;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  font-family: Lexend, Inter, ui-sans-serif, system-ui, sans-serif;
}

h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 28px;
  font-weight: 650;
  line-height: 1.18;
}

.topbar-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, auto));
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.topbar-actions .secondary-button,
.topbar-actions .primary-button {
  min-height: 42px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
}

body:not([data-active-tab="queryBuilder"]) .topbar-actions {
  display: none;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: var(--radius-btn);
  cursor: pointer;
  min-height: 44px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-button {
  padding: 0 18px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(153, 229, 80, 0.24);
}

.primary-button:hover {
  background: #b5ff6b;
  box-shadow: 0 10px 24px rgba(153, 229, 80, 0.3);
}

.secondary-button {
  padding: 0 16px;
  background: white;
  color: var(--teal);
  border: 1px solid rgba(30, 116, 230, 0.32);
  font-weight: 750;
}

.secondary-button:hover {
  border-color: var(--teal);
  background: rgba(30, 116, 230, 0.08);
}

.secondary-button[aria-pressed="true"] {
  border-color: rgba(153, 229, 80, 0.65);
  background: var(--mint);
  color: var(--ink);
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(10, 31, 68, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.wide {
  width: 100%;
}

.icon-button {
  width: 42px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 20px;
}

.builder,
.viewer,
.report-library,
.upload-band,
.source-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}

.module-section {
  margin-bottom: var(--space-6);
}

.module-page {
  display: none;
}

.module-page.active {
  display: block;
  content-visibility: auto;
  contain-intrinsic-size: 900px;
}

.login-page {
  min-height: 100vh;
  padding: clamp(28px, 5vw, 72px);
  background:
    radial-gradient(circle at 15% 18%, rgba(153, 229, 80, 0.18), transparent 28%),
    linear-gradient(135deg, #0A1F44 0%, #111827 52%, #F5F5F7 52%);
}

.login-shell {
  width: min(1120px, 100%);
  min-height: calc(100vh - clamp(56px, 10vw, 144px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  gap: 20px;
  align-items: center;
}

.login-card,
.login-side-card {
  border: 1px solid rgba(10, 31, 68, 0.12);
  border-radius: var(--radius-panel);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 28px;
  padding: clamp(28px, 5vw, 56px);
}

.login-card h1 {
  max-width: 680px;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.login-card p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-divider {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-divider::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 1px;
  background: var(--line);
}

.login-divider span {
  position: relative;
  background: white;
  padding: 0 10px;
}

.google-login-zone {
  display: grid;
  gap: 10px;
}

.google-signin-slot {
  min-height: 44px;
  display: grid;
  align-items: center;
}

body[data-google-only-login="true"] .login-form > label,
body[data-google-only-login="true"] #loginButton,
body[data-google-only-login="true"] .login-divider {
  display: none;
}

.local-first-notice {
  border: 1px solid rgba(30, 116, 230, 0.18);
  border-radius: var(--radius-card);
  background: rgba(30, 116, 230, 0.08);
  color: var(--ink);
  padding: 14px;
  display: grid;
  gap: 6px;
}

.local-first-notice strong {
  font-size: 14px;
  color: var(--ink);
}

.local-first-notice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.login-start-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.login-start-grid span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-btn);
  background: rgba(18, 121, 111, 0.12);
  color: var(--teal);
  font-weight: 900;
}

.login-start-grid strong {
  color: var(--ink);
  font-size: 14px;
}

.login-start-grid p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.login-side-card {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.login-profile-list,
.user-list {
  display: grid;
  gap: 10px;
}

.login-profile-card,
.user-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #ffffff;
  padding: 14px;
}

.login-profile-card {
  display: grid;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.login-profile-card strong,
.user-row strong {
  color: var(--ink);
  font-size: 15px;
}

.login-profile-card span,
.user-row span {
  color: var(--muted);
  font-size: 13px;
}

.login-profile-card:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow-sm);
}

.user-management {
  display: grid;
  gap: 14px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.user-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body:not([data-account-role="owner"]) #userManagementPanel .profile-form-grid,
body:not([data-account-role="owner"]) #createUserButton {
  display: none;
}

.module-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: 18px;
}

.module-header p:last-child,
.section-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

#fuentes .module-header,
#queryBuilder .module-header {
  grid-template-columns: minmax(360px, 1fr) minmax(320px, auto);
  align-items: end;
  gap: 20px;
}

#fuentes .module-header > div:first-child,
#queryBuilder .module-header > div:first-child {
  min-width: 0;
  max-width: 880px;
}

#fuentes .module-header p:last-child,
#queryBuilder .module-header p:last-child {
  max-width: 820px;
}

#queryBuilder .module-header h2,
#fuentes .module-header h2 {
  font-size: 34px;
  line-height: 1.05;
}

#queryBuilder .module-header .eyebrow,
#fuentes .module-header .eyebrow {
  margin-bottom: 8px;
}

.module-status {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e8edf7;
  color: #254f8a;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 850;
}

.module-status.status-draft {
  background: #fff4df;
  color: #8a5a00;
}

.module-status.status-saved {
  background: #dcf4ed;
  color: var(--teal-dark);
}

.module-status.status-shared {
  background: #e8edf7;
  color: #254f8a;
}

.module-actions {
  display: grid;
  grid-template-columns: auto;
  align-items: stretch;
  justify-content: flex-end;
  justify-items: end;
  gap: 9px;
  min-width: 220px;
}

.module-actions .primary-button,
.module-actions .secondary-button {
  width: 100%;
  min-width: 190px;
}

#fuentes .module-actions #openSourceModal {
  display: none;
}

.source-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr) minmax(240px, 1fr);
  gap: 14px;
}

.source-table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.source-table-card .section-title {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.source-table-card .section-title h2 {
  font-size: 28px;
  line-height: 1.1;
}

.sources-entry-band {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border-color: rgba(30, 116, 230, 0.16);
  background:
    linear-gradient(135deg, rgba(30, 116, 230, 0.08), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.sources-entry-band::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(30, 116, 230, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(30, 116, 230, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.58), transparent 72%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.58), transparent 72%);
}

.sources-entry-band > * {
  position: relative;
  z-index: 1;
}

.sources-entry-band h2 {
  margin: 0;
  max-width: 760px;
  font-size: 24px;
  line-height: 1.15;
}

.sources-entry-band p:last-child {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.source-entry-actions {
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

.source-entry-actions .primary-button,
.source-entry-actions .secondary-button {
  width: 100%;
  min-height: 42px;
}

.source-card {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  box-shadow: none;
}

.source-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.source-card strong {
  color: var(--ink);
}

.source-card span,
.source-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.source-card .source-help {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-wizard {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 14px 0 18px;
  border-bottom: 1px solid rgba(10, 31, 68, 0.12);
  overflow-x: auto;
}

.source-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 14px;
}

.source-steps span {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.source-steps strong {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  font-size: 11px;
}

.source-type-button {
  min-height: 48px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 20px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.source-type-button.active {
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--ink);
}

.source-modal-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(240px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.source-config-column {
  min-width: 0;
}

.source-card-icon {
  width: fit-content;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.source-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.source-action-row button {
  width: 100%;
}

.source-guidance {
  position: sticky;
  top: 0;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 16px;
}

.source-guidance > strong {
  color: var(--ink);
}

.source-guidance ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.source-guidance-callout {
  display: grid;
  gap: 5px;
  border: 1px solid #f0d8b5;
  border-radius: 8px;
  background: #fff8ec;
  color: #7a5200;
  padding: 12px;
}

.source-guidance-callout span {
  color: #7a5200;
  font-size: 12px;
  line-height: 1.45;
}

.modal-backdrop[data-source-mode="file"] .source-mode-card:not([data-source-card="file"]),
.modal-backdrop[data-source-mode="paste"] .source-mode-card:not([data-source-card="paste"]),
.modal-backdrop[data-source-mode="sheets"] .source-mode-card:not([data-source-card="sheets"]),
.modal-backdrop[data-source-mode="api"] .source-mode-card:not([data-source-card="api"]) {
  display: none;
}

.modal-backdrop[data-source-mode="paste"] .source-modal-layout {
  grid-template-columns: minmax(0, 1fr);
}

.modal-backdrop[data-source-mode="paste"] .source-guidance {
  display: none;
}

.paste-source-card {
  min-height: 0;
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.paste-import-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items: end;
}

.paste-import-header > div {
  display: grid;
  gap: 10px;
}

.paste-import-header strong {
  font-size: 24px;
  line-height: 1.12;
}

.paste-import-disclaimer {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(10, 31, 68, 0.12);
  border-radius: 12px;
  background: #f8fafc;
  padding: 18px;
}

.paste-import-disclaimer strong {
  color: var(--ink);
  font-size: 17px;
}

.paste-import-disclaimer span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.paste-editor-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.paste-editor-shell {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  min-height: min(46vh, 430px);
  border: 1px solid rgba(10, 31, 68, 0.18);
  border-radius: 12px;
  background: #1f2933;
  overflow: hidden;
}

.paste-line-gutter {
  display: block;
  padding: 14px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.42);
  font: 13px/1.55 "SFMono-Regular", Consolas, monospace;
  text-align: center;
  user-select: none;
}

.paste-source-card textarea {
  min-height: min(46vh, 430px);
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: #242a30;
  color: rgba(255, 255, 255, 0.9);
  padding: 14px 12px;
  font: 13px/1.55 "SFMono-Regular", Consolas, monospace;
  tab-size: 16;
  white-space: pre;
  overflow: auto;
  outline: 0;
}

.paste-source-card textarea:focus {
  outline: 0;
  box-shadow: inset 0 0 0 2px rgba(153, 229, 80, 0.38);
}

.paste-source-card textarea::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.source-preview-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

.source-preview-empty,
.source-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.source-preview-empty {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.source-preview-header strong,
.source-preview-empty strong {
  color: var(--ink);
}

.source-preview-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.source-preview-header em {
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 5px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.source-preview-columns,
.source-health,
.source-preview-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 0;
}

.source-preview-columns span,
.source-health span,
.source-preview-checklist span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
}

.source-quality-card {
  display: grid;
  gap: 5px;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 10px;
}

.source-quality-card > div:first-child {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 4px;
}

.source-quality-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 0.95;
}

.source-quality-score span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.source-quality-card span,
.source-quality-card li,
.source-quality-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.source-quality-card em {
  width: fit-content;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 4px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.source-quality-card.quality-medio em {
  background: #fff4d8;
  color: #8a5a00;
}

.source-quality-card.quality-bajo em {
  background: #ffe9e2;
  color: #9b3328;
}

.source-quality-card ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  max-height: 76px;
  overflow: hidden;
}

.quality-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quality-type-row span {
  border-radius: 999px;
  background: var(--soft);
  padding: 4px 7px;
  font-weight: 850;
}

.source-preview-table {
  margin-top: 12px;
}

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

.system-health-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.system-health-summary article {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #ffffff;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.system-health-summary strong,
.system-health-summary span {
  display: block;
}

.system-health-summary strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.system-health-summary span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.system-health-summary article.ok {
  border-color: #c9efe2;
}

.system-health-summary article.warning,
.quality-grid article.quality-atencion {
  border-color: #ffe0a6;
  background: #fffaf0;
}

.system-health-summary article.critical,
.quality-grid article.quality-critico {
  border-color: #ffc8bd;
  background: #fff5f2;
}

.quality-grid article.quality-ok {
  border-color: #c9efe2;
  background: #fbfffd;
}

.governance-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: white;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.governance-card.wide-card {
  grid-column: 1 / -1;
}

.integration-grid,
.quality-grid,
.ai-feature-grid,
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.integration-card,
.quality-grid article,
.ai-feature-grid article,
.template-card,
.governance-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.integration-card,
.template-card {
  display: grid;
  gap: 8px;
}

.integration-card span,
.quality-grid em,
.template-card span,
.governance-list span,
.governance-output span,
.ai-feature-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.integration-card span.is-ready {
  color: var(--teal-dark);
}

.quality-grid article {
  display: grid;
  gap: 4px;
}

.quality-grid strong {
  color: var(--ink);
  font-size: 22px;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.profile-section-tabs {
  position: sticky;
  top: 12px;
  z-index: 22;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  padding: 8px;
}

.profile-section-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 850;
}

.profile-section-tabs button.active,
.profile-section-tabs button:hover {
  background: var(--mint);
  color: var(--teal-dark);
}

.profile-module[data-profile-view="perfil"] [data-profile-panel]:not([data-profile-panel="perfil"]),
.profile-module[data-profile-view="preferencias"] [data-profile-panel]:not([data-profile-panel="preferencias"]),
.profile-module[data-profile-view="permisos"] [data-profile-panel]:not([data-profile-panel="permisos"]),
.profile-module[data-profile-view="seguridad"] [data-profile-panel]:not([data-profile-panel="seguridad"]),
.profile-module[data-profile-view="workspace"] [data-profile-panel]:not([data-profile-panel="workspace"]) {
  display: none;
}

.profile-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-card.wide-card,
.profile-hero-card {
  grid-column: 1 / -1;
}

.profile-hero-card {
  display: grid;
  gap: 16px;
}

.profile-health-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  align-items: stretch;
  border: 1px solid rgba(30, 116, 230, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(153, 229, 80, 0.12) 0%, #ffffff 72%);
  padding: 14px;
}

.profile-health-panel > div:first-child {
  display: grid;
  align-content: center;
  gap: 4px;
}

.profile-health-panel strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.profile-health-panel span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 750;
}

.profile-health-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.profile-health-checks article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.profile-health-checks article::before {
  content: "";
  display: block;
  width: 26px;
  height: 4px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: var(--gold);
}

.profile-health-checks article.is-ok::before {
  background: var(--teal);
}

.profile-health-checks article.needs-attention {
  background: #fffdf7;
}

.profile-health-checks strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.profile-health-checks .ghost-button {
  width: fit-content;
  margin-top: 8px;
}

.preference-preview {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--soft);
  padding: 14px;
}

.preference-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preference-preview-head strong {
  color: var(--ink);
}

.mini-chart-preview {
  width: 112px;
  height: 58px;
  display: flex;
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: white;
  padding: 8px;
}

.mini-chart-preview span {
  flex: 1;
  border-radius: 5px 5px 0 0;
  background: var(--preview-color, var(--teal));
}

.mini-chart-preview span:nth-child(1) {
  height: 45%;
  opacity: 0.65;
}

.mini-chart-preview span:nth-child(2) {
  height: 80%;
}

.mini-chart-preview span:nth-child(3) {
  height: 58%;
  opacity: 0.8;
}

.preference-control-group {
  display: grid;
  gap: 8px;
}

.preference-control-group > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.preference-control-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preference-control-group button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: white;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  font-weight: 800;
}

.preference-control-group button .palette-mini-strip {
  display: flex;
  gap: 3px;
  margin-top: 5px;
}

.preference-control-group button .palette-mini-strip i {
  display: block;
  width: 16px;
  height: 4px;
  border-radius: 999px;
}

.preference-control-group button.active {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal-dark);
}

.preference-control-group .color-swatch {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.palette-editor {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: var(--radius-card);
  background: white;
  padding: 12px;
}

.palette-editor > div:first-child {
  display: grid;
  gap: 6px;
}

.palette-editor span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.palette-editor input[type="text"],
.palette-editor input:not([type]) {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-weight: 800;
  min-height: 38px;
  padding: 0 10px;
}

.palette-color-inputs {
  display: grid;
  grid-template-columns: repeat(5, minmax(42px, 1fr));
  gap: 8px;
}

.palette-color-inputs label {
  display: grid;
  gap: 5px;
}

.palette-color-inputs input[type="color"] {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 3px;
}

.profile-hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar-large {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-size: 22px;
  font-weight: 900;
}

.profile-hero-head h2,
.profile-hero-head p {
  margin: 0;
}

.profile-hero-head span {
  color: var(--muted);
  font-weight: 750;
}

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

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

.profile-kpi-strip article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.profile-kpi-strip strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-kpi-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.profile-action-strip .secondary-button {
  min-height: 40px;
}

body[data-density="compact"] .workspace {
  padding: 32px;
}

body[data-density="compact"] .next-action-bar,
body[data-density="compact"] .module-header,
body[data-density="compact"] .upload-band,
body[data-density="compact"] .source-table-card,
body[data-density="compact"] .builder,
body[data-density="compact"] .viewer,
body[data-density="compact"] .report-library,
body[data-density="compact"] .dashboard-workspace,
body[data-density="compact"] .profile-card,
body[data-density="compact"] .governance-card {
  padding: 14px;
}

body[data-density="compact"] .module-header {
  margin-bottom: 12px;
}

body[data-density="compact"] .module-header h2,
body[data-density="compact"] #queryBuilder .module-header h2,
body[data-density="compact"] #fuentes .module-header h2 {
  font-size: 28px;
}

body[data-density="compact"] .module-header p:last-child,
body[data-density="compact"] .section-copy {
  font-size: 14px;
}

body[data-density="compact"] .source-diagnostics,
body[data-density="compact"] .system-health-summary,
body[data-density="compact"] .profile-kpi-strip,
body[data-density="compact"] .dashboard-storage-summary {
  gap: 6px;
  margin-block: 8px 12px;
}

body[data-density="compact"] .source-item,
body[data-density="compact"] .dashboard-card,
body[data-density="compact"] .query-step {
  padding: 12px;
}

body[data-density="compact"] .chart-canvas {
  padding: 12px;
}

@media (max-width: 680px) {
  body[data-density="compact"] .workspace {
    padding: 18px 18px 88px;
  }
}

.checkbox-label {
  display: flex;
  align-items: center;
  min-height: 52px;
  gap: 8px;
  color: var(--ink);
  font-weight: 850;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.permission-grid,
.security-grid,
.profile-activity-list,
.profile-shared-list {
  display: grid;
  gap: 10px;
}

.permission-card,
.security-grid article,
.profile-activity-list article,
.profile-shared-list article,
.member-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.permission-card,
.security-grid article,
.profile-activity-list article,
.profile-shared-list article {
  display: grid;
  gap: 5px;
}

.permission-card strong,
.security-grid strong,
.profile-activity-list strong,
.profile-shared-list strong {
  color: var(--ink);
  line-height: 1.2;
}

.permission-card {
  border-left: 4px solid var(--teal);
}

.security-grid article {
  border-left: 4px solid var(--blue);
}

.profile-activity-list article {
  grid-template-columns: minmax(86px, 0.3fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
}

.profile-activity-list article p {
  grid-column: 2;
}

.profile-activity-list article em {
  justify-self: end;
}

.permission-card span,
.security-grid span,
.profile-activity-list span,
.profile-activity-list p,
.profile-activity-list em,
.profile-shared-list span,
.profile-shared-list code,
.member-list span,
.organization-summary span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.profile-activity-list p {
  margin: 0;
}

.profile-shared-list code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.shared-link-actions .secondary-button {
  min-height: 34px;
  padding: 0 10px;
}

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

.organization-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.organization-summary strong {
  display: block;
  font-size: 20px;
}

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

.organization-columns h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-row span {
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
}

body[data-theme="focus"] {
  --soft: #f8fafc;
  --mint: #e7f3ff;
}

body[data-theme="contrast"] {
  --ink: #17202a;
  --muted: #3f5264;
  --line: #b9d9f5;
  --soft: #eef7ff;
  --mint: #d7ecff;
}

.member-list {
  display: grid;
  gap: 8px;
}

.governance-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.governance-list article {
  display: grid;
  gap: 4px;
}

.governance-list p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.governance-output {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

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

.backend-contract {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdfc;
}

.backend-contract summary {
  cursor: pointer;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 850;
}

.backend-contract pre {
  overflow: auto;
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
}

.drive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.source-list {
  display: grid;
  gap: 14px;
}

.source-diagnostics,
.ai-analysis-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}

#dashboards .ai-analysis-panel {
  margin: 16px 0 0;
}

.source-diagnostics article,
.ai-analysis-panel article {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 10px 12px;
}

.source-diagnostics article.is-healthy {
  background: rgba(153, 229, 80, 0.16);
  border-color: rgba(153, 229, 80, 0.5);
}

.source-diagnostics article.needs-review {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.42);
}

.source-diagnostics article.needs-attention {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
}

.source-diagnostics strong,
.ai-analysis-panel strong {
  display: block;
  color: var(--teal-dark);
  font-size: 19px;
  line-height: 1;
}

.source-diagnostics span,
.ai-analysis-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 800;
}

.source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(30, 116, 230, 0.14);
  box-shadow: 0 8px 22px rgba(10, 31, 68, 0.05);
}

.source-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.source-item-header {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) auto minmax(360px, 0.9fr);
  gap: 10px;
  align-items: center;
}

.source-item strong,
.source-item span {
  display: block;
}

.source-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
}

.source-state-pill {
  display: inline-flex !important;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
  background: #e5f6ef;
  color: #20715f;
}

.source-status-error .source-state-pill {
  background: #fdecea;
  color: #a2352a;
}

.source-status-no-columns .source-state-pill,
.source-status-review .source-state-pill {
  background: #fff2d8;
  color: #8b4d00;
}

.source-name-label {
  display: grid;
  gap: 4px;
  max-width: 420px;
}

.source-name-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.source-name-input {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.source-name-input:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 116, 230, 0.14);
}

.source-actions {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.source-actions .mini-button {
  width: auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.source-actions .primary-mini {
  background: rgba(153, 229, 80, 0.22);
  border-color: rgba(153, 229, 80, 0.54);
}

.source-detail-line {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.source-compact-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-compact-metrics span {
  min-height: 34px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 999px;
  background: #f8fafc;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.source-compact-metrics strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
}

.source-body-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.24fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.source-quality-stack {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.source-details-panel {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 14px;
  background: #fbfdff;
  padding: 10px;
}

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

.source-table-model {
  min-width: 0;
  display: grid;
  gap: 10px;
  border: 1px solid rgba(30, 116, 230, 0.16);
  border-radius: 10px;
  background: rgba(30, 116, 230, 0.06);
  padding: 12px;
}

.source-table-model-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.source-table-model-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.source-table-model-head strong {
  color: var(--teal-dark);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.source-table-model-head em {
  margin-left: auto;
  color: #145fbf;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.source-table-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.source-table-model-grid span {
  min-width: 0;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  padding: 8px;
  overflow-wrap: anywhere;
}

.source-table-model-grid strong {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.source-table-model-list {
  display: grid;
  gap: 6px;
}

.source-table-model-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.source-preview-mini {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.source-preview-mini summary {
  cursor: pointer;
  padding: 9px 12px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.source-preview-scroll {
  overflow: auto;
  max-height: 180px;
  border-top: 1px solid var(--line);
}

.source-preview-mini table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.source-preview-mini th,
.source-preview-mini td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
}

.source-preview-mini th {
  background: var(--soft);
  color: var(--ink);
  font-weight: 900;
}

.source-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.source-column {
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
}

.source-more-count {
  width: fit-content;
  border-radius: 999px;
  background: rgba(30, 116, 230, 0.08);
  color: var(--teal-dark) !important;
  padding: 6px 9px;
  font-size: 11px !important;
  font-weight: 900;
}

.source-issues {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px 10px 8px 26px;
  border: 1px solid #f0c8b5;
  border-radius: 8px;
  background: #fff4ee;
  color: #8d3325;
  font-size: 12px;
  line-height: 1.35;
}

.source-issues-compact {
  padding: 8px 10px;
}

.source-issues-compact strong {
  color: #8d3325;
  font-size: 11px;
}

.source-issues-compact span {
  color: #8d3325;
  font-size: 12px;
}

.source-live-state {
  width: fit-content;
  margin-top: 0;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
}

.source-live-state.is-live {
  background: var(--mint);
  color: var(--teal-dark);
}

.source-live-state.is-pending {
  background: #fff4e6;
  color: #8a5b00;
}

.source-ok {
  width: fit-content;
  margin-top: 0;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
}

.source-mapping {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.source-mapping summary {
  cursor: pointer;
  padding: 9px 12px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.source-mapping div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(10, 31, 68, 0.46);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop.open {
  display: grid;
}

.source-modal {
  width: min(980px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(10, 31, 68, 0.28);
  padding: 20px;
}

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

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

.modal-form {
  display: grid;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.classification-modal {
  width: min(920px, 100%);
}

.classification-list {
  display: grid;
  gap: 10px;
}

.classification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.classification-row strong,
.classification-row span,
.classification-row small {
  display: block;
}

.classification-row span,
.classification-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.upload-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 20px;
  align-items: center;
  padding: 20px;
  margin-bottom: 18px;
}

.upload-band p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.upload-drop {
  min-height: 118px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  border: 1px dashed var(--teal);
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
  color: var(--ink);
}

.upload-drop.source-card {
  min-height: 150px;
}

.upload-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-drop strong {
  color: var(--teal-dark);
}

.upload-drop span {
  max-width: 290px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

#queryBuilder {
  padding: 12px 0 0;
}

#queryBuilder .studio-grid {
  margin-top: 12px;
}

#queryBuilder .module-header {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
}

#queryBuilder .topbar-actions {
  width: 100%;
  grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 1.15fr) minmax(260px, 1fr);
  align-self: start;
  padding: 10px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(10, 31, 68, 0.06);
}

#queryBuilder .topbar-actions .primary-button {
  grid-column: span 1;
}

.toolbar-group {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  padding-right: 12px;
  border-right: 1px solid rgba(10, 31, 68, 0.08);
}

.toolbar-group-final {
  padding-right: 0;
  border-right: 0;
}

.toolbar-group .secondary-button,
.toolbar-group .primary-button {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-mode-switch {
  justify-content: space-between;
  border-color: rgba(30, 116, 230, 0.28) !important;
  background: rgba(30, 116, 230, 0.08) !important;
  color: var(--ink) !important;
}

.query-mode-switch::after {
  content: "";
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(10, 31, 68, 0.18);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.query-mode-switch[aria-pressed="true"]::after {
  background: var(--accent);
}

.builder,
.viewer,
.report-library {
  padding: 16px;
}

.builder {
  display: grid;
  gap: 16px;
}

.builder-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  gap: 12px;
  align-items: stretch;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.builder-hero h2,
.builder-hero p {
  margin-top: 0;
}

.builder-hero h2 {
  font-size: 24px;
}

.builder-hero .section-copy {
  font-size: 14px;
}

.query-summary-card {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 12px;
}

.query-summary-card > span {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.query-summary-card strong,
.query-active-source strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.query-active-source {
  display: grid;
  gap: 4px;
}

.query-active-source span {
  width: fit-content;
  border-radius: 999px;
  background: rgba(153, 229, 80, 0.18);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.query-active-source em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.query-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.query-summary-stats span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
}

.query-connector-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto);
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(30, 116, 230, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(164, 201, 244, 0.28), rgba(162, 255, 0, 0.1)),
    #ffffff;
  padding: 12px;
}

.query-connector-card span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 5px;
  border-radius: 999px;
  background: rgba(30, 116, 230, 0.1);
  color: var(--teal-dark);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.query-connector-card strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
}

.query-connector-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.query-connector-card .secondary-button {
  min-height: 42px;
  border-radius: 999px;
  white-space: nowrap;
}

.query-flow {
  position: sticky;
  top: 12px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(10, 31, 68, 0.08);
  padding: 5px;
}

.query-quick-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.query-quick-templates button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-dark);
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.query-quick-templates button:hover {
  border-color: var(--teal);
  background: var(--mint);
}

.query-flow button {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.query-flow button:hover,
.query-flow button.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(30, 116, 230, 0.14);
  transform: translateY(-1px);
}

.query-flow button.is-complete {
  background: linear-gradient(180deg, #ffffff 0%, #f0faf7 100%);
}

.query-flow button.is-complete::after {
  content: "OK";
  grid-column: 1 / -1;
  justify-self: start;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 2px 6px;
  font-size: 9px;
  letter-spacing: 0.02em;
}

.query-flow strong,
.query-flow small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-flow small {
  grid-column: 2;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.query-flow em {
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 3px 6px;
  font-style: normal;
  font-size: 10px;
}

.query-step {
  display: grid;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.query-performance {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #ffffff;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.query-performance strong {
  color: var(--ink);
  font-size: 13px;
}

.query-performance span,
.query-performance em {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-style: normal;
}

.query-performance.ok {
  border-color: rgba(153, 229, 80, 0.42);
  background: rgba(153, 229, 80, 0.08);
}

.query-performance.warning {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
}

.query-performance.danger {
  border-color: rgba(225, 29, 72, 0.32);
  background: rgba(225, 29, 72, 0.07);
}

.query-performance.is-pending {
  border-color: rgba(30, 116, 230, 0.3);
  background: rgba(30, 116, 230, 0.08);
}

body:not(.query-advanced) #queryBuilder .advanced-query,
body:not(.query-advanced) #queryBuilder .advanced-query-control,
body:not(.query-advanced) #queryFlow [data-query-step-target="queryStepSort"],
body:not(.query-advanced) #queryBuilder .preview-controls label:nth-of-type(n + 5) {
  display: none;
}

body:not(.query-advanced) #queryBuilder #queryValidation {
  display: grid;
}

body:not(.query-advanced) #queryBuilder .preview-controls {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

body.query-advanced #toggleAdvancedQuery {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal-dark);
}

.query-step:hover {
  border-color: #c3d2ce;
}

.query-step.is-focused {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(30, 116, 230, 0.14), var(--shadow);
}

.step-copy {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.join-panel {
  display: grid;
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.join-suggestion {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
}

.join-preview-card {
  display: grid;
  gap: 10px;
}

.join-preview-card > div:first-child {
  display: grid;
  gap: 3px;
}

.join-preview-card strong {
  color: var(--ink);
}

.join-preview-card span {
  color: var(--muted);
}

.join-preview-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.join-preview-metrics article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--soft);
  padding: 8px;
}

.join-preview-metrics article strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
}

.join-preview-metrics article span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.join-preview-card.is-strong .join-preview-metrics article:first-child {
  background: rgba(153, 229, 80, 0.18);
  border-color: rgba(153, 229, 80, 0.5);
}

.join-preview-card.is-medium .join-preview-metrics article:first-child {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(250, 204, 21, 0.45);
}

.join-preview-card.is-low .join-preview-metrics article:first-child {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
}

.join-preview-card.is-empty {
  border: 0;
  padding: 0;
}

.stage-preview {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.step-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.summary-config-block {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.summary-block-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.summary-block-heading strong {
  color: var(--ink);
  font-size: 13px;
}

.summary-block-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.stage-preview strong {
  color: var(--ink);
  font-size: 12px;
}

.stage-preview div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-preview span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
}

.document-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.document-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.document-field small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.document-field.is-omitted {
  opacity: 0.55;
  text-decoration: line-through;
}

.small-heading span {
  background: #e8edf7;
  color: #254f8a;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.step-heading span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--teal);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.step-heading strong {
  font-size: 14px;
}

.query-step summary {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  list-style: none;
}

.query-step summary::-webkit-details-marker {
  display: none;
}

.query-step summary span {
  width: auto;
  min-width: 34px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: var(--on-surface);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 850;
}

.query-step summary strong {
  font-size: 14px;
}

.chip-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--teal-dark);
  cursor: pointer;
  font-weight: 800;
}

.ghost-button {
  min-height: 34px;
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ghost-button:hover {
  color: #8d3325;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 10px;
  background: #ece8f6;
  color: #51458d;
  font-size: 12px;
  font-weight: 800;
}

.filter-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(81, 69, 141, 0.14);
  color: #51458d;
  cursor: pointer;
  font-weight: 900;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.summary-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  font-weight: 900;
}

.sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  padding: 8px 10px;
  background: #e8edf7;
  color: #254f8a;
  font-size: 12px;
  font-weight: 850;
}

.sort-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(37, 79, 138, 0.14);
  color: #254f8a;
  cursor: pointer;
  font-weight: 900;
}

.sql-preview {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--on-surface);
  padding: 14px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.sql-editor {
  width: 100%;
  min-height: 170px;
  resize: vertical;
}

.validation-panel {
  background: #fffdf7;
}

.validation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.validation-list span {
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.validation-list.has-issues span {
  background: #fff4ee;
  color: #8d3325;
  border: 1px solid #f0c8b5;
}

.function-hint {
  min-height: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.function-hint:empty {
  display: none;
}

.builder-actions {
  display: grid;
  gap: 10px;
}

.section-title {
  display: grid;
  gap: 2px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}

.check-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--teal);
}

.viewer {
  min-height: 640px;
}

.viewer-header p:last-child {
  max-width: 980px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.preview-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.library-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  min-height: 38px;
  padding: 0 14px;
  font-weight: 850;
  cursor: pointer;
}

.library-tab.active {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal);
}

.query-library-section[data-library-view="recommended"] .library-panel-saved,
.query-library-section[data-library-view="saved"] .library-panel-recommended {
  display: none;
}

.query-library-section[data-library-view="recommended"] .query-library-layout,
.query-library-section[data-library-view="saved"] .query-library-layout {
  grid-template-columns: 1fr;
}

.preview-controls label {
  width: 100%;
}

.preview-controls select,
.preview-controls input[type="color"] {
  min-height: 38px;
}

.color-control input[type="color"] {
  width: 100%;
  padding: 4px;
  cursor: pointer;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
}

.preview-check {
  min-height: 38px;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
}

.chart-selection-pill {
  width: fit-content;
  margin: 0 0 10px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
}

.query-readable {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.chart-recommendation {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 12px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(153, 229, 80, 0.1), transparent 38%),
    #ffffff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(10, 31, 68, 0.05);
}

.chart-recommendation-body {
  display: grid;
  gap: 8px;
}

.chart-recommendation:empty {
  display: none;
}

.chart-recommendation strong,
.chart-recommendation span {
  display: block;
}

.chart-recommendation strong {
  color: var(--teal-dark);
  font-size: 14px;
}

.chart-recommendation span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chart-recommendation small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.chart-recommendation-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
}

.chart-recommendation-heading small {
  grid-column: 1 / -1;
  margin: 0;
}

.visual-score-chip {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 56%, transparent 58%),
    conic-gradient(var(--teal) var(--visual-score), rgba(10, 31, 68, 0.1) 0);
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.visual-score-chip i {
  display: none;
}

.chart-recommendation-heading.score-warning .visual-score-chip {
  background:
    radial-gradient(circle at center, #fff 56%, transparent 58%),
    conic-gradient(#c88a22 var(--visual-score), rgba(10, 31, 68, 0.1) 0);
}

.chart-recommendation-heading.score-danger .visual-score-chip {
  background:
    radial-gradient(circle at center, #fff 56%, transparent 58%),
    conic-gradient(#b42318 var(--visual-score), rgba(10, 31, 68, 0.1) 0);
}

.visual-diagnostic-list,
.visual-insight-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.visual-diagnostic-list span,
.visual-insight-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
}

.compact-diagnostics span {
  opacity: 0.9;
}

.visual-diagnostic-list .ok {
  border-color: rgba(30, 116, 230, 0.3);
  color: var(--teal-dark);
  background: var(--mint);
}

.visual-diagnostic-list .info {
  color: #2f6f9f;
}

.visual-diagnostic-list .warning {
  border-color: rgba(200, 138, 34, 0.35);
  color: #875a0a;
  background: #fff8e8;
}

.visual-diagnostic-list .danger {
  border-color: rgba(180, 35, 24, 0.35);
  color: #9f1b12;
  background: #fff1ef;
}

.visual-insight-list span {
  border-color: rgba(30, 116, 230, 0.18);
  color: var(--ink);
  background: #f8fbff;
}

.chart-recommendation-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chart-recommendation-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 10px;
}

.chart-recommendation-card.active {
  border-color: rgba(30, 116, 230, 0.35);
  background: var(--mint);
}

.chart-recommendation-card .recommendation-rank {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(30, 116, 230, 0.08);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 950;
}

.chart-recommendation-card > div {
  min-width: 0;
}

.chart-recommendation-card .mini-button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 36px;
}

@media (max-width: 1100px) {
  .chart-recommendation-options {
    grid-template-columns: 1fr;
  }
}

.storage-guardrail {
  display: grid;
  gap: 10px;
}

.storage-guardrail p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.storage-meter {
  display: grid;
  gap: 8px;
}

.storage-meter > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.storage-meter strong {
  color: var(--ink);
  font-size: 22px;
}

.storage-meter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.storage-meter i {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) var(--storage-used), #e7ece9 var(--storage-used));
}

.storage-meter.warning i {
  background: linear-gradient(90deg, #c88a22 var(--storage-used), #e7ece9 var(--storage-used));
}

.storage-meter.danger i {
  background: linear-gradient(90deg, #b42318 var(--storage-used), #e7ece9 var(--storage-used));
}

.storage-cloud-note {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--line));
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(30, 116, 230, 0.08), #ffffff);
  padding: 10px;
}

.storage-cloud-note strong {
  color: var(--ink);
  font-size: 13px;
}

.storage-cloud-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.storage-breakdown span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.storage-breakdown strong {
  display: block;
  color: var(--teal-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.storage-actions .mini-button {
  min-height: 34px;
  border-radius: 8px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  align-self: center;
  white-space: nowrap;
}

.chart-shell {
  margin-top: 14px;
  min-height: 500px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, var(--soft) 100%);
  overflow: hidden;
}

.chart-canvas {
  position: relative;
  min-height: 500px;
  padding: 22px;
}

.chart-data-panel {
  border-top: 1px solid var(--line);
  background: white;
}

.chart-data-details {
  padding: 12px 16px 16px;
}

.chart-data-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: var(--teal-dark);
  font-weight: 850;
}

.chart-data-details summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.compact-data-table th,
.compact-data-table td {
  padding: 9px 10px;
  font-size: 12px;
}

.chart-empty {
  min-height: 430px;
  display: grid;
  place-items: center;
  text-align: center;
}

.chart-canvas [data-tooltip] {
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 240px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  border: 1px solid rgba(10, 31, 68, 0.16);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(10, 31, 68, 0.18);
  transition: opacity 120ms ease, transform 120ms ease;
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.include-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.include-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.include-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--teal-dark);
}

.include-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chart-svg {
  width: 100%;
  height: 460px;
  display: block;
}

.axis {
  stroke: #9fb0ab;
  stroke-width: 1;
}

.grid-line {
  stroke: #e3ebe8;
  stroke-width: 1;
}

.chart-text {
  fill: var(--muted);
  font-size: 12px;
}

.chart-value-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 850;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.chart-value-label.is-inverted {
  fill: #ffffff;
  stroke: rgba(23, 33, 31, 0.36);
}

.chart-insight-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.chart-insight-strip strong {
  color: var(--teal-dark);
}

.ranking-chart {
  display: grid;
  gap: 10px;
  padding: 24px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(120px, 220px) 1fr minmax(70px, auto);
  align-items: center;
  gap: 12px;
}

.ranking-row span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.ranking-row strong {
  color: var(--ink);
  font-size: 13px;
}

.ranking-row i {
  height: 18px;
  min-width: 3px;
  border-radius: 999px;
}

.ranking-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.kpi-view {
  min-height: 430px;
  display: grid;
  place-items: center;
  text-align: center;
}

.kpi-value {
  font-size: clamp(72px, 14vw, 152px);
  line-height: 1;
  color: var(--teal-dark);
  font-weight: 850;
}

.kpi-view p {
  color: var(--muted);
  max-width: 480px;
  margin: 14px auto 0;
  line-height: 1.5;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.table-scroll-shell {
  max-width: 100%;
  overflow: auto;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 14px;
  background: #ffffff;
}

.table-scroll-shell .data-table {
  min-width: 680px;
  border: 0;
}

.table-scroll-shell.table-style-clean {
  border-color: rgba(10, 31, 68, 0.06);
}

.table-scroll-shell.table-style-executive {
  border-color: var(--table-border-accent, rgba(10, 31, 68, 0.18));
  box-shadow: 0 12px 26px rgba(10, 31, 68, 0.08);
}

.table-scroll-shell.table-style-risk {
  border-color: rgba(225, 29, 72, 0.28);
  --table-header-bg: rgba(225, 29, 72, 0.12);
  --table-header-text: #9f1239;
  --table-row-alt: rgba(249, 115, 22, 0.055);
  --table-row-hover: rgba(225, 29, 72, 0.11);
}

.table-scroll-shell.table-style-compact .data-table,
.table-scroll-shell.table-style-compact table {
  font-size: 11px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--table-header-text, var(--muted));
  background: var(--table-header-bg, #f8fafc);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  box-shadow: inset 0 -2px 0 var(--table-border-accent, rgba(10, 31, 68, 0.08));
}

.table-marker-heading,
.table-marker-cell {
  width: 54px;
  min-width: 54px;
  text-align: center;
}

.table-marker {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(10, 31, 68, 0.08);
  vertical-align: middle;
}

.table-style-clean .data-table th,
.table-style-clean th {
  background: #ffffff;
  color: var(--muted);
  box-shadow: inset 0 -1px 0 var(--line);
}

.table-style-executive .data-table th,
.table-style-executive th {
  background: var(--table-accent, #0A1F44);
  color: #ffffff;
  box-shadow: none;
}

.table-style-compact .data-table th,
.table-style-compact .data-table td,
.table-style-compact th,
.table-style-compact td {
  padding: 7px 9px;
}

.table-style-clean .data-table tbody tr:nth-child(even),
.table-style-clean tbody tr:nth-child(even) {
  background: #ffffff;
}

.data-table tbody tr:nth-child(even) {
  background: var(--table-row-alt, rgba(10, 31, 68, 0.025));
}

.data-table tbody tr:hover {
  background: var(--table-row-hover, rgba(30, 116, 230, 0.07));
}

.data-table .numeric-cell,
.data-table td:has(> strong) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: var(--mint);
  color: var(--teal-dark);
}

.badge.warn {
  background: #ffe8df;
  color: #a8422e;
}

.badge.neutral {
  background: #e8edf7;
  color: #254f8a;
}

.funnel {
  display: grid;
  gap: 13px;
  padding-top: 12px;
}

.funnel-step {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 18px;
  margin: 0 auto;
  border-radius: 8px;
  background: var(--teal);
  color: white;
}

.funnel-step strong {
  font-size: 22px;
}

.map-view {
  position: relative;
  height: 450px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(30, 116, 230, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 116, 230, 0.08) 1px, transparent 1px),
    #f8fbf9;
  background-size: 44px 44px;
  overflow: hidden;
}

.map-region {
  position: absolute;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(223, 107, 87, 0.18);
  border: 2px solid var(--coral);
  display: grid;
  place-items: center;
  color: #8d3325;
  font-weight: 850;
}

.map-label {
  position: absolute;
  transform: translate(-50%, 20px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.report-library {
  margin-top: 18px;
}

.query-library-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.query-library-section .compact-title {
  margin-top: 14px;
}

.library-grid,
.saved-grid,
.dashboard-board {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.library-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.saved-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.dashboard-board-viewport {
  min-height: 620px;
  height: auto;
  max-height: min(78vh, 980px);
  overflow: auto;
  border: 1px solid rgba(10, 31, 68, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(10, 31, 68, 0.035), rgba(10, 31, 68, 0.015)),
    #eef3f8;
  margin-top: 12px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  scroll-behavior: smooth;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 14px 36px rgba(10, 31, 68, 0.06);
}

.dashboard-board-viewport.is-panning {
  cursor: grab;
}

.dashboard-board-viewport.is-panning-active {
  cursor: grabbing;
}

.dashboard-board {
  display: block;
  position: relative;
  min-height: 720px;
  width: max(100%, 2200px);
  border: 1px solid rgba(30, 116, 230, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(rgba(30, 116, 230, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 116, 230, 0.075) 1px, transparent 1px),
    linear-gradient(rgba(10, 31, 68, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 31, 68, 0.035) 1px, transparent 1px),
    #fbfdff;
  background-size: var(--dashboard-grid-size, 64px) var(--dashboard-grid-size, 64px);
  background-position: 0 0, 0 0, calc(var(--dashboard-grid-size, 64px) / 2) calc(var(--dashboard-grid-size, 64px) / 2), calc(var(--dashboard-grid-size, 64px) / 2) calc(var(--dashboard-grid-size, 64px) / 2);
  margin-top: 0;
  transform-origin: 0 0;
  box-shadow: 0 18px 42px rgba(10, 31, 68, 0.06);
}

.dashboard-board::before,
.dashboard-board::after {
  content: "";
  position: absolute;
  pointer-events: none;
  background: rgba(30, 116, 230, 0.22);
  z-index: 0;
}

.dashboard-board::before {
  left: 0;
  right: 0;
  top: var(--dashboard-grid-size, 64px);
  height: 1px;
}

.dashboard-board::after {
  top: 0;
  bottom: 0;
  left: var(--dashboard-grid-size, 64px);
  width: 1px;
}

.dashboard-history-panel,
.dashboard-workspace {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.dashboard-workspace {
  background: #fbfdfc;
}

.dashboard-storage-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.dashboard-storage-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.dashboard-storage-summary strong,
.dashboard-storage-summary span {
  display: block;
}

.dashboard-storage-summary strong {
  color: var(--ink);
  font-size: 20px;
}

.dashboard-storage-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-workspace.is-presenting .dashboard-control-dock,
.dashboard-workspace.is-presenting .dashboard-query-library,
.dashboard-workspace.is-presenting .dashboard-properties,
.dashboard-workspace.is-presenting .canvas-toolbar,
.dashboard-workspace.is-presenting .dashboard-resize-handle {
  display: none !important;
}

.dashboard-workspace.is-presenting .dashboard-board {
  background:
    linear-gradient(rgba(30, 116, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 116, 230, 0.05) 1px, transparent 1px),
    #ffffff;
  background-size: var(--dashboard-grid-size, 64px) var(--dashboard-grid-size, 64px);
}

.dashboard-workspace.is-presenting .card-meta {
  display: none;
}

.dashboard-workspace.is-presenting .dashboard-card {
  outline: 0;
  box-shadow: none;
  border-color: rgba(10, 31, 68, 0.08);
}

.dashboard-workspace.is-presenting .dashboard-section-tabs,
.dashboard-workspace.is-presenting .workspace-mode-bar,
.dashboard-workspace.is-presenting .dashboard-command-center,
.dashboard-workspace.is-presenting .dashboard-filter-strip {
  display: none;
}

.dashboard-workspace.width-full {
  margin-left: -16px;
  margin-right: -16px;
}

.dashboard-workspace.is-expanded,
.dashboard-workspace:fullscreen {
  position: fixed;
  inset: 10px;
  z-index: 120;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  margin: 0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(10, 31, 68, 0.24);
}

.dashboard-workspace.is-expanded .dashboard-control-dock,
.dashboard-workspace.is-expanded .dashboard-query-library,
.dashboard-workspace.is-expanded .dashboard-properties,
.dashboard-workspace:fullscreen .dashboard-control-dock,
.dashboard-workspace:fullscreen .dashboard-query-library,
.dashboard-workspace:fullscreen .dashboard-properties {
  display: none !important;
}

.dashboard-workspace.is-expanded .dashboard-builder-shell,
.dashboard-workspace:fullscreen .dashboard-builder-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
}

.dashboard-workspace.is-expanded .dashboard-canvas,
.dashboard-workspace:fullscreen .dashboard-canvas {
  min-height: 0;
}

.dashboard-workspace.is-expanded .dashboard-board-viewport,
.dashboard-workspace:fullscreen .dashboard-board-viewport {
  height: calc(100vh - 220px);
  min-height: 640px;
}

.dashboard-workspace.is-expanded .canvas-toolbar,
.dashboard-workspace:fullscreen .canvas-toolbar {
  max-width: min(760px, calc(100% - 36px));
}

.dashboard-workspace-header {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(10, 31, 68, 0.08);
}

.dashboard-workspace.has-no-dashboard .requires-active-dashboard,
.dashboard-workspace.has-no-dashboard .dashboard-control-dock,
.dashboard-workspace.has-no-dashboard .dashboard-builder-shell,
.dashboard-workspace.has-no-dashboard .dashboard-filter-strip {
  display: none !important;
}

.dashboard-workspace.has-no-dashboard .dashboard-workspace-header {
  position: static;
}

.dashboard-workspace.has-no-dashboard #saveDashboardWorkspace,
.dashboard-workspace.has-no-dashboard #previewDashboard {
  display: none !important;
}

.dashboard-workspace-header h2 {
  margin: 0 0 6px;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 760px;
}

.dashboard-filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 12px;
}

.dashboard-filter-strip span {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-filter-strip strong {
  color: var(--teal-dark);
}

.dashboard-command-center {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(260px, 0.95fr) minmax(0, 1.25fr);
  gap: 12px;
  margin: 12px 0;
}

.dashboard-command-hero,
.dashboard-command-metrics,
.dashboard-quality-card {
  min-width: 0;
  border: 1px solid rgba(10, 31, 68, 0.1);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(10, 31, 68, 0.06);
}

.dashboard-command-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(153, 229, 80, 0.16), transparent 42%),
    #ffffff;
}

.dashboard-command-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.dashboard-command-copy span {
  width: fit-content;
  border-radius: 999px;
  background: rgba(30, 116, 230, 0.08);
  color: #145fbf;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-command-copy strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-command-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.dashboard-readiness-ring {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 60%),
    conic-gradient(#99e550 var(--readiness), rgba(10, 31, 68, 0.1) 0);
}

.dashboard-readiness-ring strong,
.dashboard-readiness-ring span {
  display: block;
  text-align: center;
}

.dashboard-readiness-ring strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
}

.dashboard-readiness-ring span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-command-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-command-actions .primary-button,
.dashboard-command-actions .secondary-button {
  min-height: 38px;
  padding-inline: 14px;
}

.dashboard-command-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
}

.dashboard-command-metrics article {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 14px 12px;
  border-right: 1px solid rgba(10, 31, 68, 0.08);
}

.dashboard-command-metrics article:last-child {
  border-right: 0;
}

.dashboard-command-metrics article.is-selected {
  background: rgba(153, 229, 80, 0.12);
}

.dashboard-command-metrics strong,
.dashboard-command-metrics span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-command-metrics strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
}

.dashboard-command-metrics span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-command-hero.command-empty .dashboard-command-copy span {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
}

.dashboard-command-hero.command-review .dashboard-command-copy span {
  background: rgba(249, 115, 22, 0.12);
  color: #9a3412;
}

.dashboard-command-hero.command-live .dashboard-command-copy span {
  background: rgba(153, 229, 80, 0.18);
  color: var(--ink);
}

.dashboard-quality-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.dashboard-quality-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-quality-head span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-quality-head strong {
  color: var(--ink);
  font-size: 20px;
}

.dashboard-quality-head em {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--ink);
  font-style: normal;
  font-weight: 950;
}

.dashboard-quality-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-quality-card li {
  border-left: 3px solid var(--line);
  color: var(--muted);
  padding-left: 8px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.dashboard-quality-card li.severity-risk {
  border-left-color: #e11d48;
}

.dashboard-quality-card li.severity-warning {
  border-left-color: #f97316;
}

.dashboard-quality-card li.severity-info {
  border-left-color: var(--teal);
}

.dashboard-toolbar,
.dashboard-note-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) minmax(150px, 0.8fr) minmax(180px, 1fr) 140px auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.dashboard-control-dock {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.dashboard-workspace:not(.show-tools-panel) .dashboard-control-dock {
  display: none;
}

.dashboard-workspace.show-tools-panel .dashboard-control-dock {
  position: static;
  z-index: auto;
  width: 100%;
  max-height: none;
  overflow: visible;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(10, 31, 68, 0.07);
  padding: 12px;
}

.dashboard-control-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.dashboard-control-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 48px;
  cursor: pointer;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 900;
  list-style: none;
}

.dashboard-control-panel summary::-webkit-details-marker {
  display: none;
}

.dashboard-control-panel summary::after {
  content: "+";
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
}

.dashboard-control-panel[open] summary::after {
  content: "-";
}

.dashboard-control-panel summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.dashboard-work-tools {
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 0.45fr) auto;
  padding: 0 14px 14px;
  margin-top: 0;
}

.dashboard-tool-heading {
  align-self: center;
}

.dashboard-tool-heading span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-toolbar.dashboard-structure {
  grid-template-columns: minmax(140px, 0.6fr) minmax(220px, 1fr) minmax(220px, 1fr) auto auto auto;
  padding: 0 14px 14px;
  margin-top: 0;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.7fr) minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 0 14px 14px;
  margin-top: 0;
}

.dashboard-filter-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  align-items: center;
}

.dashboard-filter-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-filter-heading {
  align-self: center;
}

.dashboard-filter-heading span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-section-tabs {
  margin-top: 16px;
}

.dashboard-builder-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
  position: relative;
}

.dashboard-query-library,
.dashboard-canvas,
.dashboard-properties {
  min-width: 0;
}

.dashboard-query-library {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0;
  overflow: hidden;
}

.unified-query-library {
  margin-top: 0;
}

.dashboard-query-library {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #ffffff;
  padding: 14px;
}

.dashboard-workspace:not(.show-library-panel) .dashboard-query-library {
  display: none;
}

.dashboard-workspace.show-library-panel .dashboard-query-library {
  position: absolute;
  left: 18px;
  top: 78px;
  z-index: 28;
  width: min(380px, calc(100vw - 56px));
  max-height: min(720px, calc(100vh - 180px));
  overflow: auto;
  box-shadow: 0 24px 58px rgba(10, 31, 68, 0.18);
}

.saved-query-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 0 0 12px;
  cursor: default;
  list-style: none;
  color: var(--ink);
  font-weight: 900;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.drawer-close-button {
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
}

.saved-query-drawer .section-title {
  margin: 0;
}

.saved-query-drawer .section-title .eyebrow {
  margin: 0;
}

.saved-query-drawer .section-title h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.saved-query-drawer summary::-webkit-details-marker {
  display: none;
}

.dashboard-library-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(4, minmax(110px, 0.7fr));
  gap: 8px;
  margin-bottom: 10px;
}

.dashboard-library-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-library-controls input,
.dashboard-library-controls select {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.dashboard-library-count {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.dashboard-canvas {
  grid-column: 1;
  position: relative;
}

.dashboard-properties {
  position: fixed;
  top: 120px;
  right: 24px;
  z-index: 30;
  width: min(320px, calc(100vw - 48px));
  max-height: calc(100vh - 144px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
  box-shadow: var(--shadow);
}

.dashboard-workspace:not(.show-properties-panel) .dashboard-properties {
  display: none;
}

.dashboard-workspace.show-properties-panel .dashboard-properties {
  display: block;
}

.dashboard-workspace:not(.show-properties-panel) .dashboard-properties:has(.property-empty) {
  display: none;
}

.property-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.property-empty-guide {
  display: grid;
  gap: 10px;
}

.property-empty-guide strong {
  color: var(--ink);
  font-family: Lexend, Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 18px;
}

.property-empty-guide span {
  color: var(--muted);
}

.property-empty-guide div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.property-empty-guide em {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--teal);
  padding: 5px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.property-panel {
  display: grid;
  gap: 12px;
}

.property-summary {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(30, 116, 230, 0.14);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.property-summary span {
  width: fit-content;
  border-radius: 999px;
  background: rgba(153, 229, 80, 0.18);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.property-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.property-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.property-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.property-row.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.property-size-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.property-size-presets button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.property-size-presets button:hover {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(30, 116, 230, 0.1);
}

.property-size-presets strong {
  font-size: 12px;
  line-height: 1.15;
}

.property-size-presets span {
  color: var(--muted);
  font-size: 11px;
}

.property-checks {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.property-checks label,
.checkbox-line {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
}

.property-checks input,
.checkbox-line input {
  width: auto !important;
}

.property-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.property-panel input,
.property-panel select,
.property-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px;
  font: inherit;
}

.compact-title h2 {
  font-size: 18px;
}

#dashboardQueryLibrary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  overflow: visible;
  padding: 0;
  max-height: none;
}

.dashboard-query-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
  min-height: 180px;
  align-content: start;
}

.dashboard-preview-modal {
  max-width: 560px;
}

.preview-modal-grid {
  gap: 14px;
}

.preview-modal-summary {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.preview-modal-summary strong {
  color: var(--ink);
  font-size: 18px;
}

.preview-modal-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.dashboard-query-card:hover {
  border-color: #9dccf3;
  box-shadow: var(--shadow-sm);
}

.dashboard-query-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.dashboard-query-card-head span {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-query-card-head i {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 4px;
  margin-top: 2px;
}

.dashboard-query-card strong {
  color: var(--ink);
  display: block;
  margin-top: 6px;
  line-height: 1.2;
}

.dashboard-query-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-query-actions {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
  margin-top: auto;
}

.dashboard-query-actions label {
  gap: 4px;
  font-size: 11px;
}

.dashboard-query-actions select {
  min-height: 34px;
  padding: 6px 30px 6px 9px;
  font-size: 12px;
}

.add-query-button {
  min-width: 76px;
}

.workspace-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-top: 0;
  padding: 0 4px;
}

.workspace-label h2 {
  margin: 0;
  font-size: 18px;
}

.workspace-label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workspace-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.workspace-mode-bar span,
.workspace-mode-bar button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--soft);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.workspace-mode-bar button {
  border: 1px solid rgba(30, 116, 230, 0.14);
  background: rgba(30, 116, 230, 0.06);
  color: var(--teal-dark);
  cursor: pointer;
}

.workspace-mode-bar button:hover {
  background: rgba(153, 229, 80, 0.18);
  border-color: rgba(153, 229, 80, 0.46);
  color: var(--ink);
}

.workspace-mode-pill {
  color: white !important;
  background: var(--teal) !important;
}

.workspace-mode-pill.mode-preview {
  background: #3d72b4 !important;
}

.workspace-mode-pill.mode-viewer {
  background: #6f7580 !important;
}

.workspace-mode-pill.mode-empty {
  background: #9aa3ab !important;
}

.canvas-toolbar {
  position: sticky;
  left: 50%;
  bottom: 14px;
  z-index: 24;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: min(860px, calc(100% - 36px));
  margin: -72px auto 18px;
  border: 1px solid rgba(10, 31, 68, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px rgba(10, 31, 68, 0.14);
  padding: 8px;
  backdrop-filter: blur(14px);
}

.canvas-toolbar > span,
.snap-toggle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.snap-toggle {
  gap: 6px;
}

.grid-size-control select {
  min-height: 26px;
  width: 64px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 18px 0 4px;
  font-size: 12px;
  font-weight: 850;
}

.canvas-toolbar .mini-button.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.dashboard-section-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-section-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  padding: 4px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dashboard-section-tab > button:first-child {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 8px;
  font-weight: 850;
}

.tab-icon-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 850;
}

.tab-icon-button:hover,
.dashboard-tab-actions .mini-button:hover {
  border-color: var(--teal);
  background: var(--soft);
}

.dashboard-section-tab.active {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal-dark);
}

.dashboard-section-tab span {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  border-radius: 999px;
  background: white;
  font-size: 11px;
}

.dashboard-note-box {
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto;
  align-items: stretch;
  padding: 0 14px 14px;
  margin-top: 0;
}

.dashboard-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.dashboard-tab {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  padding: 12px;
  font-weight: 800;
  text-align: left;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.dashboard-tab-main {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.dashboard-tab-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-tab-state span,
.dashboard-tab-state em {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.dashboard-tab-state span {
  background: var(--mint);
  color: var(--teal-dark);
}

.dashboard-tab-state em {
  background: var(--soft);
  color: var(--muted);
}

.dashboard-tab-main:hover {
  background: transparent;
}

.dashboard-tab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.dashboard-tab.active {
  background: var(--mint);
  color: var(--teal-dark);
  border-color: var(--teal);
}

.dashboard-tab-main strong,
.dashboard-tab-main span {
  display: block;
}

.dashboard-tab-main strong {
  color: var(--ink);
  font-size: 15px;
}

.dashboard-tab-main span {
  margin-top: 6px;
  line-height: 1.4;
}

.library-card,
.saved-card,
.dashboard-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: white;
  padding: 16px;
}

.query-template-card,
.saved-query-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 220px;
}

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

.query-card-head span,
.query-card-head em {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
  font-style: normal;
}

.query-card-head span {
  background: var(--mint);
  color: var(--teal-dark);
}

.query-card-head em {
  background: var(--soft);
  color: var(--muted);
}

.library-card {
  cursor: pointer;
}

.library-card:hover,
.saved-card:hover {
  border-color: var(--teal);
  box-shadow: 0 12px 28px rgba(10, 31, 68, 0.08);
}

.library-card strong,
.saved-card strong,
.dashboard-card strong {
  display: block;
  margin-bottom: 8px;
}

.library-card p,
.saved-card p,
.dashboard-card p,
.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.actionable-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 180px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 84%, var(--soft));
}

.actionable-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.actionable-empty span {
  max-width: 380px;
}

.empty-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.empty-choice-grid {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.empty-choice {
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(10, 31, 68, 0.05);
}

.empty-choice:hover {
  border-color: var(--teal);
  box-shadow: 0 12px 28px rgba(10, 31, 68, 0.1);
}

.empty-choice strong {
  font-size: 15px;
  line-height: 1.2;
}

.empty-choice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.empty-choice.primary-choice {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--teal));
  background: linear-gradient(180deg, rgba(153, 229, 80, 0.18), #ffffff);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 2px 0 0;
  align-items: center;
}

.card-meta span,
.meta-button {
  border-radius: 8px;
  background: transparent;
  color: rgba(10, 31, 68, 0.62);
  padding: 2px 4px;
  font-size: 9px;
  font-weight: 800;
}

.card-meta span::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 5px 2px 0;
  border-radius: 999px;
  background: rgba(10, 31, 68, 0.22);
}

.meta-button {
  margin-left: auto;
  border: 1px solid rgba(30, 116, 230, 0.14);
  background: rgba(30, 116, 230, 0.06);
  color: var(--teal-dark);
  padding: 5px 8px;
  font-size: 10px;
  cursor: pointer;
}

.meta-button:hover {
  background: var(--mint);
}

.dashboard-card .card-meta span:nth-child(n + 4) {
  display: none;
}

.dashboard-card:hover .card-meta span:nth-child(n + 4),
.dashboard-card.is-selected .card-meta span:nth-child(n + 4) {
  display: inline-flex;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: end;
}

.mini-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--teal-dark);
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.icon-action {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.danger-button {
  color: #9b3328;
  border-color: #efc7c0;
}

.danger-button:hover {
  background: #fff4f2;
}

.primary-mini {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.wide-card-action {
  width: 100%;
  align-self: end;
  border-color: var(--teal);
  color: var(--teal-dark);
}

.compact-meta {
  margin: 0;
}

.dashboard-card {
  min-height: 240px;
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto auto;
  align-content: stretch;
  gap: 10px;
  position: absolute;
  z-index: 1;
  max-width: calc(100% - 32px);
  box-shadow: 0 6px 16px rgba(10, 31, 68, 0.045);
  background: #ffffff;
  opacity: var(--card-opacity, 1);
}

.dashboard-board.is-editing .dashboard-card {
  cursor: move;
  outline: 1px solid rgba(30, 116, 230, 0.1);
}

.dashboard-card.is-selected {
  outline: 2px solid rgba(30, 116, 230, 0.42);
  box-shadow: 0 12px 28px rgba(10, 31, 68, 0.12);
}

.dashboard-card.is-dragging {
  z-index: 10;
  opacity: 0.94;
  box-shadow: 0 20px 50px rgba(10, 31, 68, 0.18);
  outline: 2px solid var(--teal);
}

.dashboard-card.is-resizing {
  z-index: 11;
  outline: 2px solid var(--teal);
  user-select: none;
}

.dashboard-resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  min-height: 18px;
  border: 1px solid rgba(30, 116, 230, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 3px 8px rgba(10, 31, 68, 0.08);
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.dashboard-card:hover .dashboard-resize-handle,
.dashboard-card.is-selected .dashboard-resize-handle,
.dashboard-card.is-resizing .dashboard-resize-handle {
  opacity: 0.48;
  pointer-events: auto;
}

.dashboard-card:hover .dashboard-resize-handle,
.dashboard-card.is-resizing .dashboard-resize-handle {
  opacity: 0.76;
}

.dashboard-resize-handle:hover {
  border-color: var(--teal);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 116, 230, 0.1);
  opacity: 1;
  transform: scale(1.12);
}

.dashboard-resize-handle.resize-both {
  right: -7px;
  bottom: -7px;
  background:
    radial-gradient(circle at center, rgba(30, 116, 230, 0.72) 0 3px, transparent 3.5px),
    rgba(255, 255, 255, 0.78);
  cursor: nwse-resize;
}

.dashboard-resize-handle.resize-width {
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.dashboard-resize-handle.resize-width:hover {
  transform: translateY(-50%) scale(1.12);
}

.dashboard-resize-handle.resize-width::before,
.dashboard-resize-handle.resize-height::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  background: var(--teal);
}

.dashboard-resize-handle.resize-height {
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.dashboard-resize-handle.resize-height:hover {
  transform: translateX(-50%) scale(1.12);
}

.dashboard-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.dashboard-item-action-stack {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: grid;
  gap: 3px;
  justify-items: end;
}

.dashboard-item-actions {
  display: flex;
  gap: 2px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  padding: 2px;
  box-shadow: 0 4px 12px rgba(10, 31, 68, 0.08);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.dashboard-card:hover .dashboard-item-actions,
.dashboard-card:focus-within .dashboard-item-actions {
  opacity: 0.82;
  pointer-events: auto;
  transform: translateY(0);
}

.dashboard-inline-size-controls {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 24px);
  gap: 2px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(30, 116, 230, 0.12);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.76);
  padding: 3px;
  box-shadow: 0 4px 12px rgba(10, 31, 68, 0.06);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.dashboard-card:hover .dashboard-inline-size-controls,
.dashboard-card:focus-within .dashboard-inline-size-controls {
  opacity: 0.82;
  pointer-events: auto;
  transform: translateY(0);
}

.dashboard-inline-size-controls span {
  min-width: 14px;
  color: rgba(10, 31, 68, 0.58);
  font-size: 9px;
  font-weight: 950;
  text-align: center;
}

.dashboard-inline-size-controls .size-step-button {
  width: 24px;
  min-height: 20px;
}

.size-step-button {
  width: 24px;
  min-height: 20px;
  padding: 0;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
}

.icon-mini {
  width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  font-size: 12px;
}

.icon-mini:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dashboard-card.size-small {
  min-height: 220px;
}

.dashboard-card.size-large {
  min-height: 420px;
}

.dashboard-card.note-card {
  background: #fffaf0;
  border-color: #edd8aa;
}

.dashboard-card.is-transparent {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(3px);
}

.dashboard-card.align-center {
  text-align: center;
}

.dashboard-card.align-right {
  text-align: right;
}

.dashboard-card.align-center .card-meta,
.dashboard-card.align-center .dashboard-mini-legend {
  justify-content: center;
}

.dashboard-card.align-right .card-meta,
.dashboard-card.align-right .dashboard-mini-legend {
  justify-content: flex-end;
}

.dashboard-card.density-compact,
.dashboard-card.density-dense {
  gap: 7px;
  padding: 12px;
}

.dashboard-card.density-dense {
  grid-template-rows: auto minmax(130px, 1fr) auto;
}

.dashboard-card.density-dense p,
.dashboard-card.density-dense .card-meta span:nth-child(n + 5) {
  display: none;
}

.dashboard-card.density-compact p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dashboard-card.is-compact-card {
  gap: 7px;
  padding: 12px;
}

.dashboard-card.is-compact-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dashboard-card.is-compact-card .card-meta span:nth-child(n + 4) {
  display: none;
}

.dashboard-card.is-wide-card .dashboard-preview,
.dashboard-card.is-wide-card .dashboard-line-preview,
.dashboard-card.is-wide-card .dashboard-stacked-preview {
  min-height: 260px;
}

.dashboard-card.text-title {
  background: white;
  border-color: var(--teal);
  min-height: 110px;
}

.dashboard-card.text-connected {
  border-color: var(--teal);
  background: #f7fffc;
}

.markdown-card {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.markdown-card h2,
.markdown-card h3,
.markdown-card h4 {
  margin: 0 0 8px;
  color: var(--ink);
}

.markdown-card a {
  color: var(--teal-dark);
  font-weight: 850;
}

.markdown-button,
.connected-card-button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 8px;
  border-radius: 8px;
  background: var(--teal);
  color: white !important;
  padding: 0 12px;
  text-decoration: none;
}

.dashboard-card.text-title p {
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
  font-weight: 850;
}

.dashboard-card.text-description p {
  font-size: 15px;
  color: var(--ink);
}

.dashboard-preview {
  min-height: 160px;
  height: 100%;
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 16px 14px 12px;
  border: 1px solid rgba(10, 31, 68, 0.06);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.66);
}

.dashboard-line-preview {
  min-height: 190px;
  height: 100%;
  border: 1px solid rgba(10, 31, 68, 0.06);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.66);
  padding: 12px;
  overflow: hidden;
}

.dashboard-line-preview svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 190px;
}

.dashboard-line-preview text {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 850;
  paint-order: stroke;
  stroke: white;
  stroke-width: 3px;
}

.dashboard-stacked-preview {
  min-height: 220px;
  height: 100%;
  border: 1px solid rgba(10, 31, 68, 0.06);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.66);
  padding: 12px;
  overflow: hidden;
}

.dashboard-stacked-preview svg {
  display: block;
  width: 100%;
  height: calc(100% - 28px);
  min-height: 190px;
}

.dashboard-stacked-preview text {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 850;
  paint-order: stroke;
  stroke: white;
  stroke-width: 3px;
}

.dashboard-stacked-preview .axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 750;
  stroke-width: 2px;
}

.dashboard-stacked-preview .segment-label {
  fill: #ffffff;
  font-size: 9px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(23, 33, 31, 0.45);
  stroke-width: 3px;
}

.dashboard-mini-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.dashboard-mini-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dashboard-mini-legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.empty-preview {
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-kpi-preview {
  display: grid;
  align-content: center;
  min-height: 160px;
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.dashboard-kpi-preview strong {
  margin: 0;
  color: var(--teal-dark);
  font-size: 34px;
  line-height: 1;
}

.dashboard-kpi-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-table-preview {
  overflow: hidden;
  min-height: 170px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.dashboard-table-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dashboard-table-preview th,
.dashboard-table-preview td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
}

.dashboard-table-preview th {
  background: var(--table-header-bg, var(--soft));
  color: var(--table-header-text, var(--muted));
}

.dashboard-table-preview tbody tr:nth-child(even) {
  background: var(--table-row-alt, rgba(10, 31, 68, 0.025));
}

.dashboard-table-preview tbody tr:hover {
  background: var(--table-row-hover, rgba(30, 116, 230, 0.07));
}

.table-style-assist {
  align-items: center;
  gap: 10px;
}

.table-style-assist .mini-button {
  margin-left: auto;
  white-space: nowrap;
}

.dashboard-card.size-small .dashboard-preview {
  min-height: 130px;
}

.dashboard-card.size-large .dashboard-preview {
  min-height: 300px;
}

.dashboard-card.size-small .dashboard-line-preview {
  min-height: 140px;
}

.dashboard-card.size-large .dashboard-line-preview {
  min-height: 320px;
}

.dashboard-preview span {
  position: relative;
  display: flex;
  justify-content: center;
  flex: 1;
  min-width: 14px;
  border-radius: 4px 4px 0 0;
  background: var(--card-accent, var(--teal));
}

.dashboard-preview span em {
  position: absolute;
  bottom: calc(100% + 4px);
  color: var(--ink);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-card-tooltip {
  position: absolute;
  z-index: 60;
  max-width: 260px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  border: 1px solid rgba(245, 245, 247, 0.14);
  border-radius: 12px;
  background: #111415;
  color: #e2e2e2;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 16px 34px rgba(17, 20, 21, 0.26);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.dashboard-card-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.dashboard-part-preview {
  display: flex;
  width: 100%;
  min-height: 42px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--soft);
}

.dashboard-part-preview span {
  display: block;
  min-width: 2px;
}

.dashboard-spatial-preview {
  position: relative;
  min-height: 160px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(30, 116, 230, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(30, 116, 230, 0.08) 1px, transparent 1px),
    #f8fbfa;
  background-size: 28px 28px;
  border: 1px solid var(--line);
}

.dashboard-spatial-preview span {
  position: absolute;
  display: block;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(10, 31, 68, 0.16);
}

.dashboard-card.size-small .dashboard-preview span em {
  display: none;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  background: var(--soft);
}

.module-header,
.source-table-card,
.dashboard-history-panel,
.dashboard-workspace,
.dashboard-query-library,
.dashboard-canvas,
.dashboard-properties,
.governance-card,
.profile-card,
.source-modal,
.chart-shell,
.query-step,
.summary-config-block,
.stage-preview,
.dashboard-card {
  border-color: var(--line);
  border-radius: var(--radius-card);
}

.dashboard-workspace-header,
.dashboard-control-panel,
.dashboard-toolbar,
.dashboard-note-box,
.preview-controls,
.query-flow,
.source-preview-card,
.modal-form,
.permission-card,
.security-grid article,
.profile-activity-list article,
.profile-shared-list article {
  border-color: var(--line);
  border-radius: var(--radius-card);
}

.query-flow {
  position: sticky;
  top: 12px;
  z-index: 18;
  box-shadow: 0 12px 24px rgba(10, 31, 68, 0.08);
}

.dashboard-workspace.is-presenting .dashboard-control-dock,
.dashboard-workspace.is-presenting .dashboard-properties,
.dashboard-workspace.is-presenting .canvas-toolbar,
.dashboard-workspace.is-presenting .dashboard-item-actions {
  display: none;
}

.workspace-mode-bar {
  border-color: rgba(153, 229, 80, 0.44);
  background: linear-gradient(135deg, rgba(153, 229, 80, 0.12), #ffffff);
}

@media (max-width: 1100px) {
  body.sidebar-collapsed {
    --sidebar-width: 300px;
  }

  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  body.sidebar-collapsed .sidebar {
    gap: var(--space-6);
    padding: var(--space-6) 18px;
    overflow: hidden auto;
  }

  body.sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 2px 2px var(--space-4);
  }

  body.sidebar-collapsed .brand > div,
  body.sidebar-collapsed .quick-access-drawer,
  body.sidebar-collapsed .sidebar-bottom {
    display: block;
  }

  body.sidebar-collapsed .sidebar-toggle {
    position: static;
    margin-left: auto;
    background: rgba(245, 245, 247, 0.08);
    box-shadow: none;
  }

  body.sidebar-collapsed .nav-list {
    gap: var(--space-2);
  }

  body.sidebar-collapsed .nav-list a {
    min-height: 48px;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-btn);
  }

  body.sidebar-collapsed .nav-list a strong {
    position: static;
    width: auto;
    max-width: none;
    transform: none;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    padding: 0;
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-collapsed .nav-list a em {
    position: static;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
  }

  body.sidebar-collapsed .nav-list a span {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

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

  .studio-grid {
    grid-template-columns: 1fr;
  }

  .viewer {
    position: static;
  }

  .upload-band,
  .source-grid,
  .query-library-layout,
  .governance-grid,
  .system-health-summary,
  .profile-grid,
  .profile-kpi-strip,
  .profile-health-panel,
  .dashboard-storage-summary,
  .builder-hero,
  .dashboard-builder-shell,
  .source-modal-layout {
    grid-template-columns: 1fr;
  }

  .source-guidance {
    position: static;
  }

  .paste-import-header {
    grid-template-columns: 1fr;
  }

  .paste-editor-shell {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 320px;
  }

  .paste-source-card textarea {
    min-height: 320px;
    font-size: 12px;
  }

  .dashboard-query-library,
  .dashboard-canvas,
  .dashboard-properties {
    grid-column: 1;
  }

  .dashboard-properties {
    position: static;
  }

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

  .next-action-bar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  #fuentes .module-header,
  #queryBuilder .module-header {
    grid-template-columns: 1fr;
  }

  #queryBuilder .topbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #queryBuilder .toolbar-group {
    border-right: 0;
    padding-right: 0;
  }

  .query-connector-card {
    grid-template-columns: 1fr;
  }

  .query-connector-card .secondary-button {
    width: 100%;
  }

  .workspace-progress {
    grid-template-columns: 58px minmax(0, 1fr);
  }

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

  .workspace-progress-steps button {
    justify-content: flex-start;
  }

  .sources-entry-band {
    grid-template-columns: 1fr;
  }

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

}

@media (max-width: 1240px) {
  .source-item-header {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .source-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .source-body-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    grid-template-columns: 1fr;
    padding-bottom: 82px;
  }

  .workspace,
  .sidebar {
    padding: 24px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    min-height: auto;
    padding: 12px 24px;
    background: var(--ink);
    border-bottom: 1px solid rgba(245, 245, 247, 0.1);
    box-shadow: 0 2px 12px rgba(10, 31, 68, 0.16);
  }

  .sidebar-top {
    gap: 0;
  }

  .brand {
    min-height: 38px;
    padding: 0;
    gap: 9px;
    border-bottom: 0;
  }

  .brand-mark {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .brand-mark img {
    width: 27px;
    height: 27px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand span {
    font-size: 11px;
  }

  .nav-list {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    min-height: 72px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 -6px 18px rgba(10, 31, 68, 0.08);
  }

  .nav-list a {
    min-height: 56px;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    border-radius: var(--radius-btn);
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
    flex-direction: column;
    color: var(--muted);
  }

  .nav-list a strong {
    flex: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-list a em {
    position: absolute;
    top: 4px;
    right: 5px;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
  }

  .nav-list a span {
    width: 24px;
    height: 24px;
    background: rgba(10, 31, 68, 0.06);
    color: var(--teal);
  }

  .nav-list a.active::before {
    left: 50%;
    bottom: 4px;
    width: 24px;
    height: 3px;
    transform: translateX(-50%);
    background: var(--accent);
  }

  .nav-list a.active,
  .nav-list a:hover {
    background: rgba(30, 116, 230, 0.08);
    color: var(--ink);
  }

  .nav-list a.active span,
  .nav-list a:hover span {
    background: rgba(153, 229, 80, 0.2);
    color: var(--ink);
  }

  .quick-access-drawer,
  .sidebar-bottom {
    display: none;
  }

  .viewer-header,
  .module-header,
  .modal-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  #queryBuilder .module-header h2,
  #fuentes .module-header h2 {
    font-size: 30px;
  }

  #queryBuilder .topbar-actions {
    grid-template-columns: 1fr;
  }

  #queryBuilder .topbar-actions .secondary-button,
  #queryBuilder .topbar-actions .primary-button {
    min-width: 0;
    width: 100%;
  }

  #queryBuilder .query-quick-templates button,
  #queryBuilder .mini-button,
  #queryBuilder .library-tab {
    min-height: 40px;
  }

  #queryBuilder .summary-chip button,
  #queryBuilder .sort-chip button {
    width: 40px;
    height: 40px;
  }

  #clearJoins,
  #clearFilters,
  #clearSummaryGroups,
  #clearSummaryFunctions,
  #clearSorts {
    min-height: 40px;
  }

  .module-actions {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
  }

  .module-actions .primary-button,
  .module-actions .secondary-button {
    min-width: 0;
  }

  .preview-controls {
    width: 100%;
    justify-items: stretch;
    grid-template-columns: 1fr;
  }

  .drive-row,
  .modal-grid,
  .source-action-row,
  .profile-form-grid,
  .profile-health-checks,
  .organization-summary,
  .organization-columns {
    grid-template-columns: 1fr;
  }

  .profile-activity-list article {
    grid-template-columns: 1fr;
  }

  .profile-activity-list article p {
    grid-column: auto;
  }

  .profile-activity-list article em {
    justify-self: start;
  }

  .workspace-progress {
    grid-template-columns: 1fr;
  }

  .workspace-progress-meter {
    width: 100%;
    height: auto;
    min-height: 42px;
    grid-auto-flow: column;
    gap: 6px;
    border-radius: var(--radius-card);
    background:
      linear-gradient(90deg, rgba(153, 229, 80, 0.22) var(--workspace-progress), rgba(10, 31, 68, 0.06) 0),
      #ffffff;
  }

  .workspace-progress-steps {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace-progress-steps button {
    min-height: 40px;
  }

  .next-action-cta {
    width: 100%;
  }

  .sources-entry-band {
    padding: 20px;
  }

  .sources-entry-band h2 {
    font-size: 24px;
  }

  .source-entry-actions {
    grid-template-columns: 1fr;
  }

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

  .query-flow {
    top: 72px;
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, 1fr);
    grid-template-columns: none;
    scroll-snap-type: x proximity;
  }

  .query-flow button {
    scroll-snap-align: start;
  }

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

  .module-actions {
    justify-content: stretch;
  }

  .module-actions > * {
    width: 100%;
  }

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

  .source-item {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .source-item-header,
  .source-body-grid,
  .source-collapsible-row,
  .source-table-model-grid,
  .dashboard-command-center,
  .dashboard-command-metrics,
  .source-compact-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-command-metrics article {
    border-right: 0;
    border-bottom: 1px solid rgba(10, 31, 68, 0.08);
  }

  .dashboard-command-metrics article:last-child {
    border-bottom: 0;
  }

  .source-state-row {
    justify-content: flex-start;
  }

  .source-actions {
    position: static;
    justify-content: flex-start;
  }

  .source-name-input {
    font-size: 16px;
  }

  .library-grid,
  .saved-grid,
  .dashboard-toolbar,
  .dashboard-note-box,
  .dashboard-toolbar.dashboard-structure,
  .dashboard-filters,
  .step-actions,
  .field-row {
    grid-template-columns: 1fr;
  }

  .dashboard-card.size-large {
    grid-column: span 1;
  }

  .empty-choice-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-workspace {
    min-width: 0;
    padding: 12px;
  }

  .dashboard-workspace.width-full {
    margin-left: 0;
    margin-right: 0;
  }

  .dashboard-workspace-header {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .dashboard-workspace-header > *,
  .dashboard-header-actions {
    min-width: 0;
    max-width: 100%;
  }

  .dashboard-header-actions {
    width: 100%;
    justify-content: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-header-actions > * {
    width: 100%;
    min-width: 0;
  }

  .dashboard-board-viewport {
    width: 100%;
    min-height: 420px;
    height: auto;
    overflow: visible;
  }

  .dashboard-board {
    width: 100%;
    min-height: auto;
    display: grid;
    gap: 12px;
    padding: 12px;
  }

  .dashboard-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .dashboard-board::before,
  .dashboard-board::after {
    display: none;
  }

  .dashboard-card p,
  .dashboard-card strong,
  .dashboard-card span,
  .dashboard-card button {
    overflow-wrap: anywhere;
  }

  .canvas-toolbar {
    position: static;
    width: 100%;
    max-width: 100%;
    justify-content: stretch;
    margin-top: 10px;
  }

  .canvas-toolbar > *,
  .canvas-toolbar .mini-button {
    min-width: 0;
    flex: 1 1 140px;
  }

  .dashboard-resize-handle {
    display: none !important;
  }

  .chart-canvas {
    padding: 14px;
  }

  .chart-svg {
    height: 380px;
  }
}

@media print {
  body.print-dashboard {
    display: block;
    background: white;
  }

  body.print-dashboard .sidebar,
  body.print-dashboard .module-header,
  body.print-dashboard .dashboard-history-panel,
  body.print-dashboard .dashboard-toolbar,
  body.print-dashboard .dashboard-note-box,
  body.print-dashboard .dashboard-filters,
  body.print-dashboard .dashboard-query-library,
  body.print-dashboard .dashboard-properties,
  body.print-dashboard .canvas-toolbar,
  body.print-dashboard .ai-analysis-panel,
  body.print-dashboard .dashboard-section-tab-list,
  body.print-dashboard .dashboard-item-actions,
  body.print-dashboard .dashboard-resize-handle,
  body.print-dashboard .mini-button {
    display: none !important;
  }

  body.print-dashboard .workspace {
    padding: 0;
  }

  body.print-dashboard .module-page {
    display: none !important;
  }

  body.print-dashboard #dashboards {
    display: block !important;
  }

  body.print-dashboard .dashboard-workspace {
    border: 0;
    padding: 0;
  }

  body.print-dashboard .dashboard-builder-shell {
    display: block;
  }

  body.print-dashboard .dashboard-board-viewport {
    max-height: none;
    overflow: visible;
    border: 0;
    background: white;
  }

  body.print-dashboard .dashboard-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: auto;
    min-height: auto;
    transform: none !important;
    background: white;
  }

  body.print-dashboard .dashboard-board::before,
  body.print-dashboard .dashboard-board::after {
    display: none;
  }

body.print-dashboard .dashboard-card {
    position: static;
    width: auto !important;
    min-height: 180px;
    max-width: none;
  }
}

/* UX polish: softer controls, clearer chart surfaces and denser dashboard scanning. */
:root {
  --radius-btn: 999px;
  --radius-card: 16px;
  --radius-panel: 18px;
  --control-shadow: 0 10px 22px rgba(10, 31, 68, 0.1);
  --control-shadow-hover: 0 14px 30px rgba(10, 31, 68, 0.16);
}

.primary-button,
.secondary-button,
.chip-button,
.mini-button,
.icon-button,
.tab-icon-button,
.ghost-button,
.account-action-button,
.source-type-button,
.library-tab,
.profile-section-tabs button,
.dashboard-section-tab > button:first-child,
.dashboard-tab-main {
  border-radius: var(--radius-btn);
}

.primary-button,
.secondary-button,
.chip-button,
.mini-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateY(0);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #a2ff00, #99e550);
  border: 1px solid rgba(162, 255, 0, 0.65);
  color: #111415;
  box-shadow: 0 10px 22px rgba(162, 255, 0, 0.2);
}

.primary-button:hover {
  background: linear-gradient(135deg, #b8ff38, #a2ff00);
  box-shadow: 0 16px 32px rgba(162, 255, 0, 0.28);
  transform: translateY(-1px);
}

.secondary-button,
.chip-button,
.mini-button {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(10, 31, 68, 0.14);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(10, 31, 68, 0.06);
}

.secondary-button:hover,
.chip-button:hover,
.mini-button:hover {
  background: rgba(30, 116, 230, 0.08);
  border-color: rgba(30, 116, 230, 0.38);
  box-shadow: var(--control-shadow-hover);
  transform: translateY(-1px);
}

.dashboard-card .icon-mini,
.dashboard-card .size-step-button,
.dashboard-item-actions .mini-button,
.dashboard-inline-size-controls .mini-button {
  min-height: 20px;
  box-shadow: none;
  gap: 0;
}

.dashboard-card .icon-mini {
  width: 24px;
  height: 24px;
}

.dashboard-card .size-step-button,
.dashboard-inline-size-controls .size-step-button {
  width: 24px;
  height: 20px;
}

.dashboard-item-actions .mini-button:hover,
.dashboard-inline-size-controls .mini-button:hover {
  box-shadow: 0 0 0 2px rgba(30, 116, 230, 0.1);
  transform: none;
}

.danger-button:hover {
  background: rgba(249, 115, 22, 0.1) !important;
  border-color: rgba(249, 115, 22, 0.45) !important;
  color: #9a3412 !important;
}

input,
select,
textarea {
  border-radius: 14px;
}

.module-header,
.builder,
.viewer,
.report-library,
.upload-band,
.source-table-card,
.dashboard-workspace,
.dashboard-history-panel,
.profile-card,
.governance-card,
.chart-shell,
.query-step,
.summary-config-block,
.dashboard-card {
  border-radius: var(--radius-panel);
}

.chart-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(10, 31, 68, 0.1);
  background:
    linear-gradient(135deg, rgba(162, 255, 0, 0.1), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 18px 46px rgba(10, 31, 68, 0.1);
}

.chart-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(30, 116, 230, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(30, 116, 230, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 70%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 70%);
}

.chart-selection-pill,
.query-readable,
.chart-recommendation,
.chart-data-panel,
.include-panel,
.chart-canvas {
  position: relative;
  z-index: 1;
}

.chart-selection-pill {
  width: fit-content;
  padding: 7px 12px;
  border: 1px solid rgba(162, 255, 0, 0.48);
  border-radius: var(--radius-btn);
  background: rgba(162, 255, 0, 0.14);
  color: #111415;
  font-size: 12px;
  font-weight: 900;
}

.query-readable {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 31, 68, 0.06);
  color: var(--ink);
}

.chart-canvas {
  border-top: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(10, 31, 68, 0.08);
}

.chart-svg {
  filter: drop-shadow(0 14px 22px rgba(10, 31, 68, 0.08));
}

.chart-svg rect {
  filter: drop-shadow(0 6px 8px rgba(10, 31, 68, 0.1));
  transition: opacity 140ms ease, transform 140ms ease, filter 140ms ease;
}

.chart-svg rect:hover,
.chart-svg [data-tooltip]:hover {
  opacity: 0.9;
  filter: drop-shadow(0 10px 14px rgba(10, 31, 68, 0.16));
}

.chart-svg polyline {
  filter: drop-shadow(0 8px 10px rgba(30, 116, 230, 0.18));
}

.grid-line {
  stroke: rgba(10, 31, 68, 0.08);
}

.axis {
  stroke: rgba(10, 31, 68, 0.18);
}

.chart-text,
.chart-value-label {
  fill: var(--ink);
  font-weight: 850;
}

.chart-tooltip {
  border-radius: 14px;
  background: #111415;
  color: #e2e2e2;
  box-shadow: 0 18px 36px rgba(17, 20, 21, 0.28);
}

.chart-recommendation-card,
.include-card,
.dashboard-query-card,
.library-card,
.saved-card {
  border-radius: var(--radius-card);
}

.dashboard-preview,
.dashboard-line-preview,
.dashboard-stacked-preview,
.dashboard-kpi-preview,
.dashboard-table-preview {
  border-radius: var(--radius-card);
  background: rgba(248, 250, 252, 0.66);
  border-color: rgba(10, 31, 68, 0.06);
}

.dashboard-preview span {
  border-radius: 999px 999px 8px 8px;
  box-shadow: 0 8px 14px rgba(10, 31, 68, 0.12);
}

.dashboard-card.is-selected {
  outline: 3px solid rgba(162, 255, 0, 0.62);
  box-shadow: 0 24px 54px rgba(10, 31, 68, 0.18);
}

.workspace-mode-bar,
.workspace-mode-bar span {
  border-radius: var(--radius-btn);
}

/* Workspace polish: keep dashboard editing fast, compact and unobstructed. */
.dashboard-workspace-header {
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.dashboard-workspace-header .eyebrow {
  margin-bottom: 3px;
  font-size: 11px;
}

.dashboard-workspace-header h2 {
  margin-bottom: 4px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.04;
}

.dashboard-workspace-header p:not(.eyebrow) {
  max-width: 780px;
  font-size: 14px;
  line-height: 1.45;
}

.dashboard-header-actions {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: end;
  align-items: center;
  gap: 8px;
  max-width: 680px;
}

.dashboard-header-actions .module-status {
  min-height: 34px;
  padding-inline: 12px;
  font-size: 11px;
}

.dashboard-header-actions .primary-button,
.dashboard-header-actions .action-button {
  min-height: 38px;
  min-width: 132px;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-header-actions .module-status,
.dashboard-header-actions .primary-button {
  min-width: 168px;
}

@media (max-width: 1280px) {
  .dashboard-header-actions {
    grid-template-columns: repeat(2, max-content);
    max-width: 460px;
  }
}

.dashboard-filter-strip {
  gap: 6px;
  margin: 0 0 8px;
}

.dashboard-filter-strip span {
  padding: 5px 9px;
  font-size: 11px;
}

.workspace-label {
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  min-height: 48px;
  padding-right: 0;
  position: relative;
}

.workspace-label .eyebrow {
  margin-bottom: 2px;
  font-size: 11px;
}

.workspace-label h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.workspace-label span {
  display: none;
}

.canvas-toolbar {
  position: absolute;
  top: 108px;
  right: 10px;
  left: auto;
  bottom: auto;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 112px;
  height: 42px;
  max-width: 118px;
  max-height: 42px;
  min-height: 42px;
  margin: 0 0 0 auto;
  padding: 5px 10px;
  overflow: hidden;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(10, 31, 68, 0.1);
  transition: width 0.2s ease, max-width 0.2s ease, max-height 0.2s ease, border-radius 0.2s ease, padding 0.2s ease, box-shadow 0.2s ease;
}

.canvas-toolbar::before {
  content: "Controles";
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.canvas-toolbar:hover,
.canvas-toolbar:focus-within {
  display: grid;
  grid-template-columns: repeat(3, minmax(34px, auto));
  justify-items: stretch;
  align-items: center;
  width: min(330px, calc(100vw - 48px));
  max-width: 330px;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 6px;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(10, 31, 68, 0.14);
}

.canvas-toolbar:hover::before,
.canvas-toolbar:focus-within::before {
  display: none;
}

.canvas-toolbar:not(:hover):not(:focus-within) > * {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding-inline: 0 !important;
  border-width: 0 !important;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.canvas-toolbar [title] {
  position: relative;
}

.canvas-toolbar [title]:hover::after,
.canvas-toolbar [title]:focus-visible::after,
.canvas-toolbar label[title]:hover::after,
.canvas-toolbar label[title]:focus-within::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 90;
  width: max-content;
  max-width: 220px;
  transform: translateX(-50%);
  border: 1px solid rgba(245, 245, 247, 0.14);
  border-radius: 10px;
  background: #111415;
  color: #f5f5f7;
  box-shadow: 0 14px 30px rgba(10, 31, 68, 0.22);
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  pointer-events: none;
}

.canvas-toolbar [title]:hover::before,
.canvas-toolbar [title]:focus-visible::before,
.canvas-toolbar label[title]:hover::before,
.canvas-toolbar label[title]:focus-within::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 91;
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  background: #111415;
}

.canvas-toolbar > span,
.snap-toggle,
.canvas-toolbar .mini-button {
  min-height: 34px;
  border-radius: 999px;
  padding-inline: 10px;
  font-size: 11px;
}

.canvas-toolbar .mini-button {
  min-width: 36px;
}

.canvas-toolbar #canvasPanMode,
.canvas-toolbar #canvasZoomReset,
.canvas-toolbar #canvasCenter,
.canvas-toolbar #canvasFullscreen,
.canvas-toolbar #toggleQueryPanel,
.canvas-toolbar #toggleToolsPanel,
.canvas-toolbar #togglePropertiesPanel {
  min-width: auto;
  padding-inline: 10px;
  font-size: 10px;
}

.canvas-toolbar:hover .grid-size-control,
.canvas-toolbar:focus-within .grid-size-control,
.canvas-toolbar:hover .snap-toggle,
.canvas-toolbar:focus-within .snap-toggle {
  grid-column: span 3;
  justify-content: center;
}

.compact-canvas-toolbar,
.compact-canvas-toolbar:hover,
.compact-canvas-toolbar:focus-within {
  position: static;
  display: flex;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 44px;
  max-height: none;
  justify-content: flex-start;
  gap: 8px;
  margin: 8px 0 0;
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 12px;
  padding: 6px;
  scrollbar-width: thin;
}

.compact-canvas-toolbar::before,
.compact-canvas-toolbar:hover::before,
.compact-canvas-toolbar:focus-within::before {
  display: none;
}

.compact-canvas-toolbar:not(:hover):not(:focus-within) > * {
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  padding-inline: initial !important;
  border-width: initial !important;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
}

.canvas-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-right: 1px solid rgba(10, 31, 68, 0.1);
  padding-right: 8px;
  flex: 0 0 auto;
}

.canvas-tool-group:last-child {
  border-right: 0;
  padding-right: 0;
}

.compact-canvas-toolbar .icon-mini {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 14px;
}

.canvas-zoom-chip {
  min-width: 52px;
  justify-content: center;
}

.canvas-grid-group .snap-toggle {
  min-height: 34px;
}

.dashboard-canvas .compact-canvas-toolbar,
.dashboard-canvas .compact-canvas-toolbar:hover,
.dashboard-canvas .compact-canvas-toolbar:focus-within {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 26;
  width: auto;
  max-width: min(560px, calc(100% - 28px));
  min-height: 0;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
  border-radius: 999px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(10, 31, 68, 0.12);
}

.dashboard-canvas .canvas-tool-group {
  gap: 3px;
  padding-right: 6px;
}

.dashboard-canvas .canvas-grid-group {
  max-width: 156px;
}

.dashboard-canvas .compact-canvas-toolbar .icon-mini {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.dashboard-canvas .canvas-zoom-chip {
  min-width: 44px;
  min-height: 32px;
  padding-inline: 8px;
}

.dashboard-canvas .grid-size-control span,
.dashboard-canvas .snap-toggle span {
  display: none;
}

.dashboard-canvas .grid-size-control select {
  width: 54px;
  padding-left: 2px;
}

.dashboard-board-viewport {
  padding-top: 52px;
}

@media (max-width: 1180px) {
  .dashboard-command-center {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .dashboard-library-controls {
    grid-template-columns: 1fr;
  }

  .compact-canvas-toolbar {
    border-radius: 999px;
    left: 10px;
    right: 10px;
    max-width: calc(100% - 20px);
    overflow-x: auto;
    justify-content: flex-start;
  }

  .canvas-tool-group {
    padding-right: 6px;
  }
}

.workspace-mode-bar {
  gap: 6px;
  margin: 6px 0 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-mode-bar span,
.workspace-mode-bar button {
  min-height: 24px;
  padding-inline: 8px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(10, 31, 68, 0.04);
}

.dashboard-section-tabs {
  margin-top: 6px;
}

.dashboard-section-tab-list {
  gap: 6px;
}

.dashboard-section-tab {
  min-height: 30px;
  gap: 3px;
  padding: 2px;
  border-radius: 12px;
}

.dashboard-section-tab > button:first-child {
  min-height: 26px;
  padding-inline: 7px;
  font-size: 11px;
}

.dashboard-section-tab span {
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  font-size: 10px;
}

.dashboard-section-tab .tab-icon-button {
  min-height: 26px;
  padding-inline: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.dashboard-section-tab:hover .tab-icon-button,
.dashboard-section-tab:focus-within .tab-icon-button,
.dashboard-section-tab.active .tab-icon-button {
  opacity: 1;
  pointer-events: auto;
}

.dashboard-board-viewport {
  padding-right: 52px;
}

.dashboard-workspace.is-presenting .dashboard-board-viewport {
  padding-right: 0;
}

/* Production visual QA: prevent oversized controls, clipped text and panel overflow. */
.workspace,
.module-page,
.module-header,
.dashboard-workspace,
.dashboard-workspace-header,
.dashboard-builder-shell,
.dashboard-canvas,
.dashboard-board-viewport,
.dashboard-board,
.query-flow,
.source-item,
.source-body-grid,
.chart-shell,
.profile-card,
.governance-card {
  min-width: 0;
  max-width: 100%;
}

.module-header *,
.dashboard-workspace-header *,
.dashboard-card *,
.source-item *,
.query-step *,
.profile-card *,
.governance-card * {
  overflow-wrap: anywhere;
}

.dashboard-header-actions,
.topbar-actions,
.card-actions,
.source-actions,
.dashboard-tab-actions {
  min-width: 0;
}

.dashboard-header-actions .primary-button,
.dashboard-header-actions .secondary-button,
.topbar-actions .primary-button,
.topbar-actions .secondary-button,
.source-actions .primary-button,
.source-actions .secondary-button {
  max-width: 100%;
}

.dashboard-properties,
.dashboard-query-library,
.source-modal,
.dashboard-preview-panel {
  max-width: calc(100vw - 32px);
}

.dashboard-properties {
  top: 96px;
  right: 18px;
  width: min(300px, calc(100vw - 36px));
  max-height: calc(100vh - 118px);
  padding: 12px;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(10, 31, 68, 0.16);
}

.dashboard-properties:has(.property-empty) {
  display: none !important;
}

/* Dimensional QA guardrails for production: prevent cramped modules and undersized controls. */
.icon-action,
.profile-section-tabs button,
.ghost-button {
  min-width: 40px;
  min-height: 40px;
}

.profile-section-tabs button {
  padding-block: 0;
}

#queryBuilder .query-quick-templates button,
#queryBuilder .mini-button,
#queryBuilder .library-tab,
#clearJoins,
#clearFilters,
#clearSummaryGroups,
#clearSummaryFunctions,
#clearSorts {
  min-height: 40px;
}

@media (max-width: 680px) {
  .workspace,
  .module-page,
  .studio-grid,
  .builder,
  .viewer,
  .report-library,
  .builder-hero,
  .query-summary-card,
  .query-quick-templates,
  .query-flow,
  .query-step,
  .chart-shell,
  .chart-canvas,
  .source-table-card,
  .source-item,
  .dashboard-workspace,
  .profile-card,
  .governance-card {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #queryBuilder .builder,
  #queryBuilder .viewer,
  #queryBuilder .report-library {
    width: 100%;
    padding: 14px;
  }

  #queryBuilder .builder-hero,
  #queryBuilder .query-summary-card,
  #queryBuilder .query-quick-templates,
  #queryBuilder .query-flow,
  #queryBuilder .query-step,
  #queryBuilder .chart-shell,
  #queryBuilder .chart-canvas {
    width: 100%;
  }

  #queryBuilder .query-flow {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: 1fr;
    overflow-x: visible;
    scroll-snap-type: none;
  }

#queryBuilder .query-flow button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
  }
}

/* Dashboard header overlap fix: keep title/meta and actions in separate lanes. */
.dashboard-workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) fit-content(680px);
  align-items: start;
  column-gap: 28px;
}

.dashboard-workspace-header > :first-child {
  min-width: 0;
  max-width: 100%;
  padding-right: 4px;
}

.dashboard-workspace-header #activeDashboardTitle,
.dashboard-workspace-header #activeDashboardMeta {
  max-width: 100%;
}

.dashboard-workspace-header #activeDashboardMeta {
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: pretty;
}

.dashboard-header-actions {
  justify-self: end;
  width: max-content;
  max-width: min(680px, 100%);
}

@media (max-width: 1180px) {
  .dashboard-workspace-header {
    grid-template-columns: 1fr;
    row-gap: 14px;
  }

  .dashboard-header-actions {
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  body {
    --sidebar-width: 240px;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .workspace {
    min-width: 0;
    padding: 22px;
  }

  .sidebar {
    padding: 16px;
  }

  .nav-list a {
    min-height: 46px;
    padding: 8px 10px;
  }

  .nav-list a strong {
    font-size: 13px;
  }

  .quick-access-drawer,
  .sidebar-bottom {
    display: none;
  }

  .module-header,
  #fuentes .module-header,
  #queryBuilder .module-header,
  .dashboard-workspace-header {
    grid-template-columns: 1fr;
  }

  .module-actions,
  .topbar-actions,
  .dashboard-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-actions > *,
  .topbar-actions > *,
  .dashboard-header-actions > * {
    min-width: 0;
    width: 100%;
  }

  .studio-grid,
  #queryBuilder .studio-grid,
  .source-modal-layout,
  .dashboard-builder-shell,
  .profile-grid,
  .governance-grid,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .paste-import-header {
    grid-template-columns: 1fr;
  }

  .paste-editor-shell {
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 300px;
  }

  .paste-source-card textarea {
    min-height: 300px;
    font-size: 12px;
  }

  .dashboard-command-center {
    grid-template-columns: 1fr;
  }

  .dashboard-command-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-command-metrics article:nth-child(3n) {
    border-right: 0;
  }

  .dashboard-control-dock,
  .dashboard-workspace.show-tools-panel .dashboard-control-dock,
  .dashboard-query-library,
  .dashboard-workspace.show-library-panel .dashboard-query-library,
  .dashboard-properties {
    position: static;
    width: 100%;
    max-width: 100%;
    max-height: none;
    box-shadow: none;
  }

  .dashboard-toolbar,
  .dashboard-note-box,
  .dashboard-toolbar.dashboard-structure,
  .dashboard-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-board-viewport {
    max-width: 100%;
    overflow: auto;
  }

  .dashboard-board {
    min-width: 980px;
  }

  .source-collapsible-row {
    grid-template-columns: 1fr;
  }
}

/* Responsive hardening: keep mobile dashboard screens readable and tap-friendly. */
@media (max-width: 760px) {
  body {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    padding: 14px 12px calc(92px + env(safe-area-inset-bottom));
  }

  .sidebar {
    padding-inline: 12px;
  }

  .sidebar-toggle {
    display: none;
  }

  .module-section,
  .module-header,
  .dashboard-history-panel,
  .dashboard-workspace,
  .builder,
  .viewer,
  .report-library,
  .source-table-card,
  .profile-card,
  .governance-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .module-section,
  .module-header,
  .dashboard-history-panel,
  .dashboard-workspace {
    padding: 14px;
    border-radius: 16px;
  }

  .module-header h1,
  .module-header h2,
  .dashboard-workspace-header h2,
  .section-title h2 {
    font-size: clamp(24px, 8vw, 32px);
    line-height: 1.08;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .module-header p,
  .dashboard-workspace-header p,
  .section-copy {
    font-size: 14px;
    line-height: 1.45;
  }

  .dashboard-storage-summary,
  .dashboard-tabs {
    grid-template-columns: 1fr;
  }

  .dashboard-workspace-header {
    position: static;
    padding: 12px;
    gap: 12px;
  }

  .dashboard-header-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
  }

  .dashboard-header-actions > *,
  .dashboard-command-actions > *,
  .module-actions > * {
    width: 100%;
    min-width: 0;
  }

  .dashboard-command-center {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard-command-hero {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 14px;
  }

  .dashboard-command-copy strong {
    max-width: 100%;
    font-size: 20px;
    line-height: 1.14;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .dashboard-readiness-ring {
    width: 68px;
    height: 68px;
    justify-self: start;
  }

  .dashboard-command-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .dashboard-command-metrics article {
    min-height: 78px;
    border-right: 1px solid rgba(10, 31, 68, 0.08);
    border-bottom: 1px solid rgba(10, 31, 68, 0.08);
  }

  .dashboard-command-metrics article:nth-child(2n) {
    border-right: 0;
  }

  .dashboard-command-metrics article:last-child {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 0;
  }

  .dashboard-command-metrics strong,
  .dashboard-command-metrics span {
    white-space: normal;
    overflow-wrap: break-word;
  }

  .workspace-mode-bar {
    border-radius: 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  .workspace-mode-bar span,
  .workspace-mode-bar button {
    flex: 0 0 auto;
  }

  .dashboard-board-viewport {
    min-height: 360px;
    max-height: none;
    overflow: visible;
  }

  .dashboard-board {
    display: grid;
    width: 100%;
    min-height: auto;
    padding: 10px;
    transform: none !important;
  }

  .dashboard-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 190px;
  }

  .dashboard-card-top {
    grid-template-columns: 1fr;
  }

  .dashboard-item-action-stack {
    top: 8px;
    right: 8px;
    width: auto;
    justify-items: end;
  }

  .dashboard-item-actions,
  .dashboard-inline-size-controls {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .dashboard-item-actions {
    display: flex;
  }

  .dashboard-inline-size-controls {
    left: 10px;
    bottom: 10px;
    grid-template-columns: repeat(4, 24px);
  }

  .dashboard-item-actions .mini-button,
  .dashboard-inline-size-controls .mini-button {
    width: 24px;
    min-width: 0;
  }

  .property-row,
  .property-row.three-cols,
  .property-size-presets {
    grid-template-columns: 1fr;
  }

  .dashboard-card strong,
  .dashboard-card p,
  .dashboard-card span,
  .dashboard-card button {
    word-break: normal;
    overflow-wrap: break-word;
  }

  .canvas-toolbar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    margin: 10px 0;
    border-radius: 16px;
  }

  .canvas-toolbar::before {
    display: none;
  }

  .canvas-toolbar:not(:hover):not(:focus-within) > * {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 10px !important;
    border-width: 1px !important;
    opacity: 1;
    pointer-events: auto;
  }

  .canvas-toolbar .mini-button,
  .canvas-toolbar > span,
  .snap-toggle {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .dashboard-query-library,
  .dashboard-workspace.show-library-panel .dashboard-query-library,
  .dashboard-workspace.show-tools-panel .dashboard-control-dock,
  .dashboard-properties {
    position: static;
    width: 100%;
    max-width: 100%;
    max-height: none;
    box-shadow: none;
  }

  #dashboardQueryLibrary {
    grid-template-columns: 1fr;
  }
}

/* Dashboard editing needs a real canvas even in narrow browser panes. */
@media (max-width: 1100px) {
  #dashboards .dashboard-board-viewport {
    min-height: 620px;
    max-height: min(78vh, 980px);
    overflow: auto;
  }

  #dashboards .dashboard-board {
    display: block !important;
    width: max(1400px, 100%) !important;
    min-height: 720px !important;
    padding: 0 !important;
  }

  #dashboards .dashboard-card {
    position: absolute !important;
    width: auto !important;
    max-width: calc(100% - 32px);
  }
}

@media (max-width: 380px) {
  .workspace {
    padding-inline: 10px;
  }

  .module-section,
  .module-header,
  .dashboard-history-panel,
  .dashboard-workspace {
    padding: 12px;
  }

  .nav-list a strong {
    display: none;
  }

  .nav-list a {
    min-height: 54px;
  }

  .dashboard-command-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-command-metrics article,
  .dashboard-command-metrics article:nth-child(2n) {
    border-right: 0;
  }
}

/* Login responsive rescue: simple, readable and full-width on phones/tablets. */
@media (max-width: 1100px) {
  body[data-authenticated="false"] {
    display: block;
    background: #f5f5f7;
  }

  body[data-authenticated="false"] .workspace {
    width: 100%;
    min-height: 100vh;
    padding: 0;
  }

  body[data-authenticated="false"] .module-page.active {
    content-visibility: visible;
    contain-intrinsic-size: auto;
  }

  .login-page {
    min-height: 100vh;
    padding: clamp(16px, 4vw, 32px);
    background:
      linear-gradient(180deg, #0a1f44 0, #0a1f44 270px, #f5f5f7 270px, #f5f5f7 100%);
  }

  .login-shell {
    width: min(720px, 100%);
    min-height: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
  }

  .login-card,
  .login-side-card {
    width: 100%;
    min-width: 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 44px rgba(10, 31, 68, 0.14);
  }

  .login-card {
    gap: 18px;
    padding: clamp(20px, 5vw, 34px);
  }

  .login-card h1 {
    max-width: 100%;
    margin-bottom: 10px;
    font-size: clamp(32px, 9vw, 46px);
    line-height: 1.05;
    letter-spacing: 0;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .login-card p {
    max-width: 100%;
    font-size: 16px;
    line-height: 1.45;
  }

  .local-first-notice {
    border-radius: 14px;
    padding: 12px;
  }

  .login-start-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .login-start-grid article {
    min-height: auto;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 4px 12px;
    padding: 12px;
  }

  .login-start-grid article > span {
    grid-row: span 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
  }

  .login-start-grid article > strong,
  .login-start-grid article > p {
    min-width: 0;
  }

  .login-start-grid article > p {
    grid-column: 2;
  }

  .login-form {
    gap: 12px;
  }

  .login-form label,
  .login-form input,
  .login-form select,
  .login-form button,
  .google-login-zone,
  .google-signin-slot,
  .module-status {
    width: 100%;
    min-width: 0;
  }

  .login-side-card {
    padding: 16px;
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 12px;
    background:
      linear-gradient(180deg, #0a1f44 0, #0a1f44 220px, #f5f5f7 220px, #f5f5f7 100%);
  }

  .login-card,
  .login-side-card {
    border-radius: 16px;
  }

  .login-card {
    padding: 18px;
  }

  .login-card h1 {
    font-size: clamp(30px, 10vw, 40px);
  }

  .login-card .eyebrow {
    color: #1e74e6;
  }

  .login-divider {
    margin: 2px 0;
  }

  .login-profile-card {
    padding: 12px;
  }
}

/* Visualization polish: clearer hierarchy for charts, KPIs and dashboard cards. */
.chart-shell {
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)),
    #ffffff;
  box-shadow: 0 18px 44px rgba(10, 31, 68, 0.1);
}

.chart-canvas {
  min-height: clamp(360px, 48vw, 560px);
  padding: clamp(14px, 2.4vw, 28px);
}

.chart-svg {
  height: clamp(320px, 42vw, 520px);
}

.grid-line {
  stroke: rgba(10, 31, 68, 0.07);
}

.axis {
  stroke: rgba(10, 31, 68, 0.2);
}

.chart-text {
  fill: rgba(10, 31, 68, 0.68);
  font-weight: 750;
}

.chart-value-label {
  font-size: 11px;
  stroke-width: 5px;
}

.chart-insight-strip {
  border-color: rgba(30, 116, 230, 0.12);
  border-radius: 14px;
  background: rgba(30, 116, 230, 0.05);
}

.kpi-view {
  min-height: clamp(300px, 44vw, 480px);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 40%, rgba(153, 229, 80, 0.2), transparent 38%),
    linear-gradient(180deg, #ffffff, #f8fafc);
}

.kpi-value {
  color: #0a1f44;
  text-wrap: balance;
}

.dashboard-card {
  border-color: rgba(10, 31, 68, 0.08);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 253, 255, 0.98)),
    #ffffff;
  box-shadow: 0 12px 30px rgba(10, 31, 68, 0.08);
}

.dashboard-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(10, 31, 68, 0.12);
}

.dashboard-board.is-editing .dashboard-card:hover {
  transform: none;
}

.dashboard-card-top {
  align-items: start;
  gap: 10px;
}

.dashboard-card strong {
  color: #0a1f44;
  line-height: 1.18;
}

.dashboard-preview,
.dashboard-line-preview,
.dashboard-stacked-preview,
.dashboard-kpi-preview,
.dashboard-table-preview,
.dashboard-spatial-preview {
  border-color: rgba(10, 31, 68, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.94)),
    #ffffff;
}

.dashboard-preview {
  align-items: stretch;
  padding: 18px 14px 12px;
  gap: 7px;
}

.dashboard-preview span {
  align-self: end;
  min-height: 8px;
  border-radius: 8px 8px 3px 3px;
  box-shadow: inset 0 -8px 16px rgba(10, 31, 68, 0.12);
}

.dashboard-preview span em {
  bottom: calc(100% + 5px);
  font-size: 9px;
  color: rgba(10, 31, 68, 0.72);
}

.dashboard-kpi-preview {
  min-height: 118px;
  place-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 36%, rgba(153, 229, 80, 0.18), transparent 42%),
    #ffffff;
}

.dashboard-kpi-preview strong {
  font-size: clamp(32px, 6vw, 52px);
}

.dashboard-kpi-preview span {
  text-transform: uppercase;
  letter-spacing: 0;
}

.dashboard-table-preview {
  overflow: auto;
}

.dashboard-table-preview table {
  min-width: 420px;
}

.dashboard-table-preview th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.dashboard-mini-legend {
  padding-top: 4px;
}

.card-meta span,
.meta-button {
  background: rgba(10, 31, 68, 0.04);
  border-radius: 999px;
  padding: 4px 7px;
}

.dashboard-command-hero,
.dashboard-command-metrics {
  box-shadow: 0 14px 34px rgba(10, 31, 68, 0.08);
}

.dashboard-visual-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(10, 31, 68, 0.08);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(10, 31, 68, 0.06);
  padding: 8px;
}

.dashboard-visual-controls span {
  padding: 0 8px;
  color: rgba(10, 31, 68, 0.62);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-visual-controls button {
  min-height: 34px;
  border: 1px solid rgba(10, 31, 68, 0.1);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.9);
  color: #0a1f44;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.dashboard-visual-controls button.active {
  border-color: rgba(153, 229, 80, 0.7);
  background: rgba(153, 229, 80, 0.24);
  box-shadow: inset 0 0 0 1px rgba(153, 229, 80, 0.24);
}

.dashboard-workspace.visual-compact .dashboard-card {
  gap: 7px;
  padding: 12px;
}

.dashboard-workspace.visual-compact .dashboard-card p,
.dashboard-workspace.visual-compact .card-meta span:nth-child(n + 3) {
  display: none;
}

.dashboard-workspace.visual-compact .dashboard-preview,
.dashboard-workspace.visual-compact .dashboard-line-preview,
.dashboard-workspace.visual-compact .dashboard-stacked-preview {
  min-height: 110px;
}

.dashboard-workspace.visual-presentation .dashboard-card {
  border-color: rgba(10, 31, 68, 0.06);
  box-shadow: 0 8px 24px rgba(10, 31, 68, 0.08);
}

.dashboard-workspace.visual-presentation .dashboard-card p,
.dashboard-workspace.visual-presentation .card-meta {
  display: none;
}

.dashboard-workspace.visual-presentation .dashboard-board {
  background: #ffffff;
}

.dashboard-workspace.visual-presentation .dashboard-preview,
.dashboard-workspace.visual-presentation .dashboard-line-preview,
.dashboard-workspace.visual-presentation .dashboard-stacked-preview {
  background: #ffffff;
}

@media (max-width: 760px) {
  .chart-shell {
    min-height: auto;
    border-radius: 16px;
  }

  .chart-canvas {
    min-height: 340px;
    padding: 12px;
  }

  .chart-svg {
    height: 320px;
  }

  .dashboard-card {
    min-height: 220px;
    gap: 12px;
  }

  .dashboard-visual-controls {
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 16px;
  }

  .dashboard-visual-controls span,
  .dashboard-visual-controls button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .dashboard-preview,
  .dashboard-line-preview,
  .dashboard-stacked-preview {
    min-height: 150px;
  }
}

/* Final canvas guard: the dashboard is an editable workspace, not a narrow card list. */
#dashboards .dashboard-board-viewport {
  min-height: 620px;
  overflow: auto;
}

#dashboards .dashboard-board {
  width: max(100%, 2200px);
  max-width: none;
  min-height: 720px;
}

@media (max-width: 1100px) {
  #dashboards .dashboard-board {
    display: block !important;
    width: max(1400px, 100%) !important;
    max-width: none !important;
    min-height: 720px !important;
    padding: 0 !important;
  }

  #dashboards .dashboard-card {
    position: absolute !important;
    width: auto !important;
  }
}
