:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #15201d;
  --muted: #66736e;
  --line: #dde3df;
  --brand: #116d5a;
  --brand-strong: #0b4d3f;
  --accent: #d25c45;
  --amber: #b7791f;
  --danger: #b42318;
  --ok: #157347;
  --shadow: 0 18px 45px rgba(20, 31, 28, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #ecf0eb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
}

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

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.icon-button,
.view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.nav-item {
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #394741;
}

.nav-item:hover,
.nav-item.active {
  color: var(--brand-strong);
  background: #ffffff;
  border-color: var(--line);
}

.nav-item svg,
.icon-button svg,
.view-button svg,
.primary-button svg,
.search-field svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.sidebar-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

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

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--amber);
}

.status-dot.live {
  background: var(--ok);
}

.status-dot.offline {
  background: var(--accent);
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

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

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
}

h2 {
  font-size: 19px;
}

.topbar-actions,
.dialog-actions,
.view-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button,
.view-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--panel);
  border-color: var(--line);
}

.icon-button:hover,
.view-button:hover,
.view-button.active {
  color: var(--brand-strong);
  border-color: #a6beb5;
}

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

.metric-card {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.metric-card strong {
  font-size: 30px;
  line-height: 1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 170px 170px;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.search-field,
.select-field,
.form-field {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-field {
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
}

.search-field input,
.select-field select,
.form-field input,
.form-field textarea {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.select-field {
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px;
}

.select-field span,
.form-field span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.content-grid {
  min-width: 0;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.results-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.service-card {
  display: grid;
  gap: 14px;
  min-height: 276px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.service-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-title {
  display: grid;
  gap: 6px;
}

.service-title h3 {
  margin: 0;
  font-size: 18px;
}

.service-title p,
.service-card .notes {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.badge,
.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge {
  color: var(--brand-strong);
  background: #dbece6;
}

.status-pill.active {
  color: var(--ok);
  background: #e5f3ec;
}

.status-pill.watch {
  color: var(--amber);
  background: #fff1d6;
}

.status-pill.down {
  color: var(--danger);
  background: #fde8e5;
}

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

.meta-box {
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.meta-box span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.meta-box strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  color: #40504b;
  background: #f0f3ef;
  border: 1px solid var(--line);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.updated {
  color: var(--muted);
  font-size: 12px;
}

.link-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 800;
}

.link-button,
.primary-button {
  color: #ffffff;
  background: var(--brand);
}

.link-button:hover,
.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td a {
  color: var(--brand);
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 24px;
  border: 1px dashed #b9c7c1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  text-align: center;
}

.settings-dialog {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop {
  background: rgba(21, 32, 29, 0.38);
}

.settings-dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

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

.form-field {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.form-field textarea {
  resize: vertical;
  min-height: 96px;
}

.dialog-actions {
  justify-content: flex-end;
}

.hidden {
  display: none;
}

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

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

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item span {
    display: none;
  }

  .sidebar-note {
    display: none;
  }

  .main-panel {
    padding: 18px;
  }

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

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

@media (max-width: 560px) {
  .topbar,
  .results-header,
  .card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .view-toggle {
    justify-content: flex-start;
  }

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

  .service-meta {
    grid-template-columns: 1fr;
  }

  .link-button {
    width: 100%;
  }
}
