:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #637083;
  --line: #d7e0ea;
  --blue: #1d4ed8;
  --blue-dark: #173b94;
  --blue-soft: #dbeafe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --sky: #0369a1;
  --sky-soft: #e0f2fe;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --shadow: 0 18px 42px rgba(23, 32, 51, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(180deg, #dbeafe 0, rgba(219, 234, 254, 0) 310px),
    var(--bg);
  color: var(--ink);
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 30px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy,
.hero-card,
.panel,
.stat-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 30px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

.hero-card-label,
.section-kicker,
.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.hero-card p {
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 38px;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.hero-text,
.panel-heading p,
.about-panel p,
.health-details,
.footer,
.hero-card p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-text {
  margin-bottom: 0;
  max-width: 760px;
  font-size: 17px;
}

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

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 18px 20px;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--blue);
}

.stat-card:nth-child(2)::before {
  background: var(--green);
}

.stat-card:nth-child(3)::before {
  background: var(--amber);
}

.stat-card:nth-child(4)::before {
  background: var(--violet);
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stat-card strong {
  font-size: 31px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
}

.panel-heading {
  margin-bottom: 18px;
}

.panel-heading p:last-child,
.about-panel p {
  margin-bottom: 0;
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.component-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.component-card strong,
.component-card span {
  display: block;
}

.component-card strong {
  margin-bottom: 5px;
}

.component-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1f5;
}

.status-list > div:last-child {
  border-bottom: none;
}

.status-list span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.health-details {
  margin: 12px 0 0;
  font-size: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill[data-state="ok"] {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill[data-state="error"] {
  background: var(--red-soft);
  color: var(--red);
}

.list-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.field-group {
  margin-bottom: 13px;
}

label {
  display: block;
  margin: 0 0 7px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c7d2de;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.10);
}

textarea {
  resize: vertical;
}

.field-error {
  display: block;
  min-height: 18px;
  margin-top: 5px;
  color: var(--red);
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions,
.actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-actions {
  margin-top: 4px;
  align-items: stretch;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.form-message[data-state="success"] {
  color: var(--green);
}

.form-message[data-state="error"] {
  color: var(--red);
}

.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button.primary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.button.ghost,
.button.tiny {
  background: #ffffff;
  border-color: #c7d2de;
  color: var(--ink);
}

.button.ghost {
  color: var(--muted);
}

.button.tiny {
  min-width: 78px;
  padding: 7px 10px;
  font-size: 13px;
}

.button.danger {
  border-color: #fecaca;
  color: var(--red);
}

.button.danger:hover:not(:disabled) {
  background: var(--red-soft);
}

.filters {
  min-width: 470px;
}

.filters input {
  min-width: 300px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #edf1f5;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 14px 13px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-status {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.table-status[data-status="on_mission"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.table-status[data-status="resting"] {
  background: var(--sky-soft);
  color: var(--sky);
}

.empty-state {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

.error-state {
  margin-bottom: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--red);
}

.footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.toast-stack {
  position: fixed;
  z-index: 50;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 700;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.toast.error {
  border-color: #fecaca;
  background: #fff7f7;
  color: var(--red);
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

@media (max-width: 1060px) {
  .hero,
  .info-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 14px 26px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .component-grid,
  .form-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .list-heading,
  .filters,
  .form-actions,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    width: 100%;
    min-width: 0;
  }

  .filters input {
    min-width: 0;
  }

  .status-list > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .button.tiny {
    width: 100%;
  }

  h1 {
    font-size: 28px;
  }
}
