/* Minimalista y mobile-first. Colores en variables; el modo oscuro solo las redefine. */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --text: #15171a;
  --muted: #5d636d;
  --faint: #a0a6ae;
  --line: #e5e7eb;
  --line-strong: #cdd1d7;
  --accent: #2456d6;
  --accent-soft: #ebf0fc;
  --accent-text: #ffffff;
  --radius: 8px;
  --member: #a0a6ae;
  --st: #a0a6ae;

  --c-progress: #b76b00;
  --c-completed: #2456d6;
  --c-correction: #cf3a2d;
  --c-uploaded: #1d8047;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --bg-soft: #1a1c1f;
    --text: #eceef1;
    --muted: #a3a9b2;
    --faint: #6b717a;
    --line: #2a2d32;
    --line-strong: #3b3f46;
    --accent: #7ba1ff;
    --accent-soft: #1b2440;
    --accent-text: #0c1120;

    --c-progress: #f0a93b;
    --c-completed: #7ba1ff;
    --c-correction: #ff7b6f;
    --c-uploaded: #52c784;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
code { background: var(--bg-soft); border: 1px solid var(--line); padding: 0 4px; border-radius: 4px; }

.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.cap-first { display: inline-block; }
.cap-first::first-letter { text-transform: uppercase; }
.empty { color: var(--muted); padding: 24px 0; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---- Barra superior ---- */
.topbar { border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px;
}
.brand { display: flex; flex-direction: column; padding: 12px 0; color: var(--text); text-decoration: none; line-height: 1.15; }
.brand-main { font-weight: 700; }
.brand-sub { font-size: .8rem; color: var(--muted); }
.tabs { order: 3; width: 100%; display: flex; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 10px 2px; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; font-size: .9rem;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.topbar-user { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: .9rem; }
@media (min-width: 820px) {
  .tabs { order: 0; width: auto; flex: 1; justify-content: flex-start; align-self: stretch; }
  .tabs a { display: flex; align-items: center; padding: 0 12px; font-size: .95rem; }
  .topbar-user { margin-left: 0; }
}

/* ---- Controles ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--text); filter: none; }
.btn-small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--accent); font: inherit; cursor: pointer; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 500; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: .9rem; color: var(--text); font-weight: 400; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="color"] { padding: 2px; height: 40px; }
textarea { resize: vertical; }
fieldset { border: 0; margin: 0; padding: 0; }
.input-narrow { width: 5em; }

.flash { margin-bottom: 20px; padding: 10px 14px; border-left: 3px solid var(--line-strong); background: var(--bg-soft); border-radius: 0 6px 6px 0; }
.flash-ok { border-left-color: var(--c-uploaded); }
.flash-error { border-left-color: var(--c-correction); }
.flash-warn { border-left-color: var(--c-progress); }

/* ---- Encabezado de página ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.segmented a { padding: 6px 14px; color: var(--text); text-decoration: none; font-size: .9rem; }
.segmented a.active { background: var(--text); color: var(--bg); }
.pager { display: flex; align-items: center; gap: 6px; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text); text-decoration: none;
  font-size: 1.35rem; line-height: 1;
}
.pager-btn:hover, .pager-today:hover { border-color: var(--text); }
.pager-label { font-weight: 600; padding: 0 6px; font-variant-numeric: tabular-nums; }
.pager-today { padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text); text-decoration: none; font-size: .9rem; }

/* ---- Estados ---- */
.st-in_progress { --st: var(--c-progress); }
.st-completed { --st: var(--c-completed); }
.st-in_correction { --st: var(--c-correction); }
.st-uploaded { --st: var(--c-uploaded); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; white-space: nowrap; }
.st-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--st); flex: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--member); flex: none; }
.sdots { display: inline-flex; gap: 2px; vertical-align: middle; }
.sdot { width: 8px; height: 8px; border-radius: 2px; background: var(--st); }

/* ---- Calendario: mes ---- */
.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.cal-dow div { padding: 8px; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 34px auto auto minmax(36px, 1fr);
  min-height: 124px;
  border-bottom: 1px solid var(--line);
}
.cal-week:last-child { border-bottom: 0; }
.cal-cell { grid-row: 1 / -1; padding: 5px 6px; border-right: 1px solid var(--line); color: inherit; text-decoration: none; }
.cal-cell:nth-child(7) { border-right: 0; }
.cal-cell:hover { background: var(--bg-soft); }
.cal-cell.is-out { background: var(--bg-soft); }
.cal-cell.is-out .cal-num { color: var(--faint); }
.cal-num {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cal-cell.is-today .cal-num { background: var(--accent); color: var(--accent-text); }

.cal-bar {
  position: relative; z-index: 1; min-width: 0; margin: 2px 4px; padding: 2px 8px; border-radius: 4px;
  display: flex; align-items: center; gap: 10px; overflow: hidden; white-space: nowrap;
  font-size: .75rem; pointer-events: none;
}
.bar-label { font-weight: 600; }
.bar-person { display: inline-flex; align-items: center; gap: 5px; }
.bar-note { color: var(--muted); }
.bar-production { background: var(--bg-soft); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.bar-production .bar-label { color: var(--text); }
.bar-shorts { background: var(--accent-soft); color: var(--text); }

.cal-ev {
  grid-row: 4; align-self: start; position: relative; z-index: 1; min-width: 0;
  margin: 4px 4px 6px; padding: 3px 6px; display: flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-strong); border-left: 3px solid var(--member); border-radius: 4px;
  background: var(--bg); color: var(--text); text-decoration: none; font-size: .78rem; font-weight: 600;
}
.cal-ev:hover { border-color: var(--text); border-left-color: var(--member); }
.ev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-short { display: none; }
.cal-ev.ev-tbd { border-style: dashed; border-left-width: 1px; color: var(--muted); font-weight: 500; }
.cal-ev.ev-review { background: var(--text); border-color: var(--text); color: var(--bg); }

.cal-strip { margin-bottom: 8px; }
.cal-strip .cal-week { min-height: 96px; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 14px; color: var(--muted); }
.legend .status { color: var(--muted); }
.legend-bar { font-size: .78rem; padding: 1px 8px; border-radius: 4px; }

@media (max-width: 600px) {
  .cal-dow div { padding: 6px 4px; font-size: .66rem; letter-spacing: 0; }
  .cal-week { grid-template-rows: 28px auto auto minmax(30px, 1fr); min-height: 100px; }
  .cal-cell { padding: 3px; }
  .cal-num { width: 22px; height: 22px; font-size: .78rem; }
  .cal-bar { margin: 2px; padding: 1px 5px; gap: 6px; font-size: .68rem; }
  .cal-ev { margin: 3px 2px 4px; padding: 2px 3px; gap: 3px; font-size: .68rem; border-left-width: 2px; }
  .cal-ev .st-dot { width: 6px; height: 6px; }
  .cal-ev.has-short .ev-long { display: none; }
  .cal-ev.has-short .ev-short { display: block; white-space: normal; line-height: 1.15; }
}

/* ---- Calendario: semana ---- */
.wk {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto auto auto minmax(260px, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.wk-day { grid-row: 1 / -1; display: grid; grid-template-rows: subgrid; min-width: 0; border-right: 1px solid var(--line); }
.wk-day:last-child { border-right: 0; }
.wk-head { grid-row: 1; display: flex; align-items: baseline; gap: 6px; padding: 10px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.wk-dow { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wk-num { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wk-day.is-today .wk-num { color: var(--accent); }
.wk-body { grid-row: 4; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 8px; }
.wk-bar {
  position: relative; z-index: 1; margin: 6px 6px 0; padding: 4px 10px; border-radius: 4px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .85rem;
}
.wk-ev {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 8px;
  border: 1px solid var(--line-strong); border-left: 3px solid var(--member); border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: .85rem;
}
.wk-ev:hover { border-color: var(--text); border-left-color: var(--member); }
.wk-ev-kind { font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wk-ev-who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.wk-ev-idea { color: var(--muted); overflow-wrap: anywhere; }
.wk-ev .tasks-ro { align-self: stretch; }
.wk-ev .progress-row { flex-wrap: wrap; gap: 2px 8px; }
.wk-ev .progress { flex: 1 1 40px; width: auto; }
.wk-ev-tbd { border-style: dashed; border-left-width: 1px; color: var(--muted); }
.wk-ev-review { border-left-color: var(--text); }
.wk-ev-review:hover { border-left-color: var(--text); }

@media (max-width: 720px) {
  .wk { display: flex; flex-direction: column; }
  .wk-bar { margin: 8px 8px 0; }
  .wk-bar + .wk-day, .wk-day:first-of-type { margin-top: 8px; }
  .wk-day { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: none; border-right: 0; border-top: 1px solid var(--line); }
  .wk-head { grid-row: auto; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 10px; background: none; border-bottom: 0; }
  .wk-body { grid-row: auto; padding: 8px 8px 8px 0; }
  .wk-body:empty { padding: 0; }
}

/* ---- Mi semana ---- */
.headline { display: flex; flex-wrap: wrap; gap: 0 .4em; margin-bottom: 6px; font-size: clamp(1.4rem, 4.5vw, 2rem); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.headline-yes { color: var(--c-uploaded); }
.headline-shorts { font-size: clamp(1.1rem, 3.5vw, 1.4rem); }
.headline-date { color: var(--muted); font-weight: 500; }
.subline { max-width: 72ch; margin-bottom: 20px; color: var(--muted); }

.item { padding: 28px 0; border-bottom: 1px solid var(--line); }
.cal-strip + .item { margin-top: 12px; }
.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.item-grid { display: grid; gap: 24px; }
@media (min-width: 860px) { .item-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 40px; } }
.label-title { margin-bottom: 8px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.review-notes { margin-bottom: 16px; padding: 8px 12px; border-left: 3px solid var(--c-correction); background: var(--bg-soft); }

/* ---- Tareas ---- */
.task-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.task { display: flex; align-items: center; gap: 4px; min-height: 44px; border-bottom: 1px solid var(--line); }
.task form { margin: 0; }
.tbox {
  position: relative; display: inline-block; flex: none; width: 20px; height: 20px; padding: 0;
  border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--bg); cursor: pointer;
}
.task .tbox { margin: 12px 8px 12px 2px; }
.task-in_progress .tbox { border-color: var(--c-progress); background: linear-gradient(90deg, var(--c-progress) 50%, var(--bg) 50%); }
.task-done .tbox { border-color: var(--c-uploaded); background: var(--c-uploaded); }
.task-done .tbox::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.tbox-sm { width: 14px; height: 14px; border-radius: 3px; cursor: default; }
.task-done .tbox-sm::after { left: 3px; top: 0; width: 4px; height: 8px; border-width: 0 1.5px 1.5px 0; }
.task-title { flex: 1; min-width: 0; }
.task-title summary { padding: 10px 0; list-style: none; cursor: pointer; overflow-wrap: anywhere; }
.task-title summary::-webkit-details-marker { display: none; }
.task-title form { padding-bottom: 10px; }
.task-done .task-title summary { color: var(--muted); text-decoration: line-through; }
.tag-btn { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font-size: .75rem; cursor: pointer; }
.tag-btn.is-private { border-color: var(--text); color: var(--text); }
.x-btn { width: 32px; height: 32px; border: 0; background: none; color: var(--faint); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.x-btn:hover { color: var(--c-correction); }
.tasks-count { margin-top: 6px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.task-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.task-add input[name="title"] { flex: 1 1 180px; }

.tasks-ro { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress { display: block; width: 72px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--c-uploaded); }
.progress-row .tasks-count { margin: 0; }
.task-list-ro { display: flex; flex-direction: column; gap: 3px; font-size: .88rem; }
.task-ro { display: flex; align-items: center; gap: 8px; }
.task-ro.task-done span:last-child { color: var(--muted); text-decoration: line-through; }

/* ---- Listas (Equipo, Revisión) ---- */
.section { margin-bottom: 40px; }
.section-title { padding-bottom: 8px; border-bottom: 2px solid var(--text); font-size: 1.05rem; font-weight: 700; }
.section-title .muted { font-weight: 500; }

.person { display: grid; gap: 12px 32px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.person-labels { display: none; }
@media (min-width: 860px) {
  .person { grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr); }
  .person-labels { display: grid; padding: 8px 0; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
}
.person-id { display: flex; flex-direction: column; gap: 2px; }
.person-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.flag { font-size: .9rem; color: var(--muted); }
.flag-yes { color: var(--c-uploaded); font-weight: 600; }
.person-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ro-item { display: flex; flex-direction: column; gap: 3px; }
.ro-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ro-label { font-size: .9rem; font-weight: 600; }
.idea { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

.review-row { display: grid; gap: 12px 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 860px) {
  .review-row { grid-template-columns: 220px 190px 160px minmax(0, 1fr); align-items: start; }
  .review-row-short { grid-template-columns: 220px 190px minmax(0, 1fr); }
}
.review-who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-foot { display: flex; justify-content: flex-end; padding-top: 4px; }

/* ---- Ajustes ---- */
.section > form, .section > p { margin-top: 16px; }
.generate-form { padding-top: 8px; }
.week-admin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 !important; padding: 10px 0; border-bottom: 1px solid var(--line); }
.week-admin-date { min-width: 130px; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-admin.is-current .week-admin-date { color: var(--accent); }
.inline-label { flex-direction: row; align-items: center; gap: 8px; }
.inline-label select { width: auto; }
.warn-text { color: var(--c-correction); font-size: .85rem; }
.config-list { display: grid; gap: 0; margin: 16px 0 0; }
.config-list > div { display: grid; gap: 2px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .config-list > div { grid-template-columns: 220px 1fr; align-items: center; } }
.config-list dt { font-size: .85rem; color: var(--muted); }
.config-list dd { margin: 0; font-weight: 500; }

/* ---- Login ---- */
.narrow { max-width: 400px; margin: 32px auto; }
.narrow h1 { margin-bottom: 20px; }
.member-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.member-pick legend { margin-bottom: 6px; font-size: .85rem; font-weight: 500; color: var(--muted); }
.member-pick label { position: relative; color: var(--text); }
.member-pick input { position: absolute; opacity: 0; }
.member-pick label > span {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px;
  border: 1px solid var(--line-strong); border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.member-pick input:checked + span { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.member-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
