:root {
  --bg: #0f141a;
  --bg-elev: #161d25;
  --bg-soft: #1c2632;
  --line: #293747;
  --text: #edf3fb;
  --muted: #9eb0c7;
  --accent: #2c95ff;
  --ok: #34c38f;
  --warn: #f0b14a;
  --bad: #ef6d6d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #121922;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

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

.tenant {
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #151f2a;
  border-radius: 6px;
}

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

.tenant span {
  font-size: 13px;
}

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

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  border-color: #365578;
  background: #1a2634;
}

.main {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  padding: 12px 14px;
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 1px solid #3c5f87;
  background: #1f4d7a;
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
}

button:hover {
  background: #2566a4;
}

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

.kpis article {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  padding: 10px;
}

.kpis h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.kpis p {
  margin: 7px 0 0;
  font-size: 24px;
  font-weight: 700;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  padding: 12px;
}

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

.panel-head h3,
h4 {
  margin: 0;
}

.role-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.role-tabs button {
  background: transparent;
  border-color: #35506d;
  color: #b8cce3;
}

.role-tabs button.active {
  background: #24415e;
  color: #fff;
}

.role-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.role-title strong {
  font-size: 16px;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.metric {
  border: 1px solid #2f4053;
  border-radius: 6px;
  background: var(--bg-soft);
  padding: 8px;
}

.metric-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}

.tag {
  border: 1px solid #426385;
  color: #bcd6f5;
  border-radius: 999px;
  font-size: 10px;
  padding: 2px 6px;
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 6px;
}

.source-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.role-body {
  overflow: auto;
}

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

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

.evidence-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.phase-list {
  display: grid;
  gap: 8px;
}

.phase-item {
  border: 1px solid #2f4259;
  border-radius: 6px;
  padding: 8px;
  background: var(--bg-soft);
}

.phase-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #243345;
  margin-top: 6px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2c95ff, #4ebf9d);
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  border-bottom: 1px solid #283646;
  padding: 7px 0;
}

.status-row span {
  color: var(--muted);
}

form {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 5px;
  font-size: 12px;
}

input {
  border: 1px solid #36506d;
  background: #101923;
  color: #f1f6ff;
  border-radius: 6px;
  padding: 7px;
}

.inline-form {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid #283646;
  padding: 7px 4px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
}

.compact-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
  color: #d6e4f5;
  font-size: 12px;
}

.inline-actions {
  display: flex;
  gap: 4px;
}

.small {
  font-size: 11px;
  padding: 4px 7px;
}

.insight {
  display: grid;
  gap: 4px;
}

.insight ul {
  margin: 0;
  padding-left: 16px;
}

.status-healthy {
  color: var(--ok);
}

.status-warning {
  color: var(--warn);
}

.status-critical {
  color: var(--bad);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(420px, 92vw);
}

.auth-card {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

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

.auth-brand img {
  width: 44px;
  height: 44px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 20px;
}

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

.auth-message {
  min-height: 18px;
  margin: 0;
  color: var(--warn);
  font-size: 12px;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: relative;
    height: auto;
  }

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

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

@media (max-width: 640px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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