:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #8b91a0;
  --accent: #3b82f6;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
}
button {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px;
  cursor: pointer; user-select: none;
}
button:hover { border-color: var(--accent); }
input {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}

/* --- centrado para login / nuevo proyecto --- */
.center {
  height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
}
.center h1 { font-weight: 600; font-size: 22px; margin: 0; }
.big-date { font-size: 28px; padding: 18px 22px; text-align: center; }
.error { color: #f87171; min-height: 18px; }

/* --- lista de proyectos --- */
.list { max-width: 640px; margin: 48px auto; padding: 0 16px; }
.list header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.proj {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 10px; cursor: pointer;
}
.proj:hover { border-color: var(--accent); }
.proj .meta { color: var(--muted); font-size: 12px; }
.proj .del { background: transparent; border: none; color: var(--muted); }
.proj .del:hover { color: #f87171; }

/* --- timeline --- */
.tl { height: 100vh; display: flex; flex-direction: column; }
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.toolbar input.name {
  font-weight: 600; flex: 1; min-width: 0;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
}
.toolbar input.name:hover { border-color: var(--border); }
.toolbar input.name:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.toolbar .zoom { font-size: 12px; color: var(--muted); min-width: 70px; text-align: center; }
.toolbar .menu-btn { font-size: 18px; line-height: 1; padding: 6px 12px; }

.surface {
  position: relative; flex: 1; overflow: hidden; background: var(--bg);
  touch-action: none; /* clave: desactiva scroll/zoom nativo para manejar gestos */
  cursor: crosshair;
}
.tick {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--border); pointer-events: none;
}
.tick-label {
  position: absolute; top: 30px; left: 4px; font-size: 11px; color: var(--muted);
  white-space: nowrap;
}
.date-chip {
  position: absolute; top: 4px; left: 0; z-index: 3; pointer-events: none;
  font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--panel); border: 1px solid var(--border);
  padding: 2px 9px; border-radius: 6px; white-space: nowrap;
}
.event {
  position: absolute; height: 40px; border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; color: #fff; font-size: 13px;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); cursor: grab;
}
.event-title { padding: 0 8px; pointer-events: none; white-space: nowrap; overflow: hidden; }
.event.draft { opacity: .6; }

.scrollbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-top: 1px solid var(--border); background: var(--panel);
}
.scrollbar .grow { flex: 1; text-align: center; color: var(--muted); font-size: 12px; }

/* --- editor modal --- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 12px;
}
.modal .menu-section { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0; text-transform: uppercase; letter-spacing: .04em; }
.modal label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.modal .row { display: flex; gap: 10px; justify-content: space-between; }
.modal .danger { color: #f87171; border-color: #6b2330; }
.modal input[type=color] { padding: 2px; width: 56px; height: 34px; cursor: pointer; }
