/* ===== Shared app styles: login + dashboard ===== */

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid #d1d5db;
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
}

.btn-secondary:hover {
  background: #e5e7eb;
  color: var(--text);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.alert {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.alert code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0 0.25rem;
  border-radius: 4px;
}

/* ===== Login / sign-up ===== */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  padding: 2.25rem 2rem;
}

.auth-card .logo {
  display: inline-block;
  margin-bottom: 1.25rem;
}

.auth-card h1 {
  font-size: 1.7rem;
  margin-bottom: 0.25rem;
}

.auth-card .muted {
  margin-bottom: 1.5rem;
}

.auth-form .field {
  margin-bottom: 1.1rem;
}

.auth-form .field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.auth-form .field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

.auth-form .field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.auth-form .field.invalid input {
  border-color: var(--error);
}

.auth-form .error {
  display: block;
  color: var(--error);
  font-size: 0.875rem;
  min-height: 1em;
  margin-top: 0.3rem;
}

.auth-card .status {
  margin-top: 1rem;
  font-weight: 600;
  min-height: 1.2em;
}

.switch {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
}

/* ===== Status colors (shared) ===== */
.status.success { color: var(--success); }
.status.fail { color: var(--error); }

/* ===== Dashboard layout ===== */
.app-body {
  background: var(--bg-alt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.app-main {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}

.app-main h1 {
  margin-bottom: 0.25rem;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text);
}

.progress {
  margin-top: 0.4rem;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Panel + tasks */
.panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.panel h2 {
  margin-top: 0;
}

.task-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.task-form input {
  flex: 1;
  padding: 0.7rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  min-width: 0;
}

.task-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.task-form .btn {
  white-space: nowrap;
}

.panel .error {
  display: block;
  color: var(--error);
  font-size: 0.875rem;
  min-height: 1em;
}

.panel .status {
  font-weight: 600;
  min-height: 1.2em;
  margin-top: 0.25rem;
}

.task-list {
  list-style: none;
  margin-top: 0.75rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.25rem;
  border-bottom: 1px solid #f0f0f0;
}

.task-item:last-child {
  border-bottom: none;
}

.task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.task-title {
  flex: 1;
  word-break: break-word;
}

.task-item.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.btn-icon {
  background: none;
  border: 1px solid #fca5a5;
  color: var(--error);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-icon:hover {
  background: #fef2f2;
}

.empty {
  margin-top: 1rem;
  text-align: center;
}

@media (max-width: 560px) {
  .auth-card {
    padding: 1.75rem 1.25rem;
  }

  .task-form {
    flex-direction: column;
  }

  .app-user #user-email {
    display: none;
  }
}
