:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d9e2ec;
  --surface: #ffffff;
  --band: #f5f7fb;
  --nav: #16202a;
  --nav-soft: #253443;
  --blue: #2563eb;
  --green: #0f8b6f;
  --amber: #b7791f;
  --red: #c24141;
  --violet: #6d5bd0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--band);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background: var(--nav);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e6f2ff;
  color: var(--nav);
  font-weight: 800;
}

.brand span,
.panel-title strong,
.status-strip small {
  display: block;
  color: #a8b6c5;
  font-size: 12px;
}

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

.nav-item {
  justify-content: flex-start;
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: #dbe6f1;
  text-align: left;
}

.nav-item.active {
  background: var(--nav-soft);
  color: white;
}

.connection-panel {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #eaf2fb;
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: #c9d7e5;
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.topbar,
.status-strip,
.module-header,
.actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

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

.actions {
  gap: 8px;
}

.status-strip {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.online {
  background: var(--green);
}

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

.kpi {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.kpi strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  line-height: 1;
}

.kpi small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.module {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.module.wide {
  grid-column: span 1;
}

.module-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.module-header > div {
  min-width: 150px;
}

.module-header h2 {
  margin: 3px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.module-header select {
  max-width: 260px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
}

.bar-track {
  height: 28px;
  border-radius: 6px;
  background: #ecf1f6;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.task-board,
.care-list {
  display: grid;
  gap: 10px;
}

.task,
.care-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #e4ebf2;
  border-radius: 8px;
  background: #fbfdff;
}

.task-top,
.care-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.task strong,
.care-item strong {
  font-size: 14px;
}

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

.pill {
  min-width: 44px;
  height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e9f4f1;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.pill.high,
.pill.delay {
  background: #fff1f0;
  color: var(--red);
}

.pill.mid,
.pill.wait {
  background: #fff8e8;
  color: var(--amber);
}

.ontology-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.node {
  min-width: 0;
  min-height: 78px;
  border: 1px solid #d8e4f0;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.node strong,
.node span {
  display: block;
}

.node span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.node strong {
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

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

  .sidebar {
    position: static;
  }

  .kpi-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .status-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
