/* Offhook — estilos de la versión web
   Colores y medidas del sistema de diseño de Offhook. */

:root {
  --surface-100: #F6F3EC;   /* fondo */
  --surface-200: #FDFBF7;   /* tarjetas */
  --line: #E3DDD1;
  --ink: #1F2A24;           /* texto */
  --ink-muted: #5B6560;     /* texto secundario */
  --brand: #2F6B4F;         /* verde Offhook */
  --brand-soft: #DCE8DF;
  --on-brand: #FFFFFF;
  --accent: #E07A3F;        /* naranja: "te necesita" */
  --accent-ink: #A4461A;

  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --font: "Figtree", system-ui, sans-serif;
  --font-logo: "Fraunces", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-100: #151B18;
    --surface-200: #1E2622;
    --line: #2F3833;
    --ink: #EEF1EC;
    --ink-muted: #A6B0AA;
    --brand: #6FBF95;
    --brand-soft: #233A2E;
    --on-brand: #151B18;
    --accent: #F0915A;
    --accent-ink: #F6A877;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.topbar {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-logo);
  font-weight: 600;
  font-size: 22px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--ink-muted);
  background: none;
  border: none;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-200); color: var(--ink); }
.icon-btn svg, .tile svg, .row svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Contenido ---------- */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 48px;
  outline: none;
}

.screen { display: flex; flex-direction: column; gap: 32px; }

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.lead { margin: 12px 0 0; color: var(--ink-muted); }

.back {
  align-self: flex-start;
  margin: -24px 0 -8px -12px;
}

/* ---------- Tarjetas de tareas ---------- */

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: var(--surface-200);
  border: none;
  border-radius: var(--radius-lg);
  color: var(--ink);
  font: 600 17px/1.4 var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
a.row:hover, button.row:hover { outline: 2px solid var(--line); }
.row .grow { flex-grow: 1; }
.row .chev { color: var(--ink-muted); }

.dot {
  width: 10px; height: 10px; flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent);
}

.row.done { color: var(--ink-muted); font-weight: 500; }
.row.done .label { text-decoration: line-through; }

.row input[type="checkbox"] {
  width: 22px; height: 22px; margin: 0; flex-shrink: 0;
  accent-color: var(--brand);
}

.empty {
  padding: 32px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-200);
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- Botones grandes (tiles) ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: none;
  border-radius: var(--radius-xl);
  font: 600 18px/1.25 var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.tile .ico {
  width: 44px; height: 44px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}
.tile.primary { background: var(--brand); color: var(--on-brand); }
.tile.primary .ico { background: rgba(255, 255, 255, 0.18); }
.tile.secondary { background: var(--brand-soft); color: var(--ink); }
.tile.secondary .ico { background: var(--surface-200); color: var(--brand); }
.tile:hover { filter: brightness(1.05); }
.tile:disabled { opacity: .5; cursor: default; }

/* ---------- Chat ---------- */

.chat { display: flex; flex-direction: column; gap: 12px; }

.bubble {
  max-width: min(420px, 85%);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  white-space: pre-line;
}
.bubble.bot { align-self: flex-start; background: var(--brand-soft); border-bottom-left-radius: 8px; }
.bubble.me  { align-self: flex-end; background: var(--surface-200); border-bottom-right-radius: 8px; }
.bubble-note { align-self: flex-end; margin: -4px 8px 0; font-size: 14px; color: var(--ink-muted); }

.composer { display: flex; gap: 8px; align-items: center; }
.composer input {
  flex-grow: 1; min-width: 0;
  height: 56px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--surface-200);
  color: var(--ink);
  font: 400 17px var(--font);
}
.composer input:focus { outline: none; border-color: var(--brand); }
.send {
  width: 56px; height: 56px; flex-shrink: 0;
  border: none; border-radius: 999px;
  background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.send svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--surface-200);
  color: var(--ink);
  font: 600 15px var(--font);
  cursor: pointer;
}
.chip:hover { background: var(--brand-soft); }

/* ---------- Formularios ---------- */

textarea, .field {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--surface-200);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  resize: vertical;
}
textarea:focus, .field:focus { outline: none; border-color: var(--brand); }

.form { gap: 20px; }
.field-label { display: block; margin-bottom: 8px; font-weight: 600; }

.text-btn {
  align-self: center;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  background: none;
  color: var(--ink-muted);
  font: 600 16px var(--font);
  cursor: pointer;
}
.text-btn:hover { color: var(--ink); }

.row-note { flex-basis: 100%; padding-left: 36px; font: 500 14px/1.4 var(--font); color: var(--accent-ink); }

[hidden] { display: none !important; }

.hint { margin: 8px 4px 0; font-size: 14px; color: var(--ink-muted); }
.muted { color: var(--ink-muted) !important; }

/* ---------- Agenda ---------- */

.section-title { margin: 0 0 12px 4px; font-size: 15px; font-weight: 600; color: var(--ink-muted); }

.row .when { color: var(--ink-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.row-link { color: inherit; text-decoration: none; }
.row-note svg { width: 14px; height: 14px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.75; }

.tag-urgent {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  vertical-align: 2px;
}
h1 + .lead, div > .tag-urgent:first-child { margin-left: 0; margin-bottom: 12px; }

.slot-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-200);
}
.slot-text { display: inline-flex; align-items: center; gap: 10px; }
.slot-text svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--brand); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.slot-card .time-row { flex-basis: 100%; }

.chip.primary { background: var(--brand); color: var(--on-brand); }
.chip.primary:hover { background: var(--brand); filter: brightness(1.05); }
.chip.day { min-width: 44px; padding: 0; }
.chips.days { display: grid; grid-template-columns: repeat(7, minmax(0, 52px)); gap: 6px; }
.chips.days .chip.day { min-width: 0; min-height: 0; width: 100%; aspect-ratio: 1; }
.chip.day[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset.plain { margin: 0; padding: 0; border: none; }
select.field {
  appearance: none; cursor: pointer;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F6B4F' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center; background-size: 18px;
}
.hint a { color: var(--brand); font-weight: 600; }

/* ---------- Chat con el asistente ---------- */

.composer .mic { background: var(--brand-soft); color: var(--brand); }
.composer .mic.recording { background: var(--ink); color: var(--surface-100); }

.bubble.thinking { color: var(--ink-muted); }
.action-note {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}
.action-note.failed { color: var(--ink-muted); }
.action-note svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chat-screen { min-height: calc(100vh - 160px); }
.chat-screen .chat { flex-grow: 1; }
.chat-screen .composer {
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-100);
}

/* ---------- Orden del día y equipo ---------- */

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head .section-title { margin-bottom: 12px; }
.text-btn.small { min-height: 36px; margin: -6px 0 6px; padding: 0 8px; font-size: 15px; color: var(--brand); }

.order-n {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: 14px;
}
.order-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  cursor: pointer;
}
.order-btn:disabled { opacity: .35; cursor: default; }
.order-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.row:has(.order-btn) { padding: 12px 12px 12px 16px; gap: 10px; }

.who-select {
  width: auto; flex: 0 1 220px; min-width: 0;
  padding: 10px 40px 10px 18px;
  border-radius: 999px;
  background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F6B4F' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
  font-weight: 600; font-size: 16px; line-height: 1.4;
}
.row .sub { display: block; margin-top: 2px; font-size: 14px; font-weight: 500; color: var(--ink-muted); }
.member .chip:not(.primary), .crew-job .chip:not(.primary) { background: var(--brand-soft); }

.member, .crew-job {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-200);
}
.member-name { font-weight: 600; font-size: 17px; }
.crew-top { display: flex; align-items: flex-start; gap: 12px; }
.crew-top .grow { flex-grow: 1; line-height: 1.4; }
.crew-top .when { margin-left: 6px; color: var(--ink-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.crew-info { margin: 0; padding-left: 40px; color: var(--ink-muted); font-size: 15px; }
.crew-job .chips { padding-left: 40px; }
.crew-job.done strong { text-decoration: line-through; color: var(--ink-muted); }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- WhatsApp: etiquetas de contactos ---------- */
.tag-new {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px; font-weight: 600;
  vertical-align: 1px;
}
.hello { margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--brand); }
.member .sub { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-muted); }
.row:has(> .chips) { flex-wrap: wrap; row-gap: 10px; }
.row:has(> .chips) .grow { flex: 1 1 130px; }
.row .chip { flex-shrink: 0; min-height: 40px; padding: 0 14px; background: var(--brand-soft); }

.add-row { display: flex; gap: 8px; }
.add-row .field { border-radius: 999px; height: 56px; padding: 0 22px; }

/* ---------- Foto ---------- */

.photo {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: var(--surface-200);
}

/* Hojas de una lista larga (miniaturas) */
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.sheet { position: relative; margin: 0; aspect-ratio: 3 / 4; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-200); }
.sheet img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-x {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: none; border-radius: 999px;
  background: var(--surface-200); color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.sheet-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.urgent-tag { color: var(--accent-ink); font-weight: 600; }

.note {
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  font-size: 15px;
  color: var(--ink);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Aviso flotante ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 24px);
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface-100);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Pantallas anchas ---------- */

/* Celulares chicos (360px o menos): que entre el texto de la barra */
@media (max-width: 380px) {
  .composer input { height: 50px; padding: 0 16px; font-size: 16px; }
  .send { width: 50px; height: 50px; }
}

@media (min-width: 720px) {
  main { padding-top: 64px; }
  .tile { min-height: 148px; }
}

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Casilla "Acepto la política de privacidad" (crear cuenta) */
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-muted); }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex-shrink: 0; }
.check a { color: var(--brand); }
