:root {
  --atlas-blue: #0056ad;
  --atlas-blue-dark: #004484;
  --atlas-soft: #eef6ff;
  --ink: #0f172a;
  --text: #243247;
  --muted: #667085;
  --line: #d9e0ea;
  --bg: #f5f8fc;
  --surface: #ffffff;
  --green: #18884f;
  --green-soft: #ddf6e8;
  --amber: #b76100;
  --amber-soft: #fff3dc;
  --red: #c43d12;
  --red-soft: #fff1eb;
  --shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

img {
  display: block;
  max-width: 100%;
}

.login-view {
  min-height: 100vh;
  background: #f8fafc;
}

.login-shell {
  width: min(1320px, calc(100vw - 72px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(400px, 520px);
  gap: 64px;
  align-items: center;
  padding: 42px 0;
}

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

.hero-brand img {
  width: 220px;
}

.hero-brand span {
  width: 1px;
  height: 54px;
  background: var(--line);
}

.hero-copy h1,
.login-card h2 {
  margin: 0 0 14px;
  color: var(--ink);
}

.hero-copy h1 {
  font-size: 36px;
  line-height: 1.14;
}

.hero-copy p,
.hero-brand p,
.login-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.login-logo {
  width: 190px;
  margin: 0 auto 26px;
}

.login-card form,
.modal-card label {
  display: grid;
  gap: 16px;
}

label {
  color: #344054;
  font-weight: 700;
}

.field-shell,
.filter-row input,
.filter-row select,
.modal-card textarea {
  border: 1px solid #cfd8e5;
  border-radius: 6px;
  background: #fff;
}

.field-shell {
  display: flex;
  margin-top: 8px;
}

.field-shell input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 15px 16px;
}

.primary-action,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 800;
}

.primary-action {
  background: var(--atlas-blue);
  color: white;
}

.primary-action:hover {
  background: var(--atlas-blue-dark);
}

.ghost-button,
.icon-button {
  background: white;
  color: var(--atlas-blue);
  border-color: var(--line);
}

.danger-button {
  background: #d0440c;
  color: white;
}

.primary-action:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-message {
  color: var(--red);
  min-height: 22px;
}

.app-view {
  min-height: 100vh;
}

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

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-brand img {
  width: 150px;
}

.topbar-brand span {
  width: 1px;
  height: 34px;
  background: var(--line);
}

.topbar-brand button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 850;
  font-size: 18px;
}

.session-pill {
  color: var(--muted);
  font-weight: 700;
}

.review-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 70px);
}

.side-nav {
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 700;
}

.side-nav a.active,
.side-nav a:hover {
  background: var(--atlas-soft);
  color: var(--atlas-blue);
}

.nav-icon {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 5px;
  display: inline-block;
}

.nav-icon.chart {
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 850;
}

.nav-icon.chart::before {
  content: "K";
}

.db-status {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.db-status strong,
.db-status small,
.version-note {
  display: block;
}

.db-status small,
.version-note {
  color: var(--muted);
}

.content-area {
  padding: 26px 28px 34px;
  overflow: hidden;
}

.breadcrumbs,
.review-hero,
.metric-strip,
.review-workspace {
  width: min(1500px, 100%);
  margin: 0 auto;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 18px;
}

.review-hero {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.review-hero h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 30px;
}

.review-hero p {
  margin: 0;
  color: var(--muted);
}

.hero-status,
.detail-summary {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  min-width: 190px;
}

.hero-status small,
.detail-summary small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.hero-status strong,
.detail-summary strong {
  color: var(--ink);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.metric-strip div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 5px;
}

.metric-strip small {
  color: var(--muted);
}

.metric-strip strong {
  color: var(--ink);
  font-size: 24px;
}

.review-workspace {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(640px, 1fr) minmax(380px, 520px);
  gap: 18px;
  align-items: start;
}

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

.report-table-panel {
  padding: 20px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-title-row h2 {
  margin: 0 0 4px;
  color: var(--ink);
}

.section-title-row p {
  margin: 0;
  color: var(--muted);
}

.filter-row {
  display: grid;
  grid-template-columns: 150px 150px 150px minmax(220px, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-row input,
.filter-row select {
  min-height: 42px;
  padding: 0 12px;
}

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

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

.report-table th,
.report-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #f8fbff;
  color: #344054;
  font-size: 13px;
}

.report-table tr {
  cursor: pointer;
}

.report-table tr:hover,
.report-table tr.selected {
  background: var(--atlas-soft);
}

.state-chip,
.severity-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.state-enviado,
.state-borrador {
  background: var(--amber-soft);
  color: var(--amber);
}

.state-aprobado,
.severity-baja {
  background: var(--green-soft);
  color: var(--green);
}

.state-devuelto,
.state-anulado,
.severity-alta,
.severity-critica {
  background: var(--red-soft);
  color: var(--red);
}

.detail-panel {
  min-height: 720px;
  overflow: hidden;
}

.detail-summary {
  border-width: 0 0 1px;
  border-radius: 0;
}

.detail-summary span {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.action-bar {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-tabs button {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  font-weight: 800;
  white-space: nowrap;
}

.detail-tabs button.active {
  background: var(--atlas-blue);
  border-color: var(--atlas-blue);
  color: white;
}

.detail-content {
  padding: 16px;
  display: grid;
  gap: 12px;
  max-height: 560px;
  overflow: auto;
}

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

.detail-card h3,
.detail-card p {
  margin: 0;
}

.detail-card h3 {
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 8px;
}

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

.kv {
  display: grid;
  gap: 3px;
}

.kv small {
  color: var(--muted);
  font-weight: 700;
}

.evidence-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.evidence-thumb {
  width: 76px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--atlas-soft);
  border: 1px solid var(--line);
}

.file-mark {
  width: 76px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--atlas-soft);
  color: var(--atlas-blue);
  border-radius: 6px;
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-card {
  width: min(520px, calc(100vw - 32px));
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal-card h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

.modal-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.modal-card textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .review-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .side-nav a {
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .db-status,
  .version-note {
    display: none;
  }

  .review-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-shell {
    width: min(100% - 24px, 520px);
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .login-hero {
    display: none;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .review-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    display: none;
  }

  .content-area {
    padding: 18px 14px;
  }

  .review-hero,
  .section-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-strip,
  .filter-row {
    grid-template-columns: 1fr;
  }
}
