:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --ink: #18212f;
  --muted: #647284;
  --line: #d9e0e7;
  --accent: #117a65;
  --accent-2: #1f6feb;
  --danger: #b42318;
  --warning: #9a6700;
  --ok: #067647;
  --shadow: 0 10px 28px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #111820;
  color: #dce6ef;
  padding: 20px 16px;
}

.brand {
  align-items: center;
  color: #fff;
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #9fb0c0;
  margin-top: 2px;
}

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

.side-nav a {
  border-radius: 7px;
  color: #dce6ef;
  padding: 11px 12px;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.main {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 82px;
  padding: 16px 28px;
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

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

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

.signed-in {
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 24px 28px 40px;
}

.kpi-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  margin-bottom: 20px;
}

.kpi-card,
.table-panel,
.notice,
.edit-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 112px;
  padding: 16px;
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
  display: block;
}

.kpi-card strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
  margin-top: 12px;
}

.kpi-card.danger strong {
  color: var(--danger);
}

.kpi-card.kpi-green strong {
  color: var(--ok);
}

.kpi-card.kpi-orange strong {
  color: #b54708;
}

.review-kpis {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

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

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.search-form input,
.search-form select {
  min-width: 220px;
}

.report-filters input {
  min-width: 150px;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.panel-head h2 {
  font-size: 16px;
  margin: 0;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8fafc;
}

.actions {
  text-align: right;
}

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

.status {
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  min-width: 68px;
  padding: 5px 9px;
  text-align: center;
}

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

.status.pending,
.status.created,
.status.uploading {
  background: #fef0c7;
  color: var(--warning);
}

.status.rejected,
.status.revoked,
.status.disabled,
.status.deleted,
.status.locked {
  background: #fee4e2;
  color: var(--danger);
}

.kpi-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  min-width: 70px;
  padding: 6px 10px;
  text-align: center;
}

.kpi-pill.green {
  background: #dcfae6;
  color: var(--ok);
}

.kpi-pill.yellow {
  background: #fef0c7;
  color: var(--warning);
}

.kpi-pill.orange {
  background: #ffead5;
  color: #b54708;
}

.kpi-pill.red {
  background: #fee4e2;
  color: var(--danger);
}

.subtle {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.btn-primary,
.btn-secondary {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 14px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  filter: brightness(0.95);
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: var(--ink);
}

.edit-form {
  padding: 18px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  outline: 3px solid rgba(31, 111, 235, 0.14);
}

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

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.form-actions {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 16px;
}

.text-danger,
.field-validation-error {
  color: var(--danger);
  font-size: 12px;
}

.notice {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.notice.success {
  border-color: #abefc6;
}

.notice code {
  background: #111820;
  border-radius: 6px;
  color: #fff;
  font-size: 18px;
  padding: 8px 10px;
}

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

.probe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.probe-card.ok {
  border-color: #abefc6;
}

.probe-card.bad {
  border-color: #fecdca;
}

.probe-card div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.probe-card span,
.probe-card small,
.probe-card p {
  color: var(--muted);
}

.probe-card strong {
  font-size: 22px;
}

.probe-card p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.probe-card em,
.test-step em {
  color: var(--danger);
  font-style: normal;
}

.test-result {
  margin-bottom: 18px;
}

.test-steps {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.test-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.test-step.ok {
  border-color: #abefc6;
}

.test-step.bad {
  border-color: #fecdca;
}

.test-step span {
  color: var(--muted);
}

.test-step code {
  background: #eef3f7;
  border-radius: 6px;
  overflow-wrap: anywhere;
  padding: 7px 9px;
}

.test-step pre {
  background: #111820;
  border-radius: 6px;
  color: #fff;
  margin: 0;
  overflow-x: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.split-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}

.review-table {
  min-width: 1180px;
}

.wrap-cell {
  max-width: 260px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.transcript-preview {
  max-width: 360px;
}

.analysis-title {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.analysis-title strong {
  display: block;
  overflow-wrap: anywhere;
}

.analysis-meta {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 18px;
}

.analysis-meta div {
  border-right: 1px solid var(--line);
  min-width: 0;
  padding: 14px 16px;
}

.analysis-meta div:last-child {
  border-right: 0;
}

.analysis-meta span,
.detail-list dt,
.term-block h3 {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.analysis-meta strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.analysis-grid {
  margin-bottom: 18px;
}

.analysis-panel {
  margin-bottom: 18px;
}

.analysis-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.term-block {
  display: grid;
  gap: 8px;
}

.term-block h3 {
  margin: 0;
}

.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.term-chip {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 6px 10px;
}

.term-chip.ok {
  background: #dcfae6;
  color: var(--ok);
}

.term-chip.warn {
  background: #fef0c7;
  color: var(--warning);
}

.term-chip.danger {
  background: #fee4e2;
  color: var(--danger);
}

.empty-inline {
  color: var(--muted);
  margin: 0;
}

.analysis-note {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  margin: 0;
  padding: 12px;
}

.detail-list {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: 150px minmax(0, 1fr);
  margin: 0;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.preline {
  white-space: pre-wrap;
}

.rtl-text {
  direction: rtl;
  text-align: right;
}

.transcript-full {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.9;
  margin: 0;
  max-height: 560px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
  word-break: normal;
}

.auth-body {
  background: #111820;
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

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

.brand-name {
  font-size: 22px;
  font-weight: 800;
}

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

.auth-form {
  display: grid;
  gap: 16px;
}

.checkline {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 9px;
}

.checkline input {
  min-height: 16px;
  width: 16px;
}

.full {
  justify-content: center;
  width: 100%;
}

@media (max-width: 1100px) {
  .kpi-grid,
  .review-kpis,
  .split-grid,
  .analysis-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-meta div {
    border-bottom: 1px solid var(--line);
  }
}

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

  .sidebar {
    position: static;
  }

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

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar form,
  .search-form {
    width: 100%;
  }

  .kpi-grid,
  .split-grid,
  .probe-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }

  .analysis-meta,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .analysis-meta div {
    border-right: 0;
  }
}
