:root {
  --ink: #172026;
  --muted: #5d6972;
  --line: #d8dee3;
  --panel: #ffffff;
  --page: #f4f6f7;
  --blue: #0b5cab;
  --green: #16724a;
  --red: #a12828;
  --amber: #8b5d00;
  --focus: #111827;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select { font: inherit; }

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: linear-gradient(135deg, #eef2f5, #ffffff 55%, #edf5ef);
}

.login-shell { width: min(440px, calc(100vw - 32px)); }

.login-panel,
.dni-panel,
.camera-panel,
.last-mark,
.marks-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.login-panel { padding: 28px; }

.brand-kicker,
.section-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

.brand-block h1,
.topbar h1 {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.1;
}

.sector-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.login-form input,
.toolbar-actions input,
.panel-heading select {
  min-height: 42px;
  border: 1px solid #bdc7cf;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.login-form button,
.secondary-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.login-form button {
  background: var(--blue);
  color: #fff;
}

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

.alert {
  margin-top: 18px;
  border-left: 4px solid var(--red);
  background: #fff1f1;
  padding: 10px 12px;
  color: var(--red);
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.app-shell {
  display: grid;
  gap: 18px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px 24px 28px;
}

.capture-layout {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(360px, 520px);
  gap: 18px;
  align-items: stretch;
}

.dni-panel,
.camera-panel,
.last-mark,
.marks-section { padding: 18px; }

.dni-panel label {
  display: block;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.dni-input {
  width: 100%;
  margin-top: 10px;
  border: 3px solid var(--focus);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 64px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  background: #fff;
  color: #0a0f14;
}

.dni-input:focus,
.login-form input:focus,
.toolbar-actions input:focus,
.panel-heading select:focus {
  outline: 3px solid rgba(11, 92, 171, 0.18);
  outline-offset: 2px;
}

.status-line {
  min-height: 32px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.status-line.error { color: var(--red); }
.status-line.ok { color: var(--green); }

.panel-heading,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-heading h2,
.table-toolbar h2 { font-size: 20px; }

#videoPreview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #101820;
  border: 1px solid #26323b;
  border-radius: 6px;
  object-fit: cover;
}

.last-mark {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 18px;
  align-items: center;
}

.last-info strong {
  display: block;
  margin-top: 6px;
  font-size: 54px;
  line-height: 1;
}

.last-info > span:not(.section-label) {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 28px;
  font-weight: 700;
}

.person-data {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
}

.last-photo {
  width: 240px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #e8edf1;
}

.last-photo.is-empty { visibility: hidden; }

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.table-wrap {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf1f4;
  color: #2c3943;
  font-size: 13px;
  text-transform: uppercase;
}

.thumb {
  width: 64px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: #e8edf1;
}

@media (max-width: 900px) {
  .topbar,
  .panel-heading,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .capture-layout,
  .last-mark { grid-template-columns: 1fr; }

  .last-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .dni-input { font-size: 44px; }
}
