:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-alt: #f1f5ee;
  --ink: #1d2a22;
  --muted: #647067;
  --line: #dce3d9;
  --brand: #1f6f4a;
  --brand-dark: #174934;
  --accent: #b95f24;
  --danger: #a5332a;
  --warning: #a96b12;
  --shadow: 0 18px 40px rgba(31, 55, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
}

.access-denied {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 18px;
  font-weight: 700;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #ffffff, #eef5eb);
  position: sticky;
  top: 0;
  z-index: 5;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.status {
  color: var(--muted);
  min-width: 94px;
  text-align: right;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--brand-dark);
  padding: 9px 13px;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--brand);
}

.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: calc(100vh - 82px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 20px;
  overflow: auto;
  position: sticky;
  top: 82px;
  height: calc(100vh - 82px);
}

.content {
  padding: 24px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 15px 0 7px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
}

.org-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.org-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.org-item.active {
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.org-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 14px;
  min-height: 92px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 9px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
}

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

.panel {
  padding: 18px;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.segmented {
  display: flex;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 9px 12px;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--brand);
  color: #fff;
}

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

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

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

.rank-list {
  display: grid;
  gap: 9px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 110px;
  gap: 14px;
  align-items: center;
}

.rank-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

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

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

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

th {
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

td.number,
th.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

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

.badge {
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #ecf8ef;
  color: #23633f;
  border-color: #cae8d2;
}

.badge.warn {
  background: #fff5df;
  color: var(--warning);
  border-color: #f1dba8;
}

.badge.danger {
  background: #fdecea;
  color: var(--danger);
  border-color: #f0c7c2;
}

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

.fact {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-alt);
}

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

.fact strong {
  font-size: 17px;
}

.detail-sections {
  display: grid;
  gap: 14px;
}

.section-title {
  margin-bottom: 10px;
}

.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

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

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    display: block;
  }

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

  .summary-grid,
  .grid-2,
  .facts {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }
}
