* { box-sizing: border-box; }

.file-label {
  display: inline-block;
  cursor: pointer;
  margin-bottom: 10px;
}

.course-info-details {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

.course-info-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #2563eb;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  margin: 0;
  padding: 24px;
}

.app-header {
  max-width: 900px;
  margin: 0 auto 24px;
  text-align: center;
}

.app-header h1 {
  color: #1e3a8a;
  margin-bottom: 4px;
}

.app-home-link {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 36px;
  height: 36px;
}

.app-home-link:hover {
  text-decoration: underline;
}

.disclaimer {
  font-size: 12px;
  color: #9ca3af;
  max-width: 600px;
  margin: 4px auto 0;
}

.app-header p {
  color: #6b7280;
  margin-top: 0;
}

.app-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 44px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  transition: margin-left 0.2s, opacity 0.2s;
}

.sidebar.collapsed {
  margin-left: -260px;
  opacity: 0;
  pointer-events: none;
}

.sidebar:empty {
  display: none;
}

.sidebar-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: #1f2937;
  text-decoration: none;
  font-size: 14px;
}

.sidebar-link:hover {
  background: #f4f6f8;
}

.sidebar-sublink {
  padding-left: 22px;
  font-size: 13px;
  color: #4b5563;
}

.sidebar-section {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 14px 0 4px;
  padding: 0 10px;
}

.app-main {
  flex: 1;
  min-width: 0;
  max-width: 900px;
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    z-index: 15;
  }
  .sidebar.collapsed {
    margin-left: -100vw;
  }
}

.progress-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 4px;
}

.progress-step {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-bottom: 4px solid #d1d5db;
  color: #9ca3af;
  font-size: 13px;
}

.progress-step.active {
  border-bottom-color: #2563eb;
  color: #2563eb;
  font-weight: 600;
}

.progress-step.done {
  border-bottom-color: #16a34a;
  color: #16a34a;
}

.progress-num {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.apikey-bar {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.apikey-bar.apikey-missing input {
  flex: 1;
  min-width: 200px;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.apikey-bar .hint {
  width: 100%;
  font-size: 12px;
  color: #6b7280;
  margin: 4px 0 0;
}

.apikey-ok {
  color: #166534;
  background: #f0fdf4;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
}

.muted {
  color: #6b7280;
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  margin: 16px 0;
  transition: background 0.2s, border-color 0.2s;
}

.dropzone.dragover {
  background: #eff6ff;
  border-color: #2563eb;
}

.file-name {
  margin-top: 10px;
  font-weight: 600;
}

label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}

label.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

label.checkbox-row input[type="checkbox"] {
  width: auto;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}

.list-editor {
  margin-bottom: 8px;
}

.list-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.list-row input {
  flex: 1;
}

.seq-row {
  align-items: flex-start;
}

.seq-unidad {
  max-width: 160px;
  flex: 0 0 160px;
}

.seq-contenido {
  flex: 1;
  font-family: inherit;
}

.icon-btn {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e5e7eb;
  color: #1f2937;
}

.risk-banner {
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  border: 2px solid;
}

.risk-banner p {
  margin: 6px 0 0;
}

.risk-medio {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}

.risk-alto {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}

.link-btn {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
  padding: 6px 0;
  display: inline-block;
}

.link-btn-danger {
  color: #b91c1c;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.error-box {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.notice-box {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #d1d5db;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.assignment-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.assignment-card h3 {
  margin-top: 8px;
}

.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  align-self: flex-start;
}

.anti-ia {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 8px 10px;
  font-size: 13px;
  margin: 10px 0;
}

.assignment-card .btn {
  margin-top: auto;
}

.rubric-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.rubric-table th,
.rubric-table td {
  border: 1px solid #e5e7eb;
  padding: 8px;
  vertical-align: top;
  text-align: left;
  font-size: 13px;
}

.rubric-table th {
  background: #f9fafb;
}

.rubric-table textarea {
  width: 100%;
  min-width: 160px;
}

.rubric-table-wrap {
  overflow-x: auto;
}

.grading-result {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

textarea.autogrow {
  resize: none;
  overflow: hidden;
}

.unit-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0;
}

.unit-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
}

.unit-card h3 {
  margin-top: 0;
}

.unit-content {
  white-space: pre-wrap;
  color: #374151;
}

.auth-card {
  max-width: 420px;
  margin: 0 auto;
}

.auth-card select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 4px;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dash-header h2 {
  margin: 0;
}

.course-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.course-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
}

.course-card h4 {
  margin: 0 0 4px;
}
