:root {
  --bg: #faf8f4;
  --card: #ffffff;
  --text: #2b2620;
  --muted: #766f63;
  --border: #e7e1d6;
  --primary: #c1622b;
  --primary-dark: #a34f21;
  --secondary: #4a7a5a;
  --danger: #b3402e;
  --pending: #b8860b;
  --accepted: #2f6f9c;
  --rejected: #9a9a9a;
  --done: #4a7a5a;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.4;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.brand { font-weight: 700; font-size: 1.1em; }
.who { color: var(--muted); margin-left: auto; margin-right: 12px; }

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.family-layout {
  display: grid;
  grid-template-areas:
    "form"
    "calendar"
    "list";
  gap: 20px;
}
.col-form { grid-area: form; }
.col-calendar { grid-area: calendar; }
.col-list { grid-area: list; }

@media (min-width: 900px) {
  .container { max-width: 960px; }
  .family-layout {
    grid-template-columns: 1fr 380px;
    grid-template-areas:
      "form calendar"
      "list calendar";
    gap: 32px;
  }
}

h1 { font-size: 1.5em; margin: 0 0 16px; }
.task-title { white-space: pre-wrap; }
h2 { font-size: 1.15em; margin: 0 0 12px; }

a { color: var(--primary); }

.grid-buttons {
  display: grid;
  gap: 12px;
}

.big-btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 1.05em;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.big-btn:active { background: var(--primary-dark); }
.big-btn.secondary { background: var(--secondary); }
.big-btn.danger { background: var(--danger); }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  font-size: 1em;
  cursor: pointer;
  padding: 0;
}

.form-inline {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.form-inline input[type="text"] {
  flex: 1;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95em;
  color: var(--muted);
}

input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1em;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.task-list { display: flex; flex-direction: column; gap: 14px; }

.task-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 6px solid var(--pending);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
}
.task-card.status-aceptada { border-left-color: var(--accepted); }
.task-card.status-rechazada { border-left-color: var(--rejected); }
.task-card.status-completada { border-left-color: var(--done); }

.task-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.task-head strong {
  white-space: pre-wrap;
}

.badge {
  font-size: 0.75em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pending);
  color: #fff;
  white-space: nowrap;
}
.badge-aceptada { background: var(--accepted); }
.badge-rechazada { background: var(--rejected); }
.badge-completada { background: var(--done); }

.meta { color: var(--muted); font-size: 0.85em; margin: 4px 0 0; }
.msg { font-style: italic; color: var(--muted); }
.empty { color: var(--muted); }

.steps { list-style: none; padding: 0; margin: 6px 0; }
.steps li { padding: 4px 0; }
.steps li.done { color: var(--muted); text-decoration: line-through; }
.steps-title { margin: 10px 0 2px; font-weight: 600; font-size: 0.9em; color: var(--muted); }

.step-btn {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1em;
  cursor: pointer;
}
.step-btn.done { color: var(--muted); text-decoration: line-through; background: #f4f1eb; }

.reward-box {
  margin-top: 12px;
  padding: 12px;
  background: #fbf3ea;
  border-radius: 10px;
}
.reward-box .waiting { color: var(--pending); }
.reward-box .ok { color: var(--done); font-weight: 600; }

.panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.calendar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 22px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-title { text-transform: capitalize; }
.cal-nav {
  padding: 4px 12px;
  text-decoration: none;
  font-size: 1.2em;
  color: var(--primary);
}

.cal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.cal-table th {
  font-size: 0.75em;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 6px;
}
.cal-day, .cal-empty {
  text-align: center;
  padding: 6px 2px;
  vertical-align: top;
}
.cal-daynum {
  display: inline-block;
  width: 26px;
  height: 26px;
  line-height: 26px;
  border-radius: 50%;
  font-size: 0.9em;
}
.cal-day.today .cal-daynum {
  background: var(--primary);
  color: #fff;
}
.cal-day.has-tasks .cal-daynum {
  font-weight: 700;
}
.cal-dot {
  display: block;
  width: 6px;
  height: 6px;
  margin: 3px auto 0;
  border-radius: 50%;
  background: var(--accepted);
}

.cal-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  border-top: 1px solid var(--border);
}
.cal-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95em;
}
.cal-list li:last-child { border-bottom: none; }

.error { color: var(--danger); font-weight: 600; }

.users-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.user-row { flex-wrap: wrap; }
.user-row input, .user-row select { flex: 1; min-width: 90px; }
.danger-link {
  background: none;
  border: none;
  color: var(--danger);
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 0 0;
  font-size: 0.9em;
}

form.inline { display: inline; margin: 0; }
