:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --brand: #164e63;
  --brand-dark: #0f3443;
  --low: #15803d;
  --medium: #b7791f;
  --high: #c2410c;
  --critical: #b91c1c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: #111827;
  color: #ffffff;
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #22c55e;
  color: #052e16;
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 2px;
}

.brand small,
.eyebrow,
.panel-header span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar .brand small {
  color: #cbd5e1;
}

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

.nav a {
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
}

.nav a.active,
.nav a:hover {
  background: #1f2937;
  color: #ffffff;
}

.app {
  margin-left: 248px;
  padding: 28px;
}

.topbar,
.section-header,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compact {
  margin-bottom: 14px;
}

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

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

h2 {
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 5px;
  color: #526071;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section {
  margin-top: 26px;
}

.metric-grid,
.dashboard-grid,
.content-grid,
.case-grid {
  display: grid;
  gap: 16px;
}

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

.dashboard-grid {
  grid-template-columns: 2fr 1fr;
  margin-top: 16px;
}

.content-grid {
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.8fr);
  margin-top: 16px;
}

.panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.panel {
  padding: 18px;
}

.metric-card {
  padding: 16px;
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.system-status {
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.primary-button,
.action-button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 14px;
}

.primary-button:hover,
.action-button:hover {
  background: var(--brand-dark);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.filters {
  display: flex;
  gap: 10px;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
}

input {
  min-width: 260px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

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

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #eef6f8;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  text-transform: capitalize;
}

.status {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.low {
  background: var(--low);
}

.medium {
  background: var(--medium);
}

.high {
  background: var(--high);
}

.critical {
  background: var(--critical);
}

.detail-panel {
  min-height: 420px;
}

.detail-panel > * + * {
  margin-top: 14px;
}

.detail-meta {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
}

.reason-list,
.audit-log,
.channel-list {
  display: grid;
  gap: 10px;
}

.reason,
.audit-item,
.case-card,
.channel-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.reason {
  background: #fff7ed;
  border-color: #fed7aa;
}

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

.case-card {
  display: grid;
  gap: 10px;
  background: #ffffff;
}

.trend {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  height: 220px;
  gap: 10px;
  padding-top: 20px;
}

.bar-wrap {
  display: grid;
  align-items: end;
  height: 100%;
  gap: 8px;
}

.bar {
  display: grid;
  align-items: end;
  min-height: 28px;
  border-radius: 5px 5px 0 0;
  background: var(--brand);
  color: #ffffff;
  font-size: 11px;
  padding: 6px;
}

.bar-label {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

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

.channel-item p,
.audit-item,
.empty-state {
  color: #475467;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .app {
    margin-left: 0;
    padding: 18px;
  }

  .metric-grid,
  .dashboard-grid,
  .content-grid,
  .case-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    width: 100%;
    flex-direction: column;
  }

  input,
  select {
    width: 100%;
    min-width: 0;
  }
}
