:root {
  --ink: #1f2933;
  --muted: #627181;
  --line: #d9e0e7;
  --panel: #ffffff;
  --paper: #eef6fb;
  --brand: #0f5f9f;
  --brand-strong: #083f73;
  --mint: #e3f4ff;
  --amber: #ffe3a6;
  --coral: #ffd6c9;
  --sky: #dceafe;
  --shadow: 0 18px 48px rgba(34, 48, 58, 0.13);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(36, 91, 95, 0.13), rgba(255, 227, 166, 0.24)),
    var(--paper);
}

.login-shell {
  width: min(100%, 460px);
}

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

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--brand);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-lockup h1,
.page-header h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 34px;
}

label span,
.login-form label,
.unit-picker legend,
.choice-field legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

input[readonly] {
  background: #f7f9fb;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
}

.primary-button:hover {
  background: var(--brand-strong);
}

.ghost-button {
  color: var(--brand-strong);
  border-color: var(--line);
  background: #ffffff;
}

.link-button {
  margin-top: 22px;
}

.form-error {
  margin: 0;
  color: #a33b28;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  height: 100vh;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 24px;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 0.98rem;
  line-height: 1.2;
}

.sidebar-brand span {
  color: var(--muted);
  font-size: 0.86rem;
}

.subject-nav {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.subject-nav a {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.subject-nav a:hover {
  border-color: var(--brand);
}

.subject-nav span {
  font-weight: 800;
}

.subject-nav small,
.muted,
.header-meta,
.subject-cell small,
.evidence-list small {
  color: var(--muted);
}

.sidebar-logout {
  width: 100%;
}

.main-content {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 32px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.semester-pill {
  display: grid;
  gap: 2px;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
}

.semester-pill span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.matrix {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(34, 48, 58, 0.08);
}

.matrix-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(120px, 0.7fr) repeat(3, minmax(92px, 0.45fr));
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.matrix-row:first-child {
  border-top: 0;
}

.matrix-head {
  color: var(--muted);
  background: #eef4f4;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.subject-cell {
  display: grid;
  gap: 2px;
}

.group-code {
  font-weight: 800;
}

.report-pill {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}

.report-pill span {
  font-weight: 800;
}

.report-pill small {
  color: var(--muted);
}

.status-submitted {
  background: var(--mint);
  border-color: #a7d7b5;
}

.status-draft {
  background: var(--amber);
  border-color: #e2bd64;
}

.status-empty {
  background: #ffffff;
}

.empty-state,
.form-section,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.empty-state {
  margin-bottom: 20px;
  padding: 24px;
}

.report-header {
  align-items: center;
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  color: #08456f;
  background: var(--mint);
  font-weight: 800;
}

.notice-error {
  color: #8a2d1d;
  background: #ffe8e2;
  border-color: #f2b8aa;
}

.notice-warning {
  color: #7c4a03;
  background: #fff4d8;
  border-color: #f1d289;
}

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

.profile-card div {
  display: grid;
  gap: 4px;
}

.profile-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.report-form {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 22px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.readonly-grid,
.number-grid {
  display: grid;
  gap: 14px;
}

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

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

.readonly-grid label,
.number-grid label,
.wide-field {
  display: grid;
  gap: 7px;
}

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

.metrics div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 14px;
}

.metrics span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.metrics strong {
  font-size: 1.45rem;
}

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

.upload-block {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 16px;
}

.upload-copy h3,
.upload-copy p {
  margin: 0;
}

.upload-copy p {
  color: var(--muted);
  font-size: 0.92rem;
}

.unit-picker,
.choice-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 0;
  margin: 0;
  padding: 0;
}

.unit-picker legend,
.choice-field legend {
  flex-basis: 100%;
}

.unit-picker legend small {
  display: inline;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.unit-picker label,
.choice-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.unit-picker input,
.choice-field input {
  width: auto;
  min-height: auto;
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 86px;
  border: 1px dashed #9fb2bd;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-strong);
  font-weight: 800;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.file-drop.is-dragging,
.file-drop:hover {
  border-color: var(--brand);
  background: #e8f4fc;
  color: var(--brand);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.filename-preview {
  display: block;
  min-height: 22px;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.upload-block.needs-units {
  border-color: #e4876f;
  background: #fff8f6;
}

.upload-block.needs-units .unit-picker legend::after {
  content: "Selecciona una unidad para continuar.";
  display: block;
  margin-top: 4px;
  color: #9d3a25;
  font-size: 0.82rem;
}

.evidence-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.evidence-list a {
  color: var(--brand-strong);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-bottom: 28px;
}

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .subject-nav {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    max-height: none;
  }

  .main-content {
    padding: 24px;
  }

  .matrix {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .matrix-head {
    display: none;
  }

  .matrix-row {
    grid-template-columns: 1fr;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 12px;
  }

  .report-pill {
    grid-template-columns: 1fr auto;
    place-items: center stretch;
  }

  .readonly-grid,
  .number-grid,
  .metrics,
  .profile-card,
  .upload-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-panel,
  .form-section,
  .sidebar,
  .main-content {
    padding: 18px;
  }

  .page-header,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-lockup h1,
  .page-header h1 {
    font-size: 1.55rem;
  }
}
