* { box-sizing: border-box; }

:root {
  --ink: #18202f;
  --muted: #657083;
  --line: #dfe5ee;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --accent: #0f766e;
  --accent-2: #b45309;
  --panel: #eef3f8;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.25;
}

.brand span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.filter-group {
  margin-top: 20px;
}

.filter-group label,
.nav-head span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segmented button,
.product-filter button,
.top-actions button,
.top-actions a {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}

.segmented button {
  min-height: 34px;
  color: var(--muted);
  background: transparent;
}

.segmented button.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1px 6px rgba(22, 32, 48, .10);
}

.product-filter {
  display: grid;
  gap: 8px;
}

.product-filter button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  text-align: left;
}

.product-filter button.is-active {
  border-color: rgba(15, 118, 110, .45);
  background: #edf8f6;
}

.product-filter small {
  color: var(--muted);
}

.report-nav {
  margin-top: 22px;
}

.nav-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.nav-head strong {
  color: var(--accent);
  font-size: 13px;
}

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

.date-divider {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.date-divider:first-child {
  margin-top: 0;
}

.report-button {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
}

.report-button.is-active {
  border-color: rgba(15, 118, 110, .55);
  background: #edf8f6;
}

.report-button strong {
  display: block;
  margin-bottom: 7px;
  line-height: 1.35;
}

.report-button span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--paper);
  line-height: 1.55;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.topbar p {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.22;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-actions button,
.top-actions a {
  min-height: 38px;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
}

.top-actions a {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

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

.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 24px;
}

.viewer-shell {
  margin-top: 14px;
  height: calc(100vh - 190px);
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button,
  .top-actions a {
    flex: 1;
    text-align: center;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-shell {
    height: 76vh;
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 22px;
  }
}
