/* DevTeam Tracker — web de registro de tiempo.
 *
 * Se usa en dos contextos muy distintos: el teléfono, de pie y con una mano
 * mientras alguien te interrumpe; y el escritorio, con la pestaña abierta todo
 * el día. La hoja está escrita móvil primero y a partir de 720px reorganiza en
 * dos columnas, para que en pantalla grande no quede una tira estrecha de
 * contenido con medio monitor vacío.
 */

:root {
  --bg: #0d0f14;
  --bg-soft: #12151c;
  --surface: #171a22;
  --surface-2: #1e222c;
  --surface-3: #262b36;
  --border: #2a2f3b;
  --border-soft: #21252e;

  --text: #f4f6fa;
  --muted: #98a2b3;
  --dim: #5f6878;

  --task: #4f8dfd;
  --task-soft: #17284a;
  --interruption: #f5b23c;
  --interruption-soft: #ife;
  --interruption-soft: #3a2b12;
  --danger: #f2555a;
  --success: #3dd68c;

  --radius: 14px;
  --radius-sm: 10px;
  --gap: 14px;
  --pad: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 500px at 50% -10%, #182034 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

h1 { font-size: 24px; margin: 0; letter-spacing: -0.3px; }
h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--dim); margin: 0 0 12px; font-weight: 700;
}
p { margin: 0; }

.muted { color: var(--muted); font-size: 13.5px; }
.dim { color: var(--dim); font-size: 12.5px; }

/* ---------------------------------------------------------- barra superior --- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--task); }
.mark { width: 26px; height: 26px; flex: none; }
.brand-name {
  font-size: 15px; font-weight: 700; letter-spacing: -0.2px; color: var(--text);
  white-space: nowrap;
}

.session { display: flex; align-items: center; gap: 10px; min-width: 0; }
.session-name {
  font-size: 13.5px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.session button { width: auto; padding: 7px 12px; font-size: 13px; }

/* En pantallas estrechas el nombre ya está en el encabezado de contenido:
   repetirlo en la barra sólo roba espacio a la marca. */
@media (max-width: 479px) {
  .session-name { display: none; }
  .brand-name { font-size: 14px; }
}

/* ------------------------------------------------------------ cabecera --- */

header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 4px;
}
.who-block { min-width: 0; }
.date { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ------------------------------------------------------------- tarjetas --- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
}

section + section { margin-top: 30px; }

/* --------------------------------------------------- actividad en curso --- */

.now {
  position: relative;
  overflow: hidden;
  padding: 22px var(--pad);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
}
/* La franja de color dice de un vistazo si es tarea o interrupción. */
.now::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--border);
}
.now.task::before { background: var(--task); }
.now.interruption::before { background: var(--interruption); }

.now-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--dim); font-weight: 700;
}
.now-title { font-size: 19px; font-weight: 650; margin: 7px 0 0; line-height: 1.3; }
.timer {
  font-size: clamp(38px, 11vw, 54px); font-weight: 750; letter-spacing: -2px;
  font-variant-numeric: tabular-nums; margin: 10px 0 2px; line-height: 1;
}
.now.task .timer { color: var(--task); }
.now.interruption .timer { color: var(--interruption); }
.idle .timer { color: var(--dim); }

/* ------------------------------------------------------------- botones --- */

button {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 15px 16px; width: 100%;
  cursor: pointer; text-align: left; display: block;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
@media (hover: hover) {
  button:hover:not([disabled]) { background: var(--surface-3); border-color: #333a48; }
}
button:active:not([disabled]) { transform: scale(.995); }
button[disabled] { opacity: .42; cursor: default; }

button.primary {
  background: var(--task); border-color: var(--task); color: #fff; text-align: center;
}
@media (hover: hover) { button.primary:hover:not([disabled]) { background: #3f7ceb; border-color: #3f7ceb; } }

button.stop {
  background: transparent; border-color: #4a2529; color: var(--danger);
  text-align: center; margin-top: 16px;
}
@media (hover: hover) { button.stop:hover { background: #2a1517; border-color: var(--danger); } }

button.ghost { background: transparent; border-color: transparent; color: var(--task); text-align: center; }

.list { display: flex; flex-direction: column; gap: 9px; }

/* Cada tarea es un botón: el área tocable es toda la tarjeta. */
.item-title { font-weight: 650; line-height: 1.35; }
.item-meta { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 5px; }

.bar { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; background: var(--task); border-radius: 2px; }
.bar span.over { background: var(--danger); }

/* -------------------------------------------------------- formularios --- */

input, textarea {
  font: inherit; color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 13px; width: 100%; margin-bottom: 11px;
}
input::placeholder { color: var(--dim); }
input:focus, textarea:focus { outline: 2px solid var(--task); outline-offset: -2px; border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 9px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-soft); font-size: 13px; width: auto;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 500;
}
.chip.on { border-color: var(--task); background: var(--task-soft); color: #cfe0ff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ------------------------------------------------------------- totales --- */

.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.total {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 13px 14px;
}
.total b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.total span { font-size: 11.5px; color: var(--muted); }
.total.task b { color: var(--task); }
.total.interruption b { color: var(--interruption); }

/* ------------------------------------------------------------ bitácora --- */

.entry {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft);
}
.entry:last-child { border-bottom: none; }
.entry:first-child { padding-top: 0; }
.entry time {
  color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
  white-space: nowrap; min-width: 92px;
}
.entry .who { flex: 1; font-size: 14px; min-width: 0; }
.entry .note { color: var(--dim); font-size: 12px; font-style: italic; margin-top: 2px; }
.entry .len { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* -------------------------------------------------------------- avisos --- */

#banner {
  position: sticky; top: 10px; z-index: 20;
  padding: 13px 15px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 13.5px; display: none; backdrop-filter: blur(8px);
}
#banner.error { display: block; background: #3a1a1cef; border: 1px solid var(--danger); color: #ffc0c3; }
#banner.info  { display: block; background: #17284aef; border: 1px solid var(--task); color: #d3e2ff; }

.center { text-align: center; padding: 60px 0; }
.hidden { display: none !important; }

/* --------------------------------------------------------------- login --- */

.login-card { max-width: 420px; margin: 8vh auto 0; }
.login-card h1 { margin-bottom: 8px; }
.login-card .muted { margin-bottom: 22px; }
#code { text-align: center; letter-spacing: 2px; font-size: 17px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- pantalla ancha --- */

@media (min-width: 720px) {
  .wrap { padding: 36px 28px 64px; }
  h1 { font-size: 28px; }

  .topbar { padding-bottom: 20px; margin-bottom: 28px; }
  .mark { width: 30px; height: 30px; }
  .brand-name { font-size: 16.5px; }

  /* Dos columnas: a la izquierda lo que se hace, a la derecha lo que se ve.
     En el teléfono ese orden se vuelve vertical y sigue teniendo sentido. */
  .columns {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
  }
  .columns > * { min-width: 0; }
  /* El primer bloque de cada columna arranca arriba del todo. */
  .columns > * > section:first-child { margin-top: 0; }
  section + section { margin-top: 26px; }

  .now { padding: 26px 24px; }
  .timer { font-size: 52px; }

  /* Las tareas en rejilla: en un monitor, una lista de una columna desperdicia
     todo el ancho. */
  .list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (min-width: 1000px) {
  .wrap { padding: 44px 32px 72px; }
}
