:root {
  --bg: #f5f2ec;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #20201d;
  --muted: #6f6a5f;
  --line: #ddd5c8;
  --accent: #126c57;
  --accent-strong: #0d513f;
  --amber: #b35d10;
  --red: #b63434;
  --green-soft: #dceee8;
  --red-soft: #f5dddd;
  --amber-soft: #f2e5c8;
  --shadow: 0 18px 50px rgba(47, 42, 33, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "Source Sans 3", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 240px),
    repeating-linear-gradient(90deg, rgba(32, 32, 29, 0.03) 0, rgba(32, 32, 29, 0.03) 1px, transparent 1px, transparent 72px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 72px;
  padding: 16px clamp(18px, 4vw, 42px);
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 18px;
  font-weight: 800;
  gap: 10px;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  color: var(--surface);
  display: inline-flex;
  font-size: 12px;
  height: 34px;
  justify-content: center;
  letter-spacing: 0.08em;
  width: 48px;
}

.session {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.user-pill,
.role-pill {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.8);
  padding: 8px 10px;
}

.role-pill {
  color: var(--accent-strong);
  font-weight: 800;
  text-transform: uppercase;
}

.page {
  margin: 0 auto;
  max-width: 1320px;
  padding: 34px clamp(18px, 4vw, 42px) 60px;
}

.eyebrow,
.section-label {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(32px, 5vw, 58px);
  letter-spacing: 0;
  line-height: 0.98;
  margin: 0;
}

h2 {
  font-size: 24px;
  margin: 0 0 8px;
}

.muted,
.hint {
  color: var(--muted);
  line-height: 1.55;
}

.login-shell {
  align-items: center;
  display: grid;
  gap: 34px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px);
  min-height: calc(100vh - 170px);
}

.login-copy {
  max-width: 650px;
}

.login-copy .muted {
  max-width: 560px;
}

.login-box,
.table-shell,
.summary-strip {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-box {
  padding: 24px;
}

.primary-button,
.secondary-button,
.ghost-button,
.dev-user,
.sort-button {
  align-items: center;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.dev-user:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:disabled {
  background: #8fa49a;
  cursor: not-allowed;
  opacity: 0.72;
}

.secondary-button {
  background: var(--ink);
  color: #fff;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.full-width {
  width: 100%;
}

.dev-login {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 20px;
}

.dev-user {
  background: #fff;
  border-color: var(--line);
  justify-content: space-between;
  margin-top: 8px;
  width: 100%;
}

.dev-user strong {
  color: var(--accent-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 14px;
}

.flash-error {
  border-color: #e2b0aa;
  background: #fff0ef;
  color: #842920;
}

.dashboard-head {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.head-actions {
  align-items: end;
  display: flex;
  gap: 14px;
}

.meta-line {
  color: var(--muted);
  display: grid;
  gap: 3px;
  min-width: 180px;
}

.meta-line strong {
  color: var(--ink);
}

.summary-strip {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
}

.summary-strip div {
  background: rgba(255, 255, 255, 0.68);
  display: grid;
  gap: 5px;
  padding: 18px;
}

.summary-strip span {
  color: var(--muted);
  font-size: 13px;
}

.summary-strip strong {
  font-size: 22px;
}

.aggregate-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 0.9fr 1.2fr 1fr 1.1fr;
  margin-bottom: 18px;
}

.aggregate-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
}

.aggregate-card span,
.aggregate-card small {
  color: var(--muted);
}

.aggregate-card span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aggregate-card strong {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.aggregate-card small b,
.split-card strong b {
  font: inherit;
}

.table-controls {
  align-items: end;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 16px;
}

.filter-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-field {
  display: grid;
  gap: 7px;
  min-width: min(320px, 100%);
}

.filter-field span,
.result-count span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-field select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%) calc(100% - 18px) 18px / 7px 7px no-repeat,
    linear-gradient(135deg, var(--ink) 50%, transparent 50%) calc(100% - 13px) 18px / 7px 7px no-repeat,
    #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 38px 10px 12px;
}

.compact-button {
  min-height: 44px;
}

.result-count {
  display: grid;
  gap: 5px;
  margin-left: auto;
  min-width: 100px;
}

.result-count strong {
  font-size: 20px;
}

.table-shell {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 15px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: rgba(238, 232, 220, 0.72);
  color: var(--muted);
  white-space: nowrap;
}

.sort-button {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  gap: 7px;
  justify-content: flex-start;
  letter-spacing: 0.06em;
  min-height: 0;
  padding: 0;
  text-align: left;
  text-transform: uppercase;
  width: 100%;
}

.sort-button.align-end {
  justify-content: flex-end;
}

.sort-button span {
  color: var(--accent-strong);
  display: inline;
  font-size: 13px;
  margin: 0;
}

.sort-button.is-active {
  color: var(--ink);
}

.domain-link {
  color: var(--accent-strong);
  display: inline-flex;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.domain-link:hover {
  color: var(--ink);
}

td strong,
td span {
  display: block;
}

td span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.mono {
  color: #48443e;
  font-family: "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.change {
  font-weight: 850;
}

.change.up {
  color: var(--accent-strong);
}

.change.down {
  color: var(--red);
}

.trend {
  border: 1px solid var(--line);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  min-width: 92px;
  padding: 7px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.trend-wzrost {
  background: var(--green-soft);
  border-color: #a9d4c5;
  color: var(--accent-strong);
}

.trend-spadek {
  background: var(--red-soft);
  border-color: #e2b0aa;
  color: var(--red);
}

.trend-stabilnie,
.trend-brak-porownania {
  background: var(--amber-soft);
  border-color: #dfc990;
  color: var(--amber);
}

.row-error {
  color: var(--red);
  display: block;
  font-size: 12px;
  margin-top: 7px;
  max-width: 360px;
}

.empty-state {
  padding: 34px;
}

.hidden {
  display: none;
}

.detail-meta,
.metric-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

[data-tab-panel][hidden] {
  display: none !important;
}

.detail-meta {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-meta div,
.metric-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

.detail-meta span,
.metric-card span,
.metric-card small {
  color: var(--muted);
}

.detail-meta span,
.metric-card span {
  display: block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.detail-meta strong {
  overflow-wrap: anywhere;
}

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

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

.metric-card strong {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
}

.metric-card b {
  font-size: 20px;
}

.overview-panel {
  display: grid;
  gap: 24px;
}

.trend-shell {
  display: grid;
  gap: 16px;
}

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

.trend-summary article,
.chart-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.trend-summary article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.trend-summary span,
.trend-summary small {
  color: var(--muted);
}

.trend-summary span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trend-summary strong {
  font-size: 24px;
  line-height: 1.1;
}

.chart-card {
  padding: 18px 18px 14px;
}

.traffic-chart {
  display: block;
  height: auto;
  overflow: visible;
  width: 100%;
}

.chart-grid-line,
.chart-month-line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-month-line {
  opacity: 0.55;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-daily {
  opacity: 0.65;
  stroke: #6f8fa7;
  stroke-width: 2;
}

.chart-line-average {
  stroke: var(--accent);
  stroke-width: 4;
}

.chart-axis-label {
  fill: var(--muted);
  font-family: "Aptos", "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 11px;
}

.chart-axis-label-x {
  text-anchor: middle;
}

.chart-axis-label-y {
  text-anchor: end;
}

.chart-legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 8px;
}

.chart-legend span {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.legend-swatch {
  border-radius: 999px;
  display: inline-flex;
  height: 10px;
  width: 30px;
}

.legend-swatch-daily {
  background: #6f8fa7;
}

.legend-swatch-average {
  background: var(--accent);
}

.health-summary,
.health-grid {
  display: grid;
  gap: 14px;
}

.health-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.health-summary article,
.health-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.health-summary article {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.health-summary span,
.health-summary small,
.health-card-head span,
.health-note {
  color: var(--muted);
}

.health-summary span,
.health-card-head span,
.health-definition dt {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.health-summary strong {
  font-size: 24px;
  line-height: 1.1;
}

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

.health-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.health-card-head {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.health-card-head h3 {
  margin: 4px 0 0;
}

.status-pill {
  align-items: center;
  border: 1px solid var(--line);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

.status-ok {
  background: var(--green-soft);
  border-color: rgba(18, 108, 87, 0.2);
  color: var(--accent-strong);
}

.status-warning {
  background: var(--amber-soft);
  border-color: rgba(179, 93, 16, 0.2);
  color: var(--amber);
}

.status-critical {
  background: var(--red-soft);
  border-color: rgba(182, 52, 52, 0.2);
  color: var(--red);
}

.status-unknown {
  background: rgba(255, 253, 248, 0.85);
  color: var(--muted);
}

.health-definition {
  display: grid;
  gap: 12px;
  margin: 0;
}

.health-definition div {
  border-top: 1px solid rgba(221, 213, 200, 0.75);
  display: grid;
  gap: 4px;
  padding-top: 12px;
}

.health-definition div:first-child {
  border-top: 0;
  padding-top: 0;
}

.health-definition dt {
  color: var(--muted);
}

.health-definition dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.health-note {
  margin: 0;
}

.crux-shell {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.crux-summary,
.crux-grid,
.crux-metric-grid {
  display: grid;
  gap: 14px;
}

.crux-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.crux-summary article,
.crux-card,
.crux-metric-grid article {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.crux-summary article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.crux-summary span,
.crux-summary small,
.crux-card-head span,
.crux-history-head span,
.crux-note,
.crux-history-labels small,
.crux-metric-grid span {
  color: var(--muted);
}

.crux-summary span,
.crux-card-head span,
.crux-history-head span,
.crux-metric-grid span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crux-summary strong {
  font-size: 24px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

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

.crux-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.crux-card-head,
.crux-history-labels {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.crux-card-head h3 {
  margin: 4px 0 0;
}

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

.crux-metric-grid article {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.crux-metric-grid strong {
  font-size: 22px;
  line-height: 1.1;
}

.crux-history {
  display: grid;
  gap: 10px;
}

.crux-history-head {
  display: grid;
  gap: 4px;
}

.crux-history-head strong {
  font-size: 18px;
  line-height: 1.15;
}

.crux-history-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.crux-history-point {
  border: 1px solid var(--line);
  height: 18px;
}

.crux-history-point.status-ok {
  background: var(--green-soft);
}

.crux-history-point.status-warning {
  background: var(--amber-soft);
}

.crux-history-point.status-critical {
  background: var(--red-soft);
}

.crux-history-point.status-unknown {
  background: rgba(255, 253, 248, 0.85);
}

.lb-profile-shell {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

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

.lb-profile-summary article,
.lb-history-card,
.lb-top-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lb-profile-summary article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.lb-profile-summary span,
.lb-profile-summary small,
.lb-card-head span {
  color: var(--muted);
}

.lb-profile-summary span,
.lb-card-head span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lb-profile-summary strong {
  font-size: 24px;
  line-height: 1.1;
}

.lb-profile-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
}

.lb-history-card,
.lb-top-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.lb-card-head {
  display: grid;
  gap: 5px;
}

.lb-card-head strong {
  font-size: 22px;
  line-height: 1.15;
}

.lb-history-bars {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  min-height: 220px;
}

.lb-history-bar-item {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-rows: auto 1fr auto;
}

.lb-history-bar-value,
.lb-history-bar-item small {
  color: var(--muted);
  text-align: center;
}

.lb-history-bar-value {
  font-size: 12px;
  font-weight: 800;
}

.lb-history-bar-track {
  align-items: end;
  background: rgba(18, 108, 87, 0.06);
  border: 1px solid var(--line);
  display: flex;
  height: 150px;
  padding: 6px;
}

.lb-history-bar-fill {
  background: linear-gradient(180deg, #2f9d81 0%, var(--accent) 100%);
  border-radius: 6px 6px 0 0;
  min-height: 0;
  width: 100%;
}

.lb-history-bar-item small {
  font-size: 11px;
}

.lb-top-list {
  display: grid;
  gap: 12px;
}

.lb-top-item {
  display: grid;
  gap: 6px;
}

.lb-top-line {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.lb-top-line strong {
  flex: 1;
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.lb-top-line span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.lb-top-bar {
  background: rgba(18, 108, 87, 0.08);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.lb-top-bar-fill {
  background: var(--accent);
  border-radius: 999px;
  height: 100%;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.detail-tabs button {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 10px 13px;
  text-transform: uppercase;
}

.detail-tabs button:hover,
.detail-tabs button.is-active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.detail-tabs button.is-active {
  background: var(--green-soft);
}

.panel-section {
  margin-top: 24px;
}

.section-head {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-head .muted {
  max-width: 780px;
}

.section-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-summary {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.link-summary article {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  padding: 18px;
}

.link-summary span,
.link-summary small {
  color: var(--muted);
}

.link-summary span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.link-summary strong {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.opportunity-table table {
  min-width: 1040px;
}

.url-cell {
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .topbar,
  .dashboard-head,
  .head-actions,
  .table-controls,
  .section-head,
  .filter-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .aggregate-grid {
    grid-template-columns: 1fr;
  }

  .detail-meta,
  .metric-grid,
  .health-summary,
  .health-grid,
  .crux-summary,
  .crux-grid,
  .crux-metric-grid,
  .link-summary,
  .trend-summary,
  .lb-profile-summary,
  .lb-profile-grid {
    grid-template-columns: 1fr;
  }

  .session {
    justify-content: flex-start;
  }

  .result-count {
    margin-left: 0;
  }
}
