/* ============================================================
   styles.css — Apariencia del panel (estilo Notion)
   Las custom properties (--variables) definen la paleta una
   sola vez para reusarla en todo el sitio.
   ============================================================ */

:root {
  --cocoset: #dfb160;
  --cocoset-dark: #6e3562;
  --cocoset-deep: #4e2344;

  --bg: #fdf9f6;
  --bg-side: #f6eef2;
  --bg-hover: #efe3ea;
  --surface: #ffffff;

  --ink: #34586e;
  --ink-soft: #55788a;
  --ink-faint: #8aa4b2;
  --line: #ece2e7;
  --danger: #c0564a;

  --success: #d18d96;

  --radius: 12px;
  --shadow-card: 0 1px 2px rgba(52, 88, 110, 0.06), 0 2px 10px rgba(52, 88, 110, 0.05);
  --shadow-modal: 0 20px 60px rgba(52, 88, 110, 0.24);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.logo-dot {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 4px;
  background: linear-gradient(135deg, var(--cocoset), var(--cocoset-deep));
  display: inline-block;
  flex-shrink: 0;
}

.logo-dot.small { width: 17px; height: 17px; }
.logo-dot.big { width: 40px; height: 40px; margin-bottom: 16px; }
.logo-tld { color: var(--cocoset-dark); font-weight: 500; }

/* ============================================================
   LOGIN
   ============================================================ */

.login-body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dcedcb 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #cfe6ba 0%, transparent 55%),
    var(--bg-side);
}

.login-card {
  background: var(--surface);
  padding: 46px 42px;
  border-radius: 20px;
  box-shadow: var(--shadow-modal);
  width: min(400px, 92vw);
  text-align: center;
  border: 1px solid var(--line);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.login-logo h1 {
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.login-sub { color: var(--ink-soft); margin: 10px 0 28px; }

.login-card input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.login-card input:focus { border-color: var(--cocoset); }

.login-card button {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cocoset-dark), var(--cocoset-deep));
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}

.login-card button:hover {
  box-shadow: 0 6px 18px rgba(76, 122, 51, 0.32);
  transform: translateY(-1px);
}

.login-error { color: var(--danger); margin-top: 14px; font-size: 14px; }

/* ============================================================
   LAYOUT
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: 252px 1fr;
  height: 100vh;
  transition: grid-template-columns .22s cubic-bezier(.4, 0, .2, 1);
}

.app.sidebar-collapsed { grid-template-columns: 0 1fr; }
.app.sidebar-collapsed .sidebar { overflow: hidden; }

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-side);
  color: var(--ink-soft);
  font: 800 12px/1 'Inter', system-ui, sans-serif;
  letter-spacing: -1px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--cocoset);
  color: var(--cocoset-deep);
}

.no-mobile { display: inline-flex; }

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  min-height: 0;
}

.workspace {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 12px;
}

.workspace-name {
  font-size: 15px;
  letter-spacing: -0.2px;
}

.side-search { padding: 0 6px 8px; }

.side-search input {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}

.side-search input:focus { border-color: var(--cocoset); }

.side-action,
.side-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}

.side-action:hover,
.side-item:hover { background: var(--bg-hover); color: var(--ink); }

.side-item.is-active {
  background: var(--bg-hover);
  color: var(--ink);
  font-weight: 600;
}

.side-icon {
  width: 17px;
  text-align: center;
  color: var(--cocoset-deep);
  font-size: 13px;
  flex-shrink: 0;
}

.side-label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.side-external {
  color: var(--ink-faint);
  font-size: 11px;
}

.side-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 7px;
}

.side-group { padding-top: 14px; }

.side-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 10px 6px;
}

.side-group-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.side-tree {
  overflow-y: auto;
  padding-right: 2px;
}

.side-tree .side-item { padding-left: 18px; font-weight: 400; }

.side-tree-empty {
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 6px 18px;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 8px;
}

/* ---------- Barra superior ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 45px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

.crumb-icon { color: var(--cocoset-deep); font-size: 12px; }

.topbar-spacer { flex: 1; }

.topbar-hint { font-size: 12.5px; color: var(--ink-faint); }

.icon-btn {
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 7px;
  line-height: 1;
}

.icon-btn:hover { background: var(--bg-hover); }

.only-mobile { display: none; }

/* ---------- Página ---------- */

.page {
  flex: 1;
  overflow-y: auto;
  padding: 40px 44px 70px;
}

.page-head { max-width: 1600px; margin: 0 auto 26px; }

.page-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
}

.page-sub { color: var(--ink-soft); margin-top: 6px; font-size: 14.5px; }

/* ============================================================
   TABLERO MASONRY
   Las columnas son flex verticales. app.js reparte cada card en
   la columna más corta, así la rejilla horizontal queda
   irregular y las notas largas empujan hacia abajo en su columna.
   ============================================================ */

.board {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 1600px;
  margin: 0 auto;
}

.board-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px 16px;
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.card:hover {
  border-color: var(--cocoset);
  box-shadow: 0 4px 20px rgba(76, 122, 51, 0.13);
  transform: translateY(-2px);
}

.card-title {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.card-title.is-untitled { color: var(--ink-faint); font-weight: 500; }

.card-date {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--cocoset-deep);
  margin-bottom: 12px;
}

/* La card entera es un botón: el contenido no intercepta el clic */
.card-body { font-size: 14px; overflow-wrap: anywhere; pointer-events: none; }

.card-body.is-empty { color: var(--ink-faint); font-style: italic; }

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

.board-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 70px 20px;
}

.board-empty h2 { font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.board-empty p { font-size: 14.5px; margin-bottom: 20px; }

.page-wide { max-width: none; }

.page-wide .page-head { max-width: none; }

/* ============================================================
   ESTADÍSTICAS
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 1600px;
  margin: 0 auto 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.stat-card .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-top: 6px;
}

.stat-card .hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 4px;
}

.stat-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 1600px;
  margin: 0 auto 14px;
}

.stat-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  max-width: 1600px;
  margin: 0 auto;
}

.stat-panels .stat-panel { margin: 0; }

.stat-panel h3 {
  font-size: 14px;
  margin-bottom: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 13.5px;
}

.stat-row .name { flex: 1; color: var(--ink-soft); }
.stat-row .num { font-weight: 700; min-width: 28px; text-align: right; }

.stat-bar {
  height: 7px;
  background: var(--bg-side);
  border-radius: 99px;
  flex: 2;
  overflow: hidden;
}

.stat-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cocoset), var(--cocoset-deep));
  border-radius: inherit;
}

/* ============================================================
   TABLA DE REGISTROS (estilo hoja de cálculo)
   ============================================================ */

.audit-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.audit-toolbar select,
.audit-toolbar input {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  outline: none;
  background: #fff;
}

.audit-toolbar select { min-width: 190px; }
.audit-toolbar input { flex: 1; }
.audit-toolbar select:focus,
.audit-toolbar input:focus { border-color: var(--cocoset); }

.sheet-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: calc(100vh - 260px);
}

.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}

.sheet th,
.sheet td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: middle;
}

.sheet th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3e7;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.2px;
  color: var(--ink-soft);
}

.sheet tbody tr:nth-child(even) { background: #fafbf7; }
.sheet tbody tr:hover { background: #eef6e4; }

.sheet td:first-child,
.sheet th:first-child {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-visit { background: #e8f1ff; color: #2b5aa0; }
.badge-login { background: #e4f5e0; color: #2f6b28; }
.badge-login_failed { background: #fdecea; color: #a33b32; }
.badge-logout { background: #f0eee8; color: #6b6458; }
.badge-note_create { background: #e6f4d8; color: #3d6b1f; }
.badge-note_open { background: #fff4d6; color: #8a6a12; }
.badge-note_delete { background: #fdecea; color: #a33b32; }

/* ============================================================
   MARKDOWN
   ============================================================ */

.markdown > *:first-child { margin-top: 0; }

.markdown h1, .markdown h2, .markdown h3 {
  margin: 18px 0 8px;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.markdown h1 { font-size: 1.45em; }
.markdown h2 { font-size: 1.22em; color: var(--cocoset-deep); }
.markdown h3 { font-size: 1.08em; }

.markdown p, .markdown li { line-height: 1.7; margin: 7px 0; }

.markdown ul, .markdown ol { padding-left: 22px; }

.markdown code {
  background: #eef2e8;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.9em;
}

.markdown pre {
  background: #1f2a1a;
  color: #dcedcb;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 12px 0;
}

.markdown pre code { background: transparent; padding: 0; color: inherit; }

.markdown blockquote {
  border-left: 3px solid var(--cocoset);
  padding: 2px 14px;
  color: var(--ink-soft);
  margin: 10px 0;
}

.markdown a { color: var(--cocoset-deep); }

.markdown hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.markdown img { max-width: 100%; border-radius: 8px; }

.markdown table { border-collapse: collapse; width: 100%; font-size: 0.92em; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.markdown th { background: var(--bg-side); }

.markdown input[type='checkbox'] { accent-color: var(--cocoset-dark); }

/* ============================================================
   EDITOR (modal)
   ============================================================ */

.modal { position: fixed; inset: 0; z-index: 50; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 26, 0.4);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  width: min(780px, 94vw);
  height: min(84vh, 900px);
  margin: 8vh auto 0;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 0.16s ease-out;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 14px 26px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

#note-title {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--ink);
}

#note-title::placeholder { color: var(--ink-faint); }

.modal-actions { display: flex; align-items: center; gap: 8px; }

.save-status {
  font-size: 12px;
  color: var(--cocoset-deep);
  min-width: 66px;
  text-align: right;
}

.modal-body { flex: 1; min-height: 0; display: flex; }

#note-content {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 22px 26px;
  font: inherit;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
  background: transparent;
}

.modal-preview { flex: 1; overflow-y: auto; padding: 22px 26px; }

.modal-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 26px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

/* ============================================================
   BOTONES
   ============================================================ */

.btn-primary {
  background: linear-gradient(135deg, var(--cocoset-dark), var(--cocoset-deep));
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover { filter: brightness(1.07); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--cocoset); color: var(--cocoset-deep); }

.btn-danger {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
  cursor: pointer;
  white-space: nowrap;
}

.btn-danger:hover { background: #fbeeec; }

/* ============================================================
   RECORRIDO DE 21 DÍAS
   ============================================================ */

.habits-page {
  background:
    radial-gradient(800px 360px at 95% 0%, rgba(147, 197, 114, 0.15), transparent 65%),
    linear-gradient(180deg, #fbfcf9 0%, #ffffff 45%);
}

.habits-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: -40px -44px 28px;
  padding: 34px 44px 28px;
  background: linear-gradient(135deg, var(--cocoset-deep) 0%, #4c8c38 50%, var(--cocoset-dark) 100%);
}

.habits-hero .habits-eyebrow { color: rgba(255,255,255,0.6); }
.habits-hero .page-title     { color: #fff; }
.habits-hero .page-sub       { color: rgba(255,255,255,0.72); }
.habits-hero .habits-progress {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12);
  box-shadow: none;
}
.habits-hero .habits-progress strong { color: #fff; }
.habits-hero .habits-progress span   { color: rgba(255,255,255,0.65); }

.habits-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--cocoset-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.habits-progress {
  display: grid;
  place-content: center;
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  border: 1px solid #dbe8d1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 30px rgba(76, 122, 51, 0.08);
  text-align: center;
}

.habits-progress strong {
  color: var(--cocoset-deep);
  font-size: 28px;
  line-height: 1;
}

.habits-progress span {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 9.5px;
}

.habit-manifesto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto 32px;
}

.habit-manifesto article {
  position: relative;
  padding: 20px 20px 18px;
  overflow: hidden;
  border: 1px solid #e0e8da;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

/* Número decorativo de fondo */
.habit-manifesto article::before {
  content: attr(data-n);
  position: absolute;
  right: 10px;
  top: -6px;
  font-size: 72px;
  font-weight: 900;
  color: rgba(147, 197, 114, 0.13);
  line-height: 1;
  letter-spacing: -4px;
  pointer-events: none;
  user-select: none;
}

.mn {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 8px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--cocoset-dark), var(--cocoset-deep));
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.habit-manifesto p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  font-weight: 500;
}

.mt {
  display: inline-block;
  margin-top: 12px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.habits-grid-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto 14px;
}

.habits-grid-head h2 { font-size: 19px; letter-spacing: -0.3px; }
.habits-grid-head p { margin-top: 4px; color: var(--ink-faint); font-size: 12px; }
.habits-grid-head > span { color: var(--cocoset-deep); font-size: 10.5px; font-weight: 600; }

.habit-days-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Tarjetas de día */
.hdc {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}

.hdc:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(76, 122, 51, 0.11);
}

/* Cabecera con gradiente */
.hdc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  background: linear-gradient(135deg, var(--cocoset-deep) 0%, var(--cocoset-dark) 100%);
  color: #fff;
}

.hdc-head > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hdc-head strong {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.1px;
  text-transform: capitalize;
}

.hdc-head > div span {
  font-size: 8.5px;
  opacity: 0.65;
  font-weight: 500;
}

.hdc-n {
  font-size: 32px;
  font-weight: 900;
  opacity: 0.2;
  letter-spacing: -2px;
  line-height: 1;
}

/* Estado completado */
.hdc-done {
  border-color: #d18d96;
}

.hdc-done .hdc-head {
  background: linear-gradient(135deg, #34586e 0%, #4a7a96 100%);
}

/* Filas del checklist */
.hdc-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-bottom: 1px solid #f2f5ef;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.hdc-row:last-child { border-bottom: none; }

.hdc-row:hover { background: #f8fbf5; }

.hdc-row input[type='checkbox'] {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--cocoset-dark);
  cursor: pointer;
  margin: 0;
}

.hdc-label {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  transition: color 0.15s;
}

.hdc-detail {
  font-size: 9.5px;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* Ítem marcado */
.hdc-checked .hdc-label {
  color: var(--ink-faint);
  text-decoration: line-through;
}

/* ============================================================
   ESPACIO FÍSICO
   ============================================================ */

.workspace-link {
  color: var(--ink);
  text-decoration: none;
}

.gravity-sidebar-note {
  margin: auto 8px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.gravity-sidebar-note span {
  display: block;
  margin-bottom: 6px;
  color: var(--cocoset-deep);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
}

.gravity-sidebar-note strong { font-size: 12px; }

.gravity-sidebar-note p {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.5;
}

.physics-page {
  padding: 28px 32px 34px;
  background:
    radial-gradient(900px 420px at 80% -15%, rgba(147, 197, 114, 0.13), transparent 62%),
    #fbfcf9;
}

.physics-heading {
  max-width: 1600px;
  margin: 0 auto 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.physics-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--cocoset-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
}

.physics-heading .page-title { font-size: 31px; }

.physics-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #dce8d3;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--cocoset-deep);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.physics-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cocoset-dark);
  box-shadow: 0 0 0 4px rgba(111, 162, 78, 0.13);
  animation: physics-pulse 1.8s ease-in-out infinite;
}

.physics-status.is-paused { color: var(--ink-faint); }
.physics-status.is-paused .physics-live-dot { background: var(--ink-faint); animation: none; }

@keyframes physics-pulse {
  50% { box-shadow: 0 0 0 7px rgba(111, 162, 78, 0.04); }
}

.physics-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 16px;
  max-width: 1600px;
  min-height: 560px;
  height: calc(100vh - 180px);
  margin: 0 auto;
}

.physics-controls,
.physics-stage-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
}

.physics-controls {
  padding: 18px;
  overflow-y: auto;
}

.control-section {
  padding-bottom: 20px;
  margin-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.control-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.control-title output {
  color: var(--cocoset-deep);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.physics-range {
  width: 100%;
  height: 4px;
  margin: 3px 0 13px;
  border-radius: 99px;
  outline: none;
  background: #dfe7d8;
  accent-color: var(--cocoset-dark);
  cursor: pointer;
}

.gravity-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.gravity-presets button {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}

.gravity-presets button:hover,
.gravity-presets button.is-selected {
  border-color: var(--cocoset);
  background: #f0f7ea;
  color: var(--cocoset-deep);
  font-weight: 700;
}

.material-list { display: grid; gap: 6px; }

.material-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.material-option:hover { background: var(--bg-side); }
.material-option.is-selected { border-color: #d6e7c9; background: #f1f7ec; }
.material-option > span:last-child { display: grid; gap: 2px; }
.material-option strong { font-size: 11.5px; }
.material-option small { color: var(--ink-faint); font-size: 9.5px; }

.material-swatch {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  box-shadow: inset -4px -5px 8px rgba(0, 0, 0, 0.18), inset 3px 3px 5px rgba(255, 255, 255, 0.55);
}

.material-swatch.rubber { background: #93c572; }
.material-swatch.steel { background: #83919a; }
.material-swatch.wood { background: #c78b52; }

.control-help {
  margin-top: 10px;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.5;
}

.physics-actions { display: flex; gap: 7px; }
.physics-actions button { flex: 1; padding-inline: 8px; }

.physics-stage-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.physics-toolbar {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 54px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
}

.telemetry-item { display: grid; gap: 2px; }
.telemetry-item span { color: var(--ink-faint); font-size: 8.5px; font-weight: 800; letter-spacing: 0.8px; }
.telemetry-item strong { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.physics-toolbar-spacer { flex: 1; }
.physics-tip { color: var(--ink-faint); font-size: 10.5px; }

.physics-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(246, 250, 242, 0.45), transparent 55%),
    linear-gradient(180deg, #17231b 0%, #101a14 100%);
}

#physics-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#physics-canvas.is-grabbing { cursor: grabbing; }

.physics-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: rgba(236, 245, 229, 0.78);
  text-align: center;
  pointer-events: none;
}

.physics-empty[hidden] { display: none; }

.physics-empty > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 6px;
  border: 1px solid rgba(187, 218, 166, 0.34);
  border-radius: 50%;
  background: rgba(147, 197, 114, 0.1);
  color: var(--cocoset);
  font-size: 24px;
  font-weight: 300;
}

.physics-empty strong { font-size: 13px; }
.physics-empty small { color: rgba(207, 220, 199, 0.5); font-size: 10.5px; }

.physics-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 38px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 9px;
}

.legend-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--cocoset-dark);
}

.legend-dot.collision { background: #d29a5c; }
.legend-dot.atmosphere { background: #7e9faf; }
.physics-model { margin-left: auto; }

/* ============================================================
   ESTADÍSTICAS DE HÁBITOS
   ============================================================ */

.habit-stats {
  max-width: 1400px;
  margin: 26px auto 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.hstats-head { margin-bottom: 18px; }
.hstats-head h2 { font-size: 17px; letter-spacing: -0.3px; }
.hstats-head p  { margin-top: 3px; color: var(--ink-faint); font-size: 11.5px; }

.hstats-total {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.hstats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 28px;
}

.hstats-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hstats-e { font-size: 14px; flex-shrink: 0; }

.hstats-n {
  min-width: 128px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
}

.hstats-bw {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: var(--bg-side);
  overflow: hidden;
}

.hstats-b {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #c77a86, #d18d96);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.hstats-b-main {
  background: linear-gradient(90deg, #6e3562, #8a4a78);
}

.hstats-c {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cocoset-deep);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================================================
   SALA — kanban personal
   ============================================================ */

.sala-page {
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(249, 171, 64, 0.10), transparent 60%),
    #fbf7f0;
}

.sala-hero {
  max-width: 1400px;
  margin: 0 auto 18px;
}

.sala-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #c97f1c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.sala-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto 22px;
  padding: 6px 18px;
  background: #fff;
  border: 1px solid #eadfcf;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.sala-input-icon { font-size: 20px; }

.sala-input-wrap input {
  flex: 1;
  padding: 13px 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}

.sala-input-wrap input::placeholder { color: var(--ink-faint); }

.sala-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

.sala-column {
  background: #f4ece1;
  border: 1px solid #eadfcf;
  border-radius: 14px;
  padding: 12px;
  min-height: 320px;
}

.sala-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
  font-weight: 700;
  font-size: 13px;
  color: #44455b;
}

.sala-count {
  min-width: 22px;
  text-align: center;
  padding: 2px 7px;
  border-radius: 99px;
  background: #f9ab40;
  color: #141518;
  font-size: 11px;
  font-weight: 700;
}

.sala-col-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.sala-card {
  position: relative;
  padding: 13px 14px;
  background: #fffdf8;
  border: 1px solid #eadfcf;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(68, 69, 91, 0.06);
  cursor: grab;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}

.sala-card:hover {
  transform: translateY(-1px);
  border-color: #f9ab40;
  box-shadow: 0 4px 14px rgba(68, 69, 91, 0.10);
}

.sala-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.sala-card-text {
  display: block;
  font-size: 13.5px;
  line-height: 1.5;
  color: #44455b;
  overflow-wrap: anywhere;
  padding-right: 18px;
}

.sala-card-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #c0564a;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, background .12s;
}

.sala-card:hover .sala-card-del { opacity: 1; }
.sala-card-del:hover { background: #fbecec; }

.sala-card-input {
  width: 100%;
  padding: 4px 6px;
  border: 1.5px solid #f9ab40;
  border-radius: 6px;
  outline: none;
  font: inherit;
  font-size: 13.5px;
  color: #44455b;
  background: #fff;
}

.sala-col-body.drag-over {
  outline: 2px dashed #f9ab40;
  outline-offset: 4px;
  border-radius: 8px;
}

/* ============================================================
   MÓVIL
   ============================================================ */

@media (max-width: 1050px) {
  .habit-manifesto { grid-template-columns: 1fr; }
  .habit-days-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .physics-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .physics-toolbar { gap: 16px; }
  .physics-tip { display: none; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 262px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-modal);
  }

  .app.side-open .sidebar { transform: none; }

  .only-mobile { display: block; }
  .no-mobile { display: none !important; }

  .page { padding: 26px 18px 60px; }
  .page-title { font-size: 28px; }
  .modal-panel { height: 92vh; margin: 4vh auto 0; }
  .modal-head { padding-left: 18px; }
  .stat-grid,
  .stat-panels { grid-template-columns: 1fr; }
  .audit-toolbar { flex-direction: column; }

  .habits-hero {
    align-items: flex-start;
    margin: -26px -18px 22px;
    padding: 24px 18px 20px;
  }
  .habits-progress { width: 76px; height: 76px; flex-basis: 76px; }
  .habits-progress strong { font-size: 23px; }
  .habit-manifesto { margin-bottom: 22px; }
  .habits-grid-head > span { display: none; }
  .sala-board { grid-template-columns: 1fr; }
  .sala-column { min-height: 0; }
  .hstats-grid { grid-template-columns: 1fr; }

  .physics-page { padding: 22px 14px 42px; }
  .physics-heading { align-items: flex-start; }
  .physics-heading .page-title { font-size: 27px; }
  .physics-status { display: none; }
  .physics-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .physics-controls { order: 2; overflow: visible; }
  .physics-stage-card { order: 1; height: 58vh; min-height: 440px; }
  .physics-canvas-wrap { min-height: 330px; }
  .physics-footer { gap: 10px; overflow-x: auto; white-space: nowrap; }
  .physics-model { display: none; }
}

@media (max-width: 480px) {
  .habits-progress { display: none; }
  .habit-days-grid { grid-template-columns: 1fr; }
  .hdc-detail { display: none; }

  .physics-toolbar { gap: 13px; padding-inline: 13px; }
  .telemetry-item span { font-size: 7.5px; }
  .telemetry-item strong { font-size: 11px; }
  .physics-footer span:nth-child(3) { display: none; }
}

/* ============================================================
   PAINT APPLICATION
   ============================================================ */

.paint-sidebar-note {
  margin: auto 8px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.paint-sidebar-note span {
  display: block;
  margin-bottom: 6px;
  color: var(--cocoset-deep);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
}

.paint-sidebar-note strong { font-size: 12px; }

.paint-sidebar-note p {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.5;
}

.paint-page {
  padding: 28px 32px 34px;
  background:
    radial-gradient(900px 420px at 80% -15%, rgba(147, 197, 114, 0.13), transparent 62%),
    #fbfcf9;
}

.paint-heading {
  max-width: 1600px;
  margin: 0 auto 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.paint-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--cocoset-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
}

.paint-heading .page-title { font-size: 31px; }

.paint-actions {
  display: flex;
  gap: 8px;
}

.paint-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 16px;
  max-width: 1600px;
  min-height: 560px;
  height: calc(100vh - 180px);
  margin: 0 auto;
}

.paint-controls,
.paint-stage-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
}

.paint-controls {
  padding: 18px;
  overflow-y: auto;
}

.paint-color {
  width: 100%;
  height: 40px;
  margin: 3px 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.color-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.color-preset {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s;
}

.color-preset:hover {
  transform: scale(1.1);
  border-color: var(--cocoset);
}

.paint-range {
  width: 100%;
  height: 4px;
  margin: 3px 0 13px;
  border-radius: 99px;
  outline: none;
  background: #dfe7d8;
  accent-color: var(--cocoset-dark);
  cursor: pointer;
}

.tool-list {
  display: grid;
  gap: 6px;
}

.tool-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tool-option:hover { background: var(--bg-side); }
.tool-option.is-selected { border-color: #d6e7c9; background: #f1f7ec; }
.tool-option > span:last-child { display: grid; gap: 2px; }
.tool-option strong { font-size: 11.5px; }

.paint-stage-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.paint-toolbar {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 54px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
}

.paint-toolbar-spacer { flex: 1; }
.paint-tip { color: var(--ink-faint); font-size: 10.5px; }

.paint-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  margin: 16px;
  border-radius: 8px;
}

#paint-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* Gallery Styles */
.gallery-panel {
  width: min(900px, 94vw);
  height: min(80vh, 700px);
}

.gallery-panel h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  max-height: calc(80vh - 140px);
}

.gallery-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(76, 122, 51, 0.13);
}

.gallery-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--bg-side);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

.gallery-info {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.gallery-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-info small {
  color: var(--ink-faint);
  font-size: 11px;
}

.btn-delete {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.btn-delete:hover {
  background: #fbeeec;
}

.gallery-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
}

.gallery-empty h2 { font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.gallery-empty p { font-size: 13px; }

/* Save Modal */
#painting-title {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

#painting-title:focus { border-color: var(--cocoset); }

/* Mobile responsive for paint */
@media (max-width: 820px) {
  .paint-page { padding: 22px 14px 42px; }
  .paint-heading { align-items: flex-start; }
  .paint-heading .page-title { font-size: 27px; }
  .paint-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .paint-controls { order: 2; overflow: visible; }
  .paint-stage-card { order: 1; height: 58vh; min-height: 440px; }
  .paint-canvas-wrap { min-height: 330px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
