/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:        #2563EB;
  --primary-hover:  #1D4ED8;
  --primary-light:  #EFF6FF;
  --success:        #16A34A;
  --success-light:  #F0FDF4;
  --warning:        #F59E0B;
  --danger:         #DC2626;
  --danger-light:   #FEF2F2;
  --bg:             #F1F5F9;
  --card:           #FFFFFF;
  --text:           #1E293B;
  --text-muted:     #64748B;
  --border:         #E2E8F0;
  --radius:         12px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 10px 15px rgba(0,0,0,.06);
}

/* ── Base ──────────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 16px;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  max-width: 680px;
  margin: 0 auto;
  gap: 0.75rem;
}

.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.header-branding { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.header-logo { font-size: 0.9rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.header-sep { color: var(--border); }
.header-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ── Avatar ────────────────────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
  position: relative;
}

.avatar:hover { opacity: 0.85; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.7rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 2rem;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }

label {
  display: block;
  font-size: 0.8375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

input[type="email"],
input[type="text"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--text);
  background: white;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select { cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  line-height: 1.2;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-success { background: var(--success); color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; border-radius: 6px; }
.btn-full { width: 100%; }

.btn-icon {
  padding: 0.375rem;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover { background: var(--bg); color: var(--danger); }

/* ── Progress bar ──────────────────────────────────────────── */
.progress-wrap { margin: 1rem 0; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.progress-label strong { color: var(--text); }

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── Task list ─────────────────────────────────────────────── */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s, background 0.2s;
}

.task-item.done {
  background: var(--success-light);
  border-color: #BBF7D0;
}

.task-check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all 0.15s;
}

.task-check:hover { border-color: var(--success); background: var(--success-light); }
.task-item.done .task-check { background: var(--success); border-color: var(--success); }

.check-svg { display: none; }
.task-item.done .check-svg { display: block; color: white; }

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: 0.9375rem;
  line-height: 1.4;
  word-break: break-word;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-evidence-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  word-break: break-all;
}

.task-peer-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-top: 0.2rem;
}

.task-side {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-gray { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Section title ─────────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
}

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--border);
  border-radius: 10px;
  padding: 0.25rem;
  margin-bottom: 1.25rem;
}

.tab {
  flex: 1;
  padding: 0.6rem 0.5rem;
  text-align: center;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  background: transparent;
  transition: all 0.15s;
}

.tab:hover:not(.active) { color: var(--text); }

.tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* ── People list ───────────────────────────────────────────── */
.people-list { display: flex; flex-direction: column; gap: 0.625rem; }

.person-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.person-info { flex: 1; min-width: 0; }
.person-name { font-weight: 600; font-size: 0.925rem; display: flex; align-items: center; gap: 0.375rem; }
.person-email { font-size: 0.775rem; color: var(--text-muted); margin-top: 0.1rem; word-break: break-all; }
.person-actions { display: flex; gap: 0.375rem; flex-shrink: 0; }

/* ── Team cards ────────────────────────────────────────────── */
.team-list { display: flex; flex-direction: column; gap: 0.625rem; }

.team-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1rem;
}

.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.625rem;
}

.team-pct { font-weight: 700; font-size: 1.1rem; }

.team-progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.team-task-list {
  list-style: none;
  margin-top: 0.625rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.team-task-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text);
  padding: 0.15rem 0;
}

.team-task-item.done { color: var(--text-muted); }
.team-task-item.done .team-task-title { text-decoration: line-through; }

.team-task-check { font-size: 0.7rem; color: var(--text-muted); flex-shrink: 0; }
.team-task-item.done .team-task-check { color: var(--success); }

.team-task-title { line-height: 1.4; word-break: break-word; }

.team-peer-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.3rem;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 1.5rem; }
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.25rem;
}

@media (min-width: 600px) {
  .modal { border-radius: var(--radius); }
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.125rem;
  color: var(--text);
}

.modal-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.125rem;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Task manage list (inside modal) ───────────────────────── */
.task-manage-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }

.task-manage-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border-radius: 8px;
}

.task-manage-title { flex: 1; font-size: 0.875rem; min-width: 0; word-break: break-word; }

/* ── Add task form ─────────────────────────────────────────── */
.add-form {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.add-form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.125rem;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.alert-success { background: var(--success-light); color: #15803D; border: 1px solid #BBF7D0; }
.alert-error   { background: var(--danger-light); color: #B91C1C; border: 1px solid #FECACA; }
.alert-info    { background: var(--primary-light); color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Empty state ───────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-icon { font-size: 2.25rem; margin-bottom: 0.75rem; }
.empty-text { font-size: 0.875rem; line-height: 1.5; }

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-1   { margin-top: 0.5rem; }
.mt-2   { margin-top: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-center { text-align: center; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.flex-1 { flex: 1; }

/* ── Recurso button ────────────────────────────────────────── */
.btn-recurso {
  color: var(--primary);
  border-color: var(--primary);
  text-decoration: none;
}

.btn-recurso:hover { background: var(--primary-light); color: var(--primary); }
.btn-recurso-empty { opacity: 0.45; }

/* ── Recurso edit rows (inside modal) ──────────────────────── */
.recurso-row {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.625rem;
  margin-bottom: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.recurso-row-url {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.recurso-row-url input { flex: 1; margin: 0; }
.recurso-row .recurso-etiqueta { font-size: 0.8rem; }

/* ── Recurso read-only list (inside show modal) ────────────── */
.recursos-list-view {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.recurso-item {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
}

.recurso-item-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 0.2rem;
}

.recurso-item-url {
  font-size: 0.8rem;
  word-break: break-all;
  margin-bottom: 0.375rem;
  line-height: 1.4;
}

.recurso-link { color: var(--primary); text-decoration: underline; }
.recurso-link:hover { opacity: 0.8; }

.recurso-item-actions { display: flex; gap: 0.375rem; }

/* ── Google Calendar section ───────────────────────────────── */
.cal-section {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
}

.cal-section-icon { font-size: 1rem; flex-shrink: 0; }

.cal-connected {
  color: var(--success);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ── Responsive tweaks ─────────────────────────────────────── */
@media (max-width: 400px) {
  .login-card { padding: 2rem 1.25rem; }
  .task-side .btn { display: none; } /* hide evidence btn on very small screens, show as tap on check */
}

@media (min-width: 600px) {
  .container { padding: 0 1.5rem; }
  .header-inner { padding: 0.875rem 1.5rem; }
  .task-side .btn { display: inline-flex; }
}
