/* ============================================================
   Asistente de Tareas — estilo "sticker" / brutalista suave
   ============================================================ */

:root {
  --ink: #1e293b;
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --line: #1e293b;
  --accent: #14b8a6;
  --accent-ink: #ffffff;
  --danger: #ef4444;
  --warn: #f59e0b;

  --c-teal: #14b8a6;
  --c-red: #ef4444;
  --c-orange: #f97316;
  --c-yellow: #eab308;
  --c-blue: #3b82f6;
  --c-purple: #a855f7;
  --c-green: #22c55e;
  --c-pink: #ec4899;

  --radius: 14px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #000000;
    --bg: #14181f;
    --surface: #1e242e;
    --surface-2: #171c24;
    --text: #e8edf5;
    --muted: #94a3b8;
    --line: #000000;
    --accent: #2dd4bf;
    --accent-ink: #06231f;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%239C92AC' fill-opacity='0.09' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; font-weight: 900; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Superficies ---------- */

.card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Botones ---------- */

.btn {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 700;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  min-height: 44px;
}
.btn:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--surface-2); }
.btn-compact { padding: 0.45rem 0.75rem; font-size: 0.85rem; min-height: 40px; }
.btn-icon {
  padding: 0; width: 42px; height: 42px; min-height: 42px;
  display: inline-grid; place-items: center; font-size: 1.15rem; line-height: 1;
}
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Campos ---------- */

.input {
  width: 100%;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 9px;
  padding: 0.65rem 0.7rem;
  min-height: 44px;
}
.input:focus { outline: none; box-shadow: var(--shadow-sm); transform: translate(-1px, -1px); }
.input-sm { padding: 0.4rem 0.5rem; min-height: 40px; font-size: 0.85rem; }
textarea.input { min-height: 64px; resize: vertical; }

.field { display: grid; gap: 0.3rem; margin-bottom: 0.85rem; }
.field > span { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.field > span em { font-weight: 600; text-transform: none; letter-spacing: 0; font-style: normal; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }

.check { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.alert { padding: 0.7rem 0.85rem; border-radius: 10px; border: 2px solid var(--line); font-size: 0.85rem; font-weight: 600; }
.alert-error { background: #fee2e2; color: #7f1d1d; }
.alert-info { background: #fef9c3; color: #713f12; }

/* ---------- Login ---------- */

.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { padding: 2rem 1.5rem; text-align: center; max-width: 380px; width: 100%; display: grid; gap: 0.85rem; }
.login-mark { font-size: 3.5rem; line-height: 1; }
.login-card h1 { font-size: 1.6rem; text-transform: uppercase; }
.gsi-slot { display: grid; place-items: center; min-height: 44px; margin-top: 0.4rem; }
.fineprint { font-size: 0.72rem; color: var(--muted); }

/* ---------- Estructura ---------- */

.app { padding-bottom: calc(1.5rem + var(--safe-b)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
  padding: calc(0.6rem + var(--safe-t)) 0.9rem 0.6rem;
}
.topbar-inner { display: flex; align-items: center; gap: 0.6rem; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0; }
.brand-mark { font-size: 1.6rem; }
.brand > div { display: grid; line-height: 1.15; min-width: 0; }
.brand strong { font-size: 1rem; font-weight: 900; text-transform: uppercase; }
.topbar-actions { display: flex; gap: 0.4rem; }

.progress-wrap { max-width: 1100px; margin: 0.6rem auto 0; }
.progress {
  height: 12px; background: var(--surface-2);
  border: 2px solid var(--line); border-radius: 7px; overflow: hidden;
}
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .45s ease; }
.stats-row { display: flex; gap: 0.9rem; margin-top: 0.4rem; font-size: 0.72rem; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.stats-row b { color: var(--text); font-size: 0.95rem; }

.tabs {
  display: flex; gap: 0.4rem; padding: 0.7rem 0.9rem 0;
  max-width: 1100px; margin: 0 auto; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 2px solid var(--line); border-radius: 10px; background: var(--surface);
  padding: 0.5rem 0.8rem; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  white-space: nowrap; box-shadow: var(--shadow-sm); min-height: 42px;
}
.tab.is-active { background: var(--ink); color: #fff; box-shadow: none; transform: translate(3px, 3px); }
@media (prefers-color-scheme: dark) { .tab.is-active { background: var(--accent); color: var(--accent-ink); } }

.filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; align-items: center;
  padding: 0.6rem; margin: 0.8rem 0.9rem 0; max-width: 1100px;
}
.filters .input { width: 100%; min-width: 0; }
.filters .check { justify-content: center; background: var(--surface-2);
  border: 2px solid var(--line); border-radius: 9px; min-height: 40px; }
@media (min-width: 720px) {
  .filters { display: flex; flex-wrap: wrap; }
  .filters .input { width: auto; flex: 1 1 130px; }
  .filters .check { background: none; border: none; }
}
@media (min-width: 1140px) { .filters { margin-left: auto; margin-right: auto; } }
.tab-filter { margin-left: auto; }
.tab-filter.is-on { background: var(--accent); color: var(--accent-ink); }

.main { max-width: 1100px; margin: 0 auto; padding: 0.9rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; min-width: 0; }
/* minmax(0,1fr) impide que una tarjeta ancha ensanche la columna y provoque scroll lateral. */
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; min-width: 0; }

/* ---------- Tarjeta de tarea ---------- */

.task {
  background: var(--surface);
  border: 2px solid var(--line);
  border-left-width: 7px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.8rem 0.85rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  min-width: 0;
  animation: pop .28s ease-out both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .task { animation: none; } }

.task.is-done { opacity: .5; }
.task.is-done .task-text { text-decoration: line-through; color: var(--muted); }

.task-head { display: flex; gap: 0.6rem; align-items: flex-start; min-width: 0; }
.rank {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  border: 2px solid var(--line); background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 0.9rem;
}
@media (prefers-color-scheme: dark) { .rank { background: var(--accent); color: var(--accent-ink); } }
.rank.rank-1 { background: var(--c-teal); color: #06231f; }
.rank.rank-2 { background: var(--c-blue); color: #fff; }
.rank.rank-3 { background: var(--c-purple); color: #fff; }

.task-text { font-weight: 700; font-size: 0.98rem; line-height: 1.3; flex: 1; min-width: 0; overflow-wrap: anywhere; }

.task-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; min-width: 0; }
.pill {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  padding: 0.22rem 0.45rem; border-radius: 6px; border: 1.5px solid currentColor;
  display: inline-flex; align-items: center; gap: 0.2rem; white-space: nowrap;
}
.pill-score { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (prefers-color-scheme: dark) { .pill-score { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } }
.pill-alta { color: #b91c1c; background: #fee2e2; }
.pill-media { color: #c2410c; background: #ffedd5; }
.pill-baja { color: #a16207; background: #fef9c3; }
.pill-due { color: #1d4ed8; background: #dbeafe; }
.pill-late { color: #fff; background: var(--danger); border-color: var(--danger); }
.pill-plain { color: var(--muted); background: var(--surface-2); border-color: var(--muted); }

.task-actions { display: flex; gap: 0.3rem; align-items: center; flex: none; }
.sbtn {
  border: 2px solid var(--line); border-radius: 9px; background: var(--surface-2);
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 1.25rem;
  cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform .1s ease, box-shadow .1s ease;
}
.sbtn:active { transform: translate(2px, 2px); box-shadow: none; }
.sbtn.is-on { background: var(--accent); }

.task.alert-late { animation: pulseRed 2s infinite; }
.task.alert-deleg { animation: pulseAmber 2.6s infinite; }
@keyframes pulseRed { 0%,100% { border-color: var(--line); } 50% { border-color: var(--danger); } }
@keyframes pulseAmber { 0%,100% { border-color: var(--line); } 50% { border-color: var(--warn); } }
@media (prefers-reduced-motion: reduce) { .task.alert-late, .task.alert-deleg { animation: none; } }

.score-detail {
  display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; min-width: 0;
  font-size: 0.72rem; color: var(--muted);
  border-top: 1.5px dashed var(--muted); padding-top: 0.4rem;
}
.score-detail span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Agrupadores ---------- */

.group-title {
  min-width: 0;
  font-size: 0.95rem; font-weight: 900; text-transform: uppercase;
  display: flex; align-items: center; gap: 0.45rem; margin: 0.5rem 0 0.1rem;
}
.group-title .count { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.group-title::after { content: ""; flex: 1; height: 2px; background: var(--line); opacity: .25; }

/* ---------- Calendario ---------- */

.calendar-card { padding: 0.8rem; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.7rem; }
.calendar-head h3 { font-size: 0.95rem; text-align: center; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; }
.cday {
  background: var(--surface-2); border: 2px solid var(--line); border-radius: 9px;
  padding: 0.3rem 0.2rem; min-height: 78px; display: grid; gap: 0.2rem; align-content: start;
}
.cday.is-today { background: var(--accent); color: var(--accent-ink); }
.cday-label { font-size: 0.62rem; font-weight: 900; text-align: center; text-transform: uppercase; }
.cday-num { font-size: 0.95rem; font-weight: 900; text-align: center; line-height: 1; }
.cdot {
  font-size: 0.58rem; font-weight: 800; padding: 0.12rem 0.2rem; border-radius: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
  border-left: 3px solid currentColor;
}

/* ---------- Estado vacío ---------- */

.empty {
  text-align: center; padding: 2.5rem 1.2rem; border: 2px dashed var(--muted);
  border-radius: var(--radius); color: var(--muted); font-weight: 600; background: var(--surface);
}
.empty .big { font-size: 2.2rem; display: block; margin-bottom: 0.4rem; }

.congrats { background: var(--accent); color: var(--accent-ink); text-align: center; padding: 1.8rem 1.2rem; }
.congrats h2 { font-size: 1.3rem; margin-top: 0.3rem; }

/* ---------- Modales ---------- */

.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5);
  display: grid; place-items: end center; padding: 0;
}
@media (min-width: 720px) { .modal { place-items: center; padding: 1.5rem; } }

.modal-box {
  width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column;
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; border-bottom: none;
  animation: slideUp .22s ease-out;
}
@media (min-width: 720px) {
  .modal-box { border-radius: var(--radius); box-shadow: var(--shadow); border-bottom: 2px solid var(--line); }
}
@keyframes slideUp { from { transform: translateY(22px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.9rem 1rem; border-bottom: 2px solid var(--line); flex: none;
}
.modal-head h3 { font-size: 1.05rem; text-transform: uppercase; }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-body { padding: 1rem; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }

/* El pie no scrollea: "Guardar" siempre está a la vista. */
.modal-foot {
  display: flex; gap: 0.5rem; align-items: center; flex: none;
  padding: 0.7rem 1rem calc(0.7rem + var(--safe-b));
  border-top: 2px solid var(--line);
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
}

.score-preview {
  background: var(--surface-2); border: 2px dashed var(--line); border-radius: 10px;
  padding: 0.6rem 0.7rem; font-size: 0.78rem; margin-bottom: 0.8rem;
}
.score-preview b { font-size: 1.05rem; }

/* ---------- Ajustes ---------- */

.setting-block { padding: 0.9rem 0; border-bottom: 2px dashed var(--muted); }
.setting-block:last-child { border-bottom: none; }
.setting-block h4 { font-size: 0.9rem; text-transform: uppercase; margin-bottom: 0.5rem; }
.setting-block > p { margin-bottom: 0.6rem; }

.chip-editor { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.5rem;
  border: 2px solid var(--line); border-radius: 8px; background: var(--surface-2);
  font-size: 0.8rem; font-weight: 700; border-left-width: 6px;
}
.chip.is-archived { opacity: .45; }
.chip button {
  border: none; background: none; cursor: pointer; font-size: 1rem;
  line-height: 1; padding: 0 0.1rem; color: var(--muted);
}
.chip button:hover { color: var(--danger); }
.add-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.add-row .input { flex: 1 1 140px; width: auto; }

.weights { display: grid; gap: 0.5rem; margin-bottom: 0.7rem; }
.weight-row { display: grid; grid-template-columns: 1fr 78px; gap: 0.5rem; align-items: center; font-size: 0.85rem; font-weight: 700; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 0.7rem 1.1rem; border-radius: 11px;
  font-weight: 700; font-size: 0.85rem; z-index: 90; max-width: 90vw; text-align: center;
  border: 2px solid var(--ink); box-shadow: var(--shadow-sm);
}
@media (prefers-color-scheme: dark) { .toast { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } }
.toast.is-error { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Confeti ---------- */

.confetti {
  position: fixed; z-index: 100; font-size: 1.8rem; pointer-events: none;
  transition: transform .95s cubic-bezier(.17,.67,.83,.67), opacity .95s linear;
  will-change: transform, opacity;
}

/* ============================================================
   Duración estimada y captura de tiempo real
   ============================================================ */

.dur-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.dur-row .input { flex: 1 1 auto; min-width: 0; }

.btn-compact {
  flex: 0 0 auto;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

#t-sug-hint {
  font-style: normal;
  font-weight: 500;
  font-size: 0.75rem;
}

.time-task {
  font-weight: 800;
  font-size: 1rem;
  margin: 0 0 0.25rem;
  overflow-wrap: anywhere;
}

.time-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0;
}

.time-chip {
  flex: 1 1 28%;
  min-width: 0;
  padding: 0.6rem 0.4rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 10px;
}

.time-chip:hover { background: var(--accent); color: var(--accent-ink); }
.time-chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   Vista Ritmos
   ============================================================ */

#view-ritmos { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }

.panel {
  padding: 1rem;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--line);
}

.panel h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.panel-sub { margin: 0.2rem 0 0.7rem; font-size: 0.78rem; }

.aviso {
  margin: 0 0 0.8rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 9px;
  border: 2px solid var(--warn);
  color: var(--text);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.6rem;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 10px;
}

.stat-val { font-size: 1.25rem; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.stat-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.stat-note { font-size: 0.68rem; color: var(--muted); }

.bars { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
}

.bar-label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  height: 14px;
  min-width: 0;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-val { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 420px) {
  .bar-row { grid-template-columns: minmax(0, 4.5rem) minmax(0, 1fr) auto; font-size: 0.72rem; }
}

/* ============================================================
   Duplicados
   ============================================================ */

.dup-alert {
  margin: -0.35rem 0 0.9rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.8rem;
  border: 2px solid var(--warn);
  border-radius: 10px;
  background: var(--surface-2);
}

.dup-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.45rem;
}

.dup-text { min-width: 0; overflow-wrap: anywhere; }
.dup-text small, .dup-item small { display: block; color: var(--muted); font-size: 0.7rem; }

.dup-banner {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 2px solid var(--warn);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--line);
}

.dup-banner summary { cursor: pointer; font-weight: 800; font-size: 0.9rem; }

.dup-pair {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 2px dashed var(--line);
  font-size: 0.82rem;
}

.dup-pct { font-weight: 700; color: var(--muted); font-size: 0.72rem; margin-bottom: 0.3rem; }
.dup-item { margin: 0.25rem 0; overflow-wrap: anywhere; }
.dup-item b { display: inline-block; width: 1.3rem; }
.dup-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }

/* ============================================================
   Carga semanal y bloqueos
   ============================================================ */

#week-load { margin: 1rem 0; }

.cday-head {
  display: block;
  width: 100%;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  background: none;
  border: 0;
  cursor: pointer;
}
.cday-head:disabled { cursor: default; }
.cday-head .cday-label, .cday-head .cday-num { display: block; }
.cday-head:not(:disabled):hover .cday-num { text-decoration: underline; }

.cday.is-past { opacity: 0.55; }
.cday.is-blocked {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, rgba(239, 68, 68, 0.12) 8px 16px);
}

.cblock {
  margin-top: 0.3rem;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--danger);
  overflow-wrap: anywhere;
}

.cload { margin-top: 0.35rem; }
.cload-bar {
  display: block;
  height: 8px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.cload-bar > span { display: block; height: 100%; background: var(--accent); }
.cload.is-high .cload-bar > span { background: var(--warn); }
.cload.is-full .cload-bar > span { background: var(--danger); }
.cload-txt { display: block; margin-top: 0.15rem; font-size: 0.62rem; font-weight: 700; color: var(--muted); white-space: nowrap; }

.stat-ok .stat-val { color: #15803d; }
.stat-bad .stat-val { color: var(--danger); }

.block-opts { display: grid; gap: 0.5rem; margin: 0.8rem 0; }
.block-opts .input { width: 5rem; display: inline-block; margin-left: 0.4rem; }

.jornada-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}
.jornada-dia { display: grid; gap: 0.2rem; text-align: center; font-size: 0.72rem; font-weight: 700; }
.jornada-dia .input { padding-left: 0.3rem; padding-right: 0.3rem; text-align: center; min-width: 0; }

@media (max-width: 480px) {
  .cload-txt { font-size: 0.55rem; }
  .jornada-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============================================================
   Eventos, tira de hoy y sugerencias
   ============================================================ */

.cevent {
  margin-top: 0.25rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.25;
  color: #1e3a8a;
  background: #dbe4ff;
  border-left: 3px solid #3852a4;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cevent.is-allday { background: #fde2e2; color: #7f1d1d; border-left-color: #e31c23; }
.cmas { font-size: 0.6rem; font-weight: 800; color: var(--muted); margin-top: 0.15rem; }
.cday.is-today .cevent { color: #1e3a8a; }

.agenda-dia { margin: 0 0 0.8rem; }
.agenda-fecha { font-size: 0.78rem; font-weight: 800; text-transform: capitalize; margin-bottom: 0.2rem; }
.agenda-dia .cevent, .hoy-strip .cevent { font-size: 0.8rem; white-space: normal; padding: 0.35rem 0.5rem; }

.hoy-strip {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--line);
}
.hoy-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; }

.avisos-title { margin: 0.4rem 0 0.4rem; font-size: 0.9rem; }
.avisos { display: grid; gap: 0.45rem; margin-bottom: 0.6rem; }
.aviso-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 9px;
  border: 2px solid var(--line);
  background: var(--surface-2);
}
.aviso-item > span { min-width: 0; overflow-wrap: anywhere; }
.aviso-item.nivel-alta { border-color: var(--danger); }
.aviso-item.nivel-media { border-color: var(--warn); }
.aviso-item .btn { flex: none; }

.e-todo { margin: 0.2rem 0 0.8rem; }
.horario-row { margin-bottom: 0.7rem; }

@media (max-width: 480px) {
  .topbar-actions #btn-new-event { padding-left: 0.5rem; padding-right: 0.5rem; }
}
@media (max-width: 420px) { #btn-new-event .lbl { display: none; } }

/* ============================================================
   Hoy, bloques de trabajo, cronómetro, planeación y reportes
   ============================================================ */

.timer-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 0.3rem;
  margin: 0 auto; padding: 0.45rem 0.9rem;
  background: #1e293b; color: #fff;
  font-size: 0.85rem; font-weight: 700;
}
.timer-fila { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.timer-dot { width: 10px; height: 10px; border-radius: 50%; background: #e31c23; animation: latido 1.2s infinite; flex: none; }
@keyframes latido { 50% { opacity: 0.25; } }
.timer-reloj { font-variant-numeric: tabular-nums; font-size: 1rem; flex: none; }
.timer-tarea { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.timer-btn { background: #fff; color: #1e293b; flex: none; }

.sbtn.is-running { background: #fde2e2; border-color: #e31c23; }
.pill-run { border-color: #e31c23 !important; color: #b91c1c !important; }
.pill-plan { border-color: #3852a4 !important; color: #3852a4 !important; }
.pill-sinplan { border-style: dashed !important; color: var(--muted) !important; }
.pill-next { background: #3852a4 !important; color: #fff !important; border-color: #3852a4 !important; }
.txt-bad { color: var(--danger); font-style: normal; font-weight: 700; }

.cbloque {
  margin-top: 0.25rem; padding: 0.15rem 0.3rem;
  font-size: 0.64rem; font-weight: 700; line-height: 1.25;
  color: #14532d; background: #dcfce7; border-left: 3px solid #5c9c6d; border-radius: 4px;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.hoy-panel h3::first-letter { text-transform: uppercase; }
.hoy-lista { display: grid; gap: 0.6rem; margin: 1rem 0; }
.hoy-item {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: center;
  padding: 0.7rem 0.8rem; background: var(--surface);
  border: 2px solid var(--line); border-radius: 12px; box-shadow: 3px 3px 0 var(--line);
}
.hoy-bloque { grid-template-columns: 3.4rem 1.8rem minmax(0, 1fr) auto; }
.hoy-evento { background: #eef2ff; border-color: #3852a4; box-shadow: 3px 3px 0 #3852a4; cursor: pointer; grid-template-columns: 3.4rem minmax(0, 1fr); }
.hoy-item.is-past { opacity: 0.5; }
.hoy-item.is-next { border-color: #3852a4; box-shadow: 4px 4px 0 #3852a4; }
.hoy-item.is-running { border-color: #e31c23; box-shadow: 4px 4px 0 #e31c23; }
.hoy-hora { font-size: 0.85rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hoy-hora small { color: var(--muted); font-weight: 600; }
.hoy-num {
  width: 1.8rem; height: 1.8rem; display: grid; place-items: center;
  font-weight: 900; font-size: 0.85rem; border: 2px solid var(--line); border-radius: 8px; background: var(--surface-2);
}
.hoy-cuerpo { min-width: 0; display: grid; gap: 0.3rem; overflow-wrap: anywhere; }
.hoy-cuerpo small { display: block; }
.hoy-item .task-actions { display: flex; gap: 0.3rem; }
.hoy-item .task-meta { margin: 0; }

.plan-resumen .stat-grid { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
.plan-bloques { display: grid; gap: 0.4rem; margin-bottom: 0.7rem; }
.plan-bloque {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.6rem; font-size: 0.82rem; border: 2px solid var(--line); border-radius: 9px; background: var(--surface-2);
}
.plan-add { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.4rem; margin-bottom: 0.7rem; }
.plan-acciones { margin-bottom: 0.7rem; }
.autoplan-row { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.35rem 0; font-size: 0.82rem; cursor: pointer; }
.autoplan-row input { margin-top: 0.2rem; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.autoplan-row small { display: block; }
.time-chip.is-sel { background: var(--accent); color: var(--accent-ink); }
.gcal-cals { display: grid; gap: 0.3rem; margin-bottom: 0.7rem; }
.t-oficina { margin: -0.3rem 0 0.9rem; }

/* Reporte */
.report-modal .modal-box { max-width: 900px; width: min(96vw, 900px); }
.report h2 { margin: 0; font-size: 1.2rem; }
.report h4 { margin: 1rem 0 0.4rem; }
.report-kpis { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin-top: 0.8rem; }
.report-lectura { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; display: grid; gap: 0.2rem; }
.rtable { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.rtable th, .rtable td { padding: 0.3rem 0.4rem; border-bottom: 1px solid #cbd5e1; text-align: left; vertical-align: middle; }
.rtable th { font-weight: 800; background: var(--surface-2); }
.rbars { width: 32%; min-width: 90px; }
.rbar { display: block; height: 5px; margin: 1px 0; border-radius: 3px; }
.r-libre { background: #cbd5e1; }
.r-plan { background: #3852a4; }
.r-real { background: #5c9c6d; }

@media (max-width: 520px) {
  .plan-add { grid-template-columns: 1fr 1fr; }
  .rbars, .rbars-th { display: none; }
  .hoy-item { grid-template-columns: 3rem minmax(0, 1fr); }
  .hoy-bloque { grid-template-columns: 3rem 1.6rem minmax(0, 1fr); }
  .hoy-bloque .task-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media print {
  body.imprimiendo > *:not(#report-modal) { display: none !important; }
  body.imprimiendo #report-modal { position: static !important; background: none !important; display: block !important; }
  body.imprimiendo #report-modal .modal-box { box-shadow: none !important; border: 0 !important; width: 100% !important; max-width: none !important; max-height: none !important; overflow: visible !important; }
  body.imprimiendo #report-modal .modal-body { overflow: visible !important; max-height: none !important; }
  body.imprimiendo .no-print { display: none !important; }
  .rbars, .rbars-th { display: table-cell !important; }
}

/* Formularios largos en pantallas angostas: nada se desborda */
.field-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.field-row .input, .plan-add .input { min-width: 0; width: 100%; }
.e-todo, .t-oficina, .gcal-cals .check, #gcal-box .check { white-space: normal; align-items: flex-start; }
.e-todo input, .t-oficina input { flex: none; margin-top: 0.1rem; }
.modal-body { overflow-x: hidden; }

/* ---------- 📬 Briefs de Claude ---------- */
.btn-briefs { position: relative; }
.briefs-badge {
  position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--danger); color: #fff; border: 2px solid var(--line);
  font-size: 0.68rem; font-weight: 800; line-height: 15px; text-align: center;
}
.brief-card { display: flex; align-items: center; gap: 0.8rem; justify-content: space-between; }
.brief-card.no-leido { border-color: var(--accent); box-shadow: 5px 5px 0 var(--accent); }
.brief-card-txt { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.brief-card-resumen { font-size: 0.88rem; overflow-wrap: anywhere; }
.brief-modal .modal-box { max-width: 760px; width: min(96vw, 760px); }
.brief-modal .modal-head h3 { margin: 0; }
.brief-body { font-size: 0.95rem; line-height: 1.5; overflow-wrap: anywhere; }
.brief-body h3, .brief-body h4, .brief-body h5, .brief-body h6 { margin: 1.1rem 0 0.4rem; font-size: 1rem; }
.brief-body h3:first-child, .brief-body p:first-child { margin-top: 0; }
.brief-body p { margin: 0.55rem 0; }
.brief-body hr { border: 0; border-top: 2px dashed var(--muted); margin: 1rem 0; }
.brief-body code { background: var(--surface-2); padding: 0 0.3rem; border-radius: 4px; font-size: 0.85em; }
.brief-body pre { background: var(--surface-2); padding: 0.6rem; border-radius: 8px; overflow-x: auto; }
.brief-tabla { overflow-x: auto; margin: 0.5rem 0 0.8rem; border: 2px solid var(--line); border-radius: 10px; }
.brief-tabla table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.brief-tabla th, .brief-tabla td { padding: 0.4rem 0.55rem; text-align: left; border-bottom: 1px solid color-mix(in srgb, var(--muted) 35%, transparent); vertical-align: top; }
.brief-tabla th { background: var(--surface-2); font-weight: 800; white-space: nowrap; }
.brief-tabla tr:last-child td { border-bottom: 0; }
.brief-ul { margin: 0.4rem 0 0.7rem; padding-left: 1.2rem; }
.brief-ul li { margin: 0.25rem 0; }
.brief-ul li.n1 { margin-left: 1.1rem; list-style: circle; }
.brief-ul li.n2, .brief-ul li.n3 { margin-left: 2.2rem; list-style: square; }
.brief-lista { margin-top: 1.4rem; border-top: 2px dashed var(--muted); padding-top: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.brief-lista h4 { margin: 0 0 0.2rem; }
.brief-item {
  display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; text-align: left;
  background: var(--surface-2); color: var(--text); border: 2px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.7rem; font: inherit; cursor: pointer;
}
.brief-item.no-leido span:first-child { font-weight: 800; }
.brief-item.no-leido span:first-child::before { content: '● '; color: var(--accent); }
@media (max-width: 420px) {
  .topbar-actions { gap: 0.3rem; }
  .brief-card { flex-wrap: wrap; }
}

/* ---------- Interfaz simple (sep 2026): enfoque, menú ⋯, en espera ---------- */
.task.alert-late, .task.alert-deleg { animation: none; }
.task.alert-late { border-color: var(--danger); }
.task.is-espera { opacity: .75; border-style: dashed; }
.pill-espera { color: #7c5a00; background: #fff4d6; border-color: #c89400; white-space: normal; text-transform: none; letter-spacing: 0; }
@media (prefers-color-scheme: dark) { .pill-espera { background: #3a2f10; color: #f4d27a; } }

.add-wrap { position: relative; }
.btn-add { min-width: 44px; font-size: 1.1rem; }
.pop-menu {
  position: absolute; z-index: 60; min-width: 210px; display: grid; gap: 2px; padding: 6px;
  background: var(--surface); color: var(--text); border: 2px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.add-wrap .pop-menu { right: 0; top: calc(100% + 6px); }
.task-menu { position: fixed; }
.pop-menu button {
  text-align: left; font: inherit; font-weight: 700; font-size: 0.92rem; color: inherit;
  background: none; border: 0; border-radius: 8px; padding: 0.65rem 0.7rem; cursor: pointer;
}
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--surface-2); outline: none; }
.pop-menu button.is-danger { color: var(--danger); }

.tareas-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: 0.78rem; font-weight: 800; padding: 0.35rem 0.6rem; border: 0; background: var(--surface); color: var(--text); cursor: pointer; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button.is-on { background: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.is-on { background: var(--accent); color: var(--accent-ink); } }

.foco-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin: 0.2rem 0 0.9rem; }
.foco-head h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.foco-head h2::first-letter { text-transform: uppercase; }

.ahora-card {
  background: var(--surface); border: 3px solid var(--line); border-radius: 18px; box-shadow: 6px 6px 0 var(--accent);
  padding: 1rem 1.05rem 1.1rem; margin-bottom: 1.1rem; display: grid; gap: 0.45rem; min-width: 0;
}
.ahora-card.is-running { box-shadow: 6px 6px 0 #e31c23; border-color: #e31c23; }
.ahora-card.ahora-evento { box-shadow: 6px 6px 0 #3852a4; border-color: #3852a4; background: #eef2ff; }
@media (prefers-color-scheme: dark) { .ahora-card.ahora-evento { background: #1d2440; } }
.ahora-label { font-size: 0.72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ahora-card h3 { margin: 0; font-size: 1.3rem; line-height: 1.25; overflow-wrap: anywhere; }
.ahora-card p { margin: 0; }
.ahora-btns { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem; margin-top: 0.4rem; }
.ahora-btns .btn { justify-content: center; min-height: 48px; font-size: 1rem; }
.btn-icon-sq { width: 48px; padding: 0; font-size: 1.3rem; }

.hoy-bloque { grid-template-columns: 3.4rem minmax(0, 1fr) auto; }
.hoy-item.is-done { opacity: 0.55; }
.hoy-item.is-done b { text-decoration: line-through; }
.hoy-item.is-late { border-style: dashed; }
.hoy-item .sbtn { width: 38px; height: 38px; font-size: 1.1rem; }

.hoy-mas { margin: 1rem 0; border: 2px dashed var(--muted); border-radius: 12px; padding: 0.6rem 0.8rem; }
.hoy-mas summary { cursor: pointer; font-weight: 800; font-size: 0.9rem; color: var(--muted); list-style-position: outside; }
.hoy-mas[open] summary { margin-bottom: 0.6rem; }
.hoy-mas > div { display: grid; gap: 0.5rem; }

.cerrar-dia { display: block; width: 100%; margin: 1.2rem 0 0.5rem; justify-content: center; }
.volver { margin-bottom: 0.8rem; }
.brief-ritmos { margin-bottom: 0.9rem; }
.espera-revisar { margin-bottom: 0.8rem; flex-wrap: wrap; }
#espera-modal .check { white-space: normal; align-items: flex-start; }
#espera-modal .field .input-sm { margin-top: 0.4rem; }
@media (max-width: 420px) {
  .ahora-btns { grid-template-columns: 1fr 1fr 48px; }
  .hoy-item .sbtn { width: 34px; height: 34px; font-size: 1rem; }
  .hoy-item { grid-template-columns: 2.9rem minmax(0, 1fr) auto; gap: 0.45rem; padding: 0.6rem 0.6rem; }
}
.ahora-btns .btn { white-space: nowrap; padding-left: 0.5rem; padding-right: 0.5rem; }
@media (max-width: 420px) { .ahora-btns .btn { font-size: 0.92rem; } }

/* ---------- Recordatorios, asistente 💬, nota para retomar, rutinas ---------- */
.rem-hoy { margin: 0 0 1rem; }
.rem-lista { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.rem-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; border: 2px dashed var(--muted); border-radius: 10px; background: var(--surface); }
.rem-item.is-done { opacity: .55; }
.rem-item.is-done .rem-txt { text-decoration: line-through; }
.rem-check { background: none; border: 0; font-size: 1.15rem; cursor: pointer; padding: 0; line-height: 1; }
.rem-txt { flex: 1; min-width: 0; font-weight: 700; font-size: 0.9rem; cursor: pointer; overflow-wrap: anywhere; }
.nota-retomar { background: #fff8e1; border-left: 4px solid #c89400; padding: 0.45rem 0.6rem; border-radius: 6px; font-size: 0.9rem; margin: 0.2rem 0; }
@media (prefers-color-scheme: dark) { .nota-retomar { background: #3a2f10; } }
.valorar { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.4rem; justify-content: flex-end; }
.valorar .sbtn { width: 34px; height: 34px; font-size: 1rem; }
.ai-modal .modal-box { max-width: 640px; width: min(96vw, 640px); }
#ai-texto { width: 100%; resize: vertical; }
.ai-resumen { font-weight: 700; margin: 0.8rem 0 0.4rem; }
.diff-lista { margin: 0.3rem 0 0.8rem; padding-left: 1.1rem; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.diff-lista small { color: var(--muted); }
.pause-nota textarea { width: 100%; }

/* Día en grande (desde Semana) */
.cday { cursor: pointer; }
.cday:hover { box-shadow: 0 0 0 2px var(--c-teal, #0d9488) inset; }
.modal-dia { max-width: 640px; width: 100%; }
.modal-dia .hoy-item { font-size: 1rem; }
#dia-modal { z-index: 55; }   /* lo que abras desde el día (cita, tarea, pausa) queda encima */

/* Registrar actividades, historial, urgencia, horas extra */
.check-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; cursor: pointer; }
.check-row input { width: 18px; height: 18px; flex: none; }
.hoy-actividad { border-style: dashed; }
.urg-sel { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.4rem; }
.urg-sel .time-chip { font-size: 0.8rem; }
.nf-box { margin-top: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 10px; background: rgba(0,0,0,.04); }
.ai-modelo-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.4rem 0; }
.ai-modelo-row select { flex: 1; }
.hist-item { border-top: 1px solid rgba(0,0,0,.1); padding: 0.5rem 0; font-size: 0.9rem; }

/* ---- Piezas que solo usa la apariencia Aura (en Clásica se ocultan) ---- */
.i, .i-circulo, .bottom-nav, .btn-ai-txt { display: none; }
.ahora-btns .btn-empezar .btn-txt::before { content: ''; }
html:not([data-look="aura"]) .btn-empezar { display: inline-flex; align-items: center; justify-content: center; flex-direction: row-reverse; gap: 0.35rem; }
.topbar-date { font-weight: 700; }

.imp-dot { display: none; }
.ai-modelos { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.modelo-chip { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.modelo-chip small { font-size: 0.7rem; opacity: .8; }

.inv-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.45rem 0; border-top: 1px solid var(--line); }
