:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --blue: #1f67d2;
  --blue-soft: #e8f1ff;
  --green: #0b8f55;
  --yellow: #9a6700;
  --red: #c02f24;
  --red-soft: #ffe8e5;
  --shadow: 0 10px 30px rgba(20, 40, 80, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
}

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

h1 {
  font-size: 22px;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 14px 14px 40px;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  color: var(--blue);
  background: var(--blue-soft);
}

button.danger {
  color: var(--red);
  background: var(--red-soft);
}

.notice {
  margin-bottom: 12px;
  border-radius: 8px;
  padding: 12px;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #ffd1cc;
}

.hidden {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metrics article, .panel, .form-card, .access-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 14px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  overflow-x: auto;
}

.tabs button {
  flex: 0 0 auto;
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
}

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

.panel {
  display: none;
  padding: 14px;
}

.access-card {
  padding: 16px;
  margin-bottom: 14px;
}

.access-card p {
  margin: 6px 0 14px;
  color: var(--muted);
}

.panel.active {
  display: block;
}

.panel-title {
  margin-bottom: 12px;
}

.panel-title p {
  margin-top: 4px;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

input, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--text);
}

.row input {
  max-width: 240px;
}

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

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-title {
  font-weight: 800;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.pill.S, .pill.A, .pill.B {
  background: #e7f7ef;
  color: var(--green);
}

.pill.C {
  background: #fff5d9;
  color: var(--yellow);
}

.pill.D, .pill.warning {
  background: var(--red-soft);
  color: var(--red);
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field span, label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-card {
  padding: 14px;
  margin-top: 12px;
  box-shadow: none;
}

.form-card h3 {
  margin-bottom: 12px;
}

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

.grid label {
  display: grid;
  gap: 5px;
}

.wide {
  grid-column: 1 / -1;
}

.form-card button {
  margin-top: 12px;
}

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

@media (max-width: 720px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .row input {
    max-width: none;
  }

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