:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e2e2e5;
  --text: #1c1c1f;
  --text-muted: #6b6b72;
  --accent: #2d2d33;
  --accent-contrast: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fdf0ef;
  --radius: 10px;
  --gap: 1rem;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 8px rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --surface: #232327;
    --border: #35353b;
    --text: #f0f0f2;
    --text-muted: #9a9aa2;
    --accent: #eaeaec;
    --accent-contrast: #17171a;
    --danger: #ff8079;
    --danger-bg: #3a1f1e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 8px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.app h1 {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
}

.app.wide {
  max-width: 880px;
}

/* Workspace de dois painéis (professor, logado) */
.workspace {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sidebar-header h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0;
}

.panel {
  flex: 1;
  min-width: 0;
}

.icon-btn {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}

.icon-btn:hover {
  border-color: var(--text-muted);
}

.new-project-form {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.new-project-form input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  margin-bottom: 0.6rem;
}

.project-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.project-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: calc(var(--radius) - 4px);
}

.project-list li.selected {
  background: var(--bg);
}

.project-list .project-name {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.5rem 0.4rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  border-radius: calc(var(--radius) - 4px);
}

.project-list .project-name:hover {
  background: var(--bg);
}

.badge {
  font-size: 0.6875rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  margin-left: 0.3rem;
}

@media (max-width: 640px) {
  .workspace {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
}

/* Indicador de etapas */
.steps {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
  list-style: none;
  padding: 0;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.steps .dot {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.steps li.active {
  color: var(--text);
  font-weight: 600;
}

.steps li.active .dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.steps li.done .dot {
  background: var(--surface);
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.steps li:not(:last-child)::after {
  content: "";
  width: 1.25rem;
  height: 1px;
  background: var(--border);
  margin: 0 0.15rem;
}

/* Cartão da etapa atual */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card + .card {
  margin-top: 1.25rem;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.field {
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

/* Botões */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.actions-right {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

button {
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: calc(var(--radius) - 4px);
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
}

button.primary {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

button.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

button.back {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.2rem;
  font-size: 0.8125rem;
}

button.back:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Mensagens */
.alert {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.folder-chosen {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

.folder-chosen strong {
  color: var(--text);
  font-weight: 500;
}

/* Resumo/relatório */
.report {
  margin-top: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.85rem 1rem;
  font-size: 0.8125rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1rem;
}

/* Detalhes colapsáveis (contagens, árvore de arquivos) */
.tree {
  margin: 0.5rem 0 1rem;
  font-size: 0.875rem;
}

.tree summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8125rem;
  user-select: none;
}

.tree summary:hover {
  color: var(--text);
}

.tree-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0.75rem 0 0.25rem;
}

.file-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-tree li {
  padding: 0.15rem 0 0.15rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  border-left: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
