:root {
  --bg: #0b1113;
  --bg-2: #10181b;
  --bg-3: #162023;
  --line: #223034;
  --text: #e8f1f0;
  --text-dim: #8fa6a3;
  --accent: #15b8a3;
  --accent-soft: rgba(21, 184, 163, 0.14);
  --warn: #e8b34b;
  --danger: #e86a5e;
  --ok: #58c98b;
  --radius: 10px;
  --sidebar-w: 216px;
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg-3);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
::placeholder { color: var(--text-dim); opacity: 0.7; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; padding: 20px 12px;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-name { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.95rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; color: var(--text-dim); text-align: left; font-weight: 500;
}
.nav-btn:hover { background: var(--bg-3); color: var(--text); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.nav-ico { width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #06211d;
  font-size: 0.7rem; font-weight: 700; border-radius: 99px; padding: 1px 7px;
}
.sidebar-timer {
  margin-top: 14px; padding: 10px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent);
  text-align: center; cursor: pointer;
}
.sidebar-timer-time { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.sidebar-timer-label { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 0.75rem; color: var(--text-dim); line-height: 1.6; }

/* ---------- Main / views ---------- */
.main { flex: 1; padding: 28px 32px 60px; max-width: 1060px; }
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.view-title { font-size: 1.5rem; font-weight: 700; }
.view-sub { color: var(--text-dim); font-size: 0.9rem; }
.view-head .spacer { flex: 1; }

.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card-title {
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .count { color: var(--accent); }

.btn {
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 0.88rem;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
}
.btn:hover { border-color: var(--text-dim); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06211d; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 0.78rem; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); }

/* ---------- Tareas ---------- */
.task-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.task-form input[type="text"] { flex: 1; min-width: 220px; }
.task-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.task-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.task-item:hover { border-color: var(--text-dim); }
.task-item.done { opacity: 0.55; }
.task-item.done .task-title { text-decoration: line-through; }
.task-check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--text-dim);
  flex-shrink: 0; display: grid; place-items: center; font-size: 0.75rem; color: transparent;
}
.task-check:hover { border-color: var(--accent); }
.task-item.done .task-check { background: var(--accent); border-color: var(--accent); color: #06211d; }
.task-title { flex: 1; cursor: pointer; }
.task-meta { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.chip {
  font-size: 0.72rem; padding: 2px 8px; border-radius: 99px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text-dim);
  cursor: pointer; white-space: nowrap;
}
.chip.due { color: var(--accent); border-color: var(--accent); }
.chip.overdue { color: var(--danger); border-color: var(--danger); }
.chip.p-alta { color: var(--danger); }
.chip.p-media { color: var(--warn); }
.chip.p-baja { color: var(--text-dim); }
.chip.note-link { color: var(--warn); }
.chip.focus-time { color: var(--ok); border-style: dashed; cursor: default; }
.filters { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ---------- Editor de tarea (panel) ---------- */
.edit-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.edit-panel label { font-size: 0.72rem; color: var(--text-dim); display: block; margin-bottom: 4px; }
.edit-panel .full { grid-column: 1 / -1; }
.edit-actions { display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-month { font-size: 1.1rem; font-weight: 700; min-width: 180px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 0; }
.cal-day {
  min-height: 84px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { opacity: 0.35; }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); }
.cal-day.selected { outline: 2px solid var(--accent); }
.cal-day-num { font-size: 0.78rem; font-weight: 600; color: var(--text-dim); }
.cal-day.today .cal-day-num { color: var(--accent); }
.cal-pill {
  font-size: 0.66rem; padding: 1px 5px; border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.cal-pill.task { background: var(--accent-soft); color: var(--accent); }
.cal-pill.task.done { text-decoration: line-through; opacity: 0.6; }
.cal-pill.event { background: rgba(232, 179, 75, 0.15); color: var(--warn); }
.cal-pill.more { color: var(--text-dim); background: none; }
.cal-dots { display: flex; gap: 3px; margin-top: auto; }
.cal-dot-focus { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.day-panel .item-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.day-panel .item-row:last-child { border-bottom: none; }
.item-time { font-size: 0.75rem; color: var(--warn); font-variant-numeric: tabular-nums; min-width: 44px; }

/* ---------- Notas ---------- */
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.note-list { list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow-y: auto; }
.note-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.note-item:hover { background: var(--bg-3); }
.note-item.active { background: var(--accent-soft); border-color: var(--accent); }
.note-item-title { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-date { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }
.note-editor { display: flex; flex-direction: column; gap: 10px; }
.note-editor input.note-title { font-size: 1.1rem; font-weight: 700; }
.note-editor textarea { min-height: 46vh; resize: vertical; line-height: 1.6; }
.note-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-toolbar .status { font-size: 0.75rem; color: var(--text-dim); margin-left: auto; }

/* ---------- Enfoque ---------- */
.focus-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.timer-card { text-align: center; padding: 36px 20px; }
.timer-mode { display: inline-flex; gap: 4px; background: var(--bg-3); border-radius: 99px; padding: 4px; margin-bottom: 20px; }
.timer-mode button { padding: 6px 16px; border-radius: 99px; font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.timer-mode button.active { background: var(--accent); color: #06211d; }
.timer-display { font-size: 4.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; line-height: 1; }
.timer-display.break-mode { color: var(--ok); }
.timer-task { margin: 14px 0 22px; color: var(--text-dim); font-size: 0.9rem; }
.timer-task select { max-width: 320px; }
.timer-controls { display: flex; gap: 10px; justify-content: center; }
.timer-ring { margin: 0 auto 18px; width: 240px; height: 240px; position: relative; display: grid; place-items: center; }
.timer-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer-ring .track { stroke: var(--bg-3); }
.timer-ring .prog { stroke: var(--accent); transition: stroke-dashoffset 0.5s linear; }
.timer-ring.break-mode .prog { stroke: var(--ok); }
.session-row { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.session-row:last-child { border-bottom: none; }
.session-min { color: var(--accent); font-weight: 700; min-width: 52px; font-variant-numeric: tabular-nums; }
.session-task { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-when { color: var(--text-dim); font-size: 0.75rem; }
.focus-settings { display: flex; gap: 10px; align-items: center; }
.focus-settings input { width: 64px; text-align: center; }

/* ---------- Hoy (dashboard) ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid .full { grid-column: 1 / -1; }
.stat-row { display: flex; gap: 24px; flex-wrap: wrap; }
.stat { text-align: left; }
.stat-num { font-size: 1.9rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--text-dim); }
.empty { color: var(--text-dim); font-size: 0.88rem; padding: 8px 0; }
.link-like { color: var(--accent); cursor: pointer; background: none; border: none; padding: 0; font-size: inherit; }
.link-like:hover { text-decoration: underline; }

/* ---------- Sync ---------- */
.sync-chip {
  margin-top: 10px; padding: 6px 10px; border-radius: 8px; text-align: left;
  font-size: 0.72rem; color: var(--text-dim); background: var(--bg-3);
  border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sync-chip:hover { border-color: var(--text-dim); }
.sync-chip.s-ok { color: var(--ok); }
.sync-chip.s-saving { color: var(--accent); }
.sync-chip.s-error, .sync-chip.s-auth { color: var(--warn); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 8, 9, 0.72); z-index: 50;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  border-radius: 8px; color: var(--text-dim); font-size: 1rem; line-height: 1;
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal h2 { font-size: 1.1rem; }
.modal-help { color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; }
.modal-error { color: var(--warn); font-size: 0.8rem; min-height: 1.1em; }
.modal-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast {
  background: var(--bg-3); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 16px; border-radius: 8px; font-size: 0.85rem;
  animation: toast-in 0.25s ease; box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px 60px; }
  .notes-layout, .focus-layout, .dash-grid { grid-template-columns: 1fr; }
}
