@import url("https://fonts.googleapis.com/css2?family=Lobster&display=swap");

:root {
  --bg: #f2f1ed;
  --surface: #faf9f4;
  --surface-muted: #ece8e0;
  --panel: #faf9f4;
  --panel-strong: #ffffff;
  --ink: #161a20;
  --muted: #5a646b;
  --line: rgba(22, 26, 32, 0.12);
  --line-strong: rgba(22, 26, 32, 0.2);
  --accent: #6a89ff;
  --accent-2: #57b8ff;
  --accent-3: #88a5ff;
  --accent-4: #97aefc;
  --soft: rgba(106, 137, 255, 0.14);
  --critical: #d93f57;
  --warn: #a46921;
  --info: #6a89ff;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(106, 137, 255, 0.12), transparent 30%),
    radial-gradient(circle at 92% 16%, rgba(136, 165, 255, 0.1), transparent 34%),
    linear-gradient(180deg, #f7f5f1 0%, var(--bg) 360px);
}

button,
input,
select {
  font: inherit;
  color: var(--ink);
}

.dashboard-shell {
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.dashboard-header {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 260px;
  align-items: end;
  gap: 24px;
  padding: 10px 0 20px;
  border-bottom: 1px solid var(--line-strong);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: center;
  color: inherit;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand img {
  width: 38px;
  height: 38px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: "Lobster", Georgia, serif;
  font-size: clamp(3.2rem, 7vw, 7rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0;
  color: var(--ink);
}

h2 {
  font-size: 1rem;
  font-weight: 800;
}

h3 {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-meta {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  text-align: right;
  font-size: 0.86rem;
  backdrop-filter: blur(10px);
}

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

.status-strip,
.toolbar,
.view-panel {
  margin-top: 14px;
}

.panel,
.metric-grid {
  margin-top: 14px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

button.pill {
  cursor: pointer;
}

button.pill:hover {
  border-color: var(--line-strong);
  background: var(--panel-strong);
}

.pill.critical {
  color: var(--critical);
  border-color: rgba(221, 56, 72, 0.3);
  background: rgba(221, 56, 72, 0.08);
}

.pill.warning {
  color: var(--warn);
  border-color: rgba(172, 107, 41, 0.3);
  background: rgba(172, 107, 41, 0.09);
}

.pill.info {
  color: var(--info);
  border-color: rgba(109, 86, 152, 0.28);
  background: rgba(109, 86, 152, 0.09);
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.toolbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.refresh-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  cursor: pointer;
  font-weight: 780;
}

.refresh-button {
  min-height: 38px;
  padding: 0 12px;
}

.refresh-button.is-loading {
  color: var(--muted);
  cursor: wait;
}

.icon-button {
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  line-height: 1;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.segmented.compact {
  background: var(--panel);
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 760;
}

.segmented button.is-active {
  color: #ffffff;
  background: var(--accent);
}

.search-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-field input,
select {
  width: min(320px, 100%);
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  text-transform: none;
}

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

.metric {
  min-height: 96px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: inset 0 3px 0 var(--accent);
}

.metric:nth-child(2n) {
  box-shadow: inset 0 3px 0 var(--accent);
}

.metric:nth-child(3n) {
  box-shadow: inset 0 3px 0 var(--accent-2);
}

.metric span,
.panel-head span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-warning {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid rgba(164, 105, 33, 0.26);
  border-radius: 999px;
  color: var(--warn);
  background: rgba(164, 105, 33, 0.08);
  letter-spacing: 0;
  text-transform: none;
}

.data-critical,
.data-ok,
.data-source {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}

.data-critical {
  border: 1px solid rgba(227, 48, 77, 0.26);
  color: var(--critical);
  background: rgba(227, 48, 77, 0.08);
}

.data-ok {
  border: 1px solid rgba(45, 126, 92, 0.24);
  color: #267957;
  background: rgba(45, 126, 92, 0.08);
}

.data-source {
  max-width: min(460px, 42vw);
  overflow: hidden;
  border: 1px solid rgba(49, 63, 82, 0.13);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.45rem, 2.8vw, 2.2rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 760;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.is-hidden {
  display: none !important;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 244, 0.86);
}

.panel-head > div {
  min-width: 0;
}

.status-detail {
  margin-top: 10px;
}

.status-detail-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.status-detail-item {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.status-detail-item:last-child {
  border-bottom: 0;
}

.status-detail-item strong {
  font-size: 0.92rem;
}

.status-detail-item span,
.status-detail-item p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.app-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.app-tab {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--muted);
  cursor: pointer;
  font-weight: 760;
}

.app-tab.is-active {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.trend-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trend-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px 0;
}

.trend-stat {
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.trend-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trend-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}

.chart-wrap {
  height: 360px;
  padding: 14px;
}

#trendChart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-grid {
  stroke: rgba(88, 43, 54, 0.11);
  stroke-width: 1;
}

.chart-bar {
  fill: var(--accent);
}

.chart-value,
.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-value {
  fill: var(--ink);
  font-size: 13px;
}

.compact-table {
  max-height: 260px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.alert-list {
  display: grid;
}

.alert {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.alert:last-child {
  border-bottom: 0;
}

.alert strong {
  display: block;
  margin-bottom: 3px;
}

.alert p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:last-child td {
  border-bottom: 0;
}

.app-name {
  display: grid;
  gap: 2px;
}

.app-name span {
  color: var(--muted);
  font-size: 0.74rem;
}

.sparkline {
  width: 96px;
  height: 28px;
  display: block;
}

.sparkline path {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 2;
}

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

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

.detail-grid article {
  min-height: 250px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.detail-grid article:last-child {
  border-right: 0;
}

.bar-list,
.fact-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  gap: 5px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(88, 43, 54, 0.08);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
}

.fact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.fact span {
  color: var(--muted);
}

.empty {
  padding: 18px 14px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .dashboard-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .header-meta {
    text-align: left;
  }

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

  .detail-grid,
  .detail-grid.two-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-shell {
    width: min(100% - 24px, 1500px);
  }

  .toolbar,
  .panel-head,
  .trend-controls,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    overflow-x: auto;
  }

  .metric-grid,
  .trend-stats {
    grid-template-columns: 1fr;
  }

  .detail-grid article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chart-wrap {
    height: 300px;
  }
}
