:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee9;
  --brand: #2563eb;
  --brand-dark: #1e40af;
  --ok: #0f8b5f;
  --warn: #b54708;
  --bad: #b42318;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

button:hover {
  background: var(--brand-dark);
}

button:disabled {
  background: #aeb8c7;
  cursor: not-allowed;
}

.ghost {
  background: #eef2ff;
  color: var(--brand-dark);
}

.ghost:hover {
  background: #dbe4ff;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: #344054;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

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

.sidebar {
  background: #111827;
  color: white;
  padding: 18px 14px;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  padding: 10px 10px 18px;
}

.nav {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  margin: 3px 0;
}

.nav:hover,
.nav.active {
  background: #243047;
  color: white;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}

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

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

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 160px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cards.compact {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

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

.card {
  padding: 16px;
}

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

.card .value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 800;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

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

.panel-title h3 {
  margin: 0;
}

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

.dictionary-table-wrap {
  max-height: 620px;
  overflow: auto;
}

.dictionary-table-wrap table {
  min-width: 1180px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.4fr);
}

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

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

th {
  color: #475467;
  font-weight: 700;
  background: #f8fafc;
}

.message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
}

.message.ok {
  color: var(--ok);
}

.message.bad {
  color: var(--bad);
}

.checks,
.report-builder {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 4px 14px;
  margin: 12px 0;
}

.checks label,
.report-builder label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.checks input,
.report-builder input {
  width: auto;
}

.report-builder h4 {
  grid-column: 1 / -1;
  margin: 6px 0 2px;
}

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

.report-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.report-toolbar .muted {
  font-size: 13px;
}

.report-visual {
  margin-bottom: 16px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--line);
}

.chart-heading {
  font-weight: 700;
  margin-bottom: 10px;
}

.report-chart {
  overflow-x: auto;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 250px;
}

.bar-block {
  min-width: 58px;
  flex: 1 0 58px;
  display: grid;
  grid-template-rows: 24px 190px 34px;
  align-items: end;
}

.bar-value,
.bar-label {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
}

.bar-fill {
  width: 100%;
  min-height: 8px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #2e90fa 0%, #12b76a 100%);
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
}

.line-chart {
  width: 100%;
  max-height: 260px;
}

.axis {
  stroke: var(--line);
  stroke-width: 2;
}

.line-path {
  fill: none;
  stroke: #2563eb;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.line-dot {
  fill: #12b76a;
  stroke: white;
  stroke-width: 2;
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--brand-dark);
}

.status.success,
.status.active {
  background: #dcfae6;
  color: var(--ok);
}

.status.failed,
.status.disabled {
  background: #fee4e2;
  color: var(--bad);
}

.inline-status {
  margin-left: 8px;
}

.permission-list,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.permission-chip {
  display: inline-block;
  border: 1px solid #c7d7fe;
  background: #eef4ff;
  color: #1849a9;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.role-matrix {
  overflow-x: auto;
}

td select,
td input {
  min-width: 120px;
}

.issue-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--warn);
}

.api-check {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.api-check-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.safety-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  margin: 10px 0 12px;
  display: grid;
  gap: 6px;
}

.safety-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf1f7;
  padding-bottom: 6px;
}

.safety-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.readiness-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.readiness-item span {
  color: var(--muted);
}

.real-actions {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
  display: grid;
  gap: 8px;
}

.bar-chart {
  min-height: 250px;
  display: flex;
  align-items: end;
  gap: 8px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px;
  overflow-x: auto;
}

.bar {
  min-width: 28px;
  background: linear-gradient(180deg, #3b82f6, #10b981);
  border-radius: 6px 6px 0 0;
  position: relative;
}

.bar span {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
}

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

  .sidebar {
    display: flex;
    overflow-x: auto;
    gap: 6px;
  }

  .brand {
    min-width: max-content;
  }

  .nav {
    width: auto;
    min-width: max-content;
  }

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