:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1d252c;
  --muted: #5f6b76;
  --line: #d9e0e5;
  --accent: #1f6f78;
  --accent-strong: #16525a;
  --accent-soft: #e8f3f4;
  --bi-brown: #ae8f6a;
  --bi-brown-strong: #6f563d;
  --bi-brown-soft: #f4ece3;
  --warn: #945c12;
  --shadow: 0 12px 28px rgba(30, 45, 55, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 5px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-header {
  flex: 0 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.portal-nav {
  flex: 0 0 auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(31, 111, 120, 0.08), rgba(255, 255, 255, 0.9)),
    var(--panel);
}

.portal-nav-label,
.report-page-nav-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dashboard-tabs {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  width: 100%;
}

.dashboard-tab {
  min-width: 126px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border-radius: 6px;
  padding: 3px 8px;
  text-align: left;
  box-shadow: none;
}

.dashboard-tab:hover {
  border-color: rgba(31, 111, 120, 0.45);
  background: #fff;
  color: var(--accent-strong);
}

.dashboard-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.dashboard-tab.needs-config {
  border-style: dashed;
}

.dashboard-tab span,
.dashboard-tab small {
  display: block;
}

.dashboard-tab span {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.dashboard-tab small {
  margin-top: 0;
  color: currentColor;
  font-size: 9px;
  line-height: 1.05;
  opacity: 0.78;
}

.report-page-nav {
  flex: 0 0 auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  overflow-x: auto;
}

.report-page-nav-label {
  color: var(--bi-brown-strong);
}

.report-page-tab {
  flex: 0 0 auto;
  border-color: rgba(174, 143, 106, 0.35);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  color: var(--bi-brown-strong);
  font-size: 11px;
  font-weight: 650;
  box-shadow: none;
  white-space: nowrap;
}

.report-page-tab:hover {
  border-color: rgba(174, 143, 106, 0.65);
  background: var(--bi-brown-soft);
  color: var(--bi-brown-strong);
}

.report-page-tab.active {
  border-color: var(--bi-brown);
  background: var(--bi-brown);
  color: #fff;
}

.app-header h1,
.portal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.app-header p,
.portal-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

#refreshContextButton,
#resetReportButton {
  background: #fff;
  color: var(--accent);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 126px);
  padding: 10px;
}

.report-shell {
  position: relative;
  width: min(100%, 1800px);
  height: clamp(720px, calc(100vh - 150px), 980px);
  min-width: 0;
  min-height: 720px;
  margin: 0 auto 22px;
}

.report-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(30, 45, 55, 0.08);
}

.report-container iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

.report-zoom-controls {
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 3;
  display: grid;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(31, 111, 120, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(30, 45, 55, 0.16);
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
}

.zoom-button,
.zoom-reset-button {
  display: grid;
  place-items: center;
  min-width: 0;
  border-color: rgba(31, 111, 120, 0.22);
  background: #fff;
  color: var(--accent-strong);
  box-shadow: none;
}

.zoom-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}

.zoom-reset-button {
  min-height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.zoom-button:hover,
.zoom-reset-button:hover {
  border-color: rgba(31, 111, 120, 0.45);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.zoom-symbol {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.92), transparent 34%),
    rgba(31, 111, 120, 0.12);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
}

.empty-state {
  height: 100%;
  min-height: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

.dashboard-placeholder {
  padding: 32px;
}

.external-dashboard-shell {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 120, 0.18), transparent 34%),
    linear-gradient(135deg, #ffffff, var(--accent-soft));
}

.external-dashboard-card {
  width: min(560px, 100%);
  padding: 34px;
  border: 1px solid rgba(31, 111, 120, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  text-align: center;
}

.external-dashboard-eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(31, 111, 120, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.external-dashboard-card h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.external-dashboard-card p {
  margin: 12px auto 0;
  max-width: 440px;
  color: var(--muted);
}

.external-dashboard-note {
  font-size: 13px;
}

.external-dashboard-link {
  display: inline-flex;
  margin-top: 24px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 11px 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.external-dashboard-link:hover {
  background: var(--accent-strong);
}

.portal-notice {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 111, 120, 0.28);
  border-radius: 8px;
  background: rgba(31, 111, 120, 0.08);
  color: var(--accent-strong);
  font-size: 13px;
}

.portal-notice.error {
  border-color: rgba(148, 92, 18, 0.34);
  background: rgba(148, 92, 18, 0.08);
  color: var(--warn);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.status-pill.busy {
  color: var(--warn);
}

.hidden {
  display: none !important;
}

@media (max-width: 1020px) {
  .workspace {
    min-height: 0;
  }

  .app-header {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 12px;
  }

  .portal-nav {
    min-height: 0;
  }

  .dashboard-tab {
    min-width: 128px;
  }

  .report-page-nav {
    min-height: 0;
  }
}
