/* DJS Tareas — negro y dorado (la D cursiva dorada sobre negro de DJS Hair Fashion).
   Títulos en Playfair Display (SIL OFL 1.1); el texto, en la fuente del sistema. */
@font-face {
  font-family: "Playfair Display";
  src: url("/fonts/playfair-display.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --ink: #111111;
  --ink-2: #3b3a37;
  --muted: #77736a;
  --line: #e8e4da;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --mist: #eeebe4;
  --oro: #c9a24a;        /* dorado de la marca */
  --oro-suave: #f6eed9;
  --oro-claro: #e6c77a;  /* dorado sobre fondo negro */
  --bronce: #86661f;     /* dorado oscuro: texto sobre blanco */
  --noche: #111111;
  --danger: #c0392b;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(17, 17, 17, .05), 0 8px 24px rgba(17, 17, 17, .06);
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 var(--body);
  min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 14px) 18px calc(var(--safe-b) + 110px); }

/* ---------- Logotipo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.logo .sello { width: 38px; height: 38px; border-radius: 11px; background: var(--noche); display: grid; place-items: center; flex: none; }
.logo .sello svg { width: 27px; height: 22px; }
.logo .word { font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1; letter-spacing: .02em; }
.logo .word small { display: block; font-family: var(--body); font-weight: 600; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--bronce); margin-top: 4px; }
.logo.big .sello { width: 64px; height: 64px; border-radius: 18px; }
.logo.big .sello svg { width: 46px; height: 37px; }
.logo.big .word { font-size: 34px; }
.logo.big .word small { font-size: 11px; }

/* ---------- Cabecera ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 22px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.me-btn { border-radius: 50%; }

.hero h1 { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.02; letter-spacing: -.01em; }
.hero p { color: var(--muted); margin-top: 6px; }
.hero { margin-bottom: 22px; }

/* ---------- Avatares ---------- */
.avatar {
  --s: 72px; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  background: var(--oro); color: var(--noche);
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--display); font-weight: 600; font-size: calc(var(--s) * .44); line-height: 1; padding-top: calc(var(--s) * .05);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; margin-top: calc(var(--s) * -.05); }
.avatar.has-img { padding-top: 0; }
.avatar.has-img img { margin-top: 0; }
.avatar.sm { --s: 40px; }
.avatar.md { --s: 52px; }
.avatar.xl { --s: 104px; }

/* ---------- Inicio: recuadros de personas ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.person {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 12px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  transition: transform .12s ease; width: 100%;
}
.person:active { transform: scale(.97); }
.person .name { font-weight: 600; font-size: 15px; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; background: var(--ink); color: #fff; }
.pill.zero { background: var(--mist); color: var(--muted); }
.pill.sky { background: var(--oro-suave); color: var(--noche); }
.person.is-me { outline: 2px solid var(--oro); outline-offset: -2px; }

/* ---------- Aviso de notificaciones ---------- */
.banner { background: var(--noche); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; display: flex; gap: 14px; align-items: center; }
.banner p { font-size: 14px; flex: 1; line-height: 1.35; }
.banner b { display: block; font-size: 15px; }
.banner button { background: var(--oro-claro); color: var(--noche); font-weight: 700; border-radius: 999px; padding: 10px 16px; font-size: 14px; flex: none; }

/* ---------- Pantalla de persona ---------- */
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.person-head h1 { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.05; }
.person-head p { color: var(--muted); margin-top: 4px; }

.block-title { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--bronce); margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px; }
.block-title:first-of-type { margin-top: 0; }
.block-title span { background: var(--oro-suave); color: var(--noche); border-radius: 999px; padding: 2px 8px; letter-spacing: 0; font-size: 12px; }

.task { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 14px 14px; display: flex; gap: 14px; margin-bottom: 12px; transition: opacity .25s, transform .25s; }
.task.done { opacity: .45; }
.task.done h3 { text-decoration: line-through; }
.task.gone { opacity: 0; transform: translateX(24px); }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); flex: none; display: grid; place-items: center; margin-top: 1px; transition: background .15s; position: relative; }
.check::after { content: ""; position: absolute; inset: -9px; }
.check svg { width: 16px; height: 16px; opacity: 0; }
.task.done .check { background: var(--ink); }
.task.done .check svg { opacity: 1; }
.check[disabled] { border-color: var(--line); cursor: default; }
.task .body { flex: 1; min-width: 0; }
.task h3 { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.task .notes { color: var(--ink-2); font-size: 14px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.task .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.chip { border-radius: 999px; padding: 3px 9px; background: var(--oro-suave); color: var(--noche); font-weight: 600; }
.chip.late { background: #fbe9e7; color: var(--danger); }
.link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; font-size: 12.5px; margin-left: auto; padding: 4px 0; }
.link.danger { color: var(--danger); font-weight: 600; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ring { width: 72px; height: 72px; border-radius: 50%; background: var(--oro-suave); display: grid; place-items: center; margin: 0 auto 16px; color: var(--noche); }
.empty .ring svg { width: 30px; height: 30px; }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 22px; font-weight: 600; margin-bottom: 4px; }

/* ---------- Botones ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; font-size: 16px; padding: 0 22px; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.soft { background: var(--oro-suave); color: var(--noche); }
.btn.small { min-height: 40px; font-size: 14px; width: auto; padding: 0 16px; }
.btn.danger { background: none; color: var(--danger); box-shadow: none; }

.fab { position: fixed; z-index: 5; right: max(18px, calc((100vw - 560px) / 2 + 18px)); bottom: calc(var(--safe-b) + 22px); height: 58px; border-radius: 999px; background: var(--ink); color: #fff; padding: 0 22px 0 18px; display: flex; align-items: center; gap: 8px; font-weight: 600; box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
.fab svg { width: 20px; height: 20px; }

/* ---------- Formularios ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 4px 6px; }
.input { width: 100%; min-height: 52px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); padding: 13px 16px; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
textarea.input { min-height: 84px; resize: none; }
.input:focus { border-color: var(--ink); }
.input::placeholder { color: #a5adb1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--danger); font-size: 14px; margin: 4px 4px 12px; min-height: 1.3em; }

/* ---------- Login ---------- */
.login { min-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 124px); display: flex; flex-direction: column; justify-content: center; }
.login .logo { justify-content: center; margin-bottom: 10px; }
.login .tag { text-align: center; color: var(--muted); margin-bottom: 36px; letter-spacing: .02em; }
.login-card { background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: 24px 20px 20px; }

/* ---------- Hoja inferior ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(10, 10, 10, .42); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 28px 28px 0 0; padding: 10px 18px calc(var(--safe-b) + 20px); animation: rise .24s cubic-bezier(.2, .8, .2, 1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #cfd4d8; margin: 0 auto 14px; }
.sheet h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin-bottom: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; }
.close { width: 36px; height: 36px; border-radius: 50%; background: var(--mist); display: grid; place-items: center; }
.close svg { width: 14px; height: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .6; } }

.who { display: flex; gap: 10px; overflow-x: auto; padding: 6px 18px 6px; margin: 0 -18px 12px; scrollbar-width: none; }
.who::-webkit-scrollbar { display: none; }
.who button { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 68px; flex: none; font-size: 12.5px; color: var(--muted); }
.who button span { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 2px var(--bg); opacity: .55; transition: opacity .15s; }
.who button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.who button[aria-pressed="true"] .avatar { opacity: 1; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

/* ---------- Perfil / equipo ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin-bottom: 4px; }
.card > p { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 22px; }
.profile-head h1 { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.05; }
.profile-head p { color: var(--muted); margin-top: -6px; }
.profile-head .actions { display: flex; gap: 8px; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.steps li { margin-bottom: 4px; }
.status { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c5cbd0; }
.dot.on { background: #2e9e6b; }
.stack { display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.user-row:first-of-type { border-top: 0; }
.user-row .t { flex: 1; min-width: 0; }
.user-row .t b { display: block; font-size: 15px; }
.user-row .t small { color: var(--muted); }
.user-row.off { opacity: .5; }
.user-row > svg { width: 14px; height: 14px; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--mist); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.seg button { min-height: 40px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- Toast ---------- */
#toast { position: fixed; z-index: 40; left: 50%; bottom: calc(var(--safe-b) + 96px); transform: translate(-50%, 20px); background: var(--noche); color: #fff; border-radius: 999px; padding: 12px 18px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 36px); white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: var(--oro-claro); font-weight: 700; }

.skeleton { height: 150px; border-radius: var(--radius); background: linear-gradient(100deg, #eceef1 40%, #f6f7f9 50%, #eceef1 60%) 0 0 / 200% 100%; animation: shine 1.2s linear infinite; }
@keyframes shine { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.card.user-row { padding: 16px 18px; border-top: 0; }

/* =====================================================================
   v1.2 — barra inferior y sección Reportes
   ===================================================================== */
#app { padding-bottom: calc(var(--safe-b) + 170px); }
.fab { bottom: calc(var(--safe-b) + 84px); }
#toast { bottom: calc(var(--safe-b) + 156px); }

#tabs { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
#tabs a { flex: 1; max-width: 186px; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8a9499; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }
#tabs a svg { width: 24px; height: 24px; }
#tabs a[aria-current="page"] { color: var(--ink); }

.hero.tight { margin-bottom: 14px; }
.topbar { margin-bottom: 14px; }

/* selector de tipo */
.seg.seg4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.seg.seg5 { grid-template-columns: repeat(5, 1fr); margin-bottom: 16px; }
.seg.seg5 a { font-size: 12.5px; letter-spacing: -.01em; }
.seg a { min-height: 40px; border-radius: 11px; font-weight: 600; font-size: 13.5px; color: var(--muted); display: grid; place-items: center; }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* navegación de periodo */
.period { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.icon-btn.flat { box-shadow: none; background: var(--surface); border: 1px solid var(--line); flex: none; }
.icon-btn.off { opacity: .28; }
.period-label { flex: 1; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.period-label b { font-family: var(--display); font-weight: 600; font-size: 19px; display: inline-flex; align-items: center; gap: 4px; padding-top: 3px; }
.period-label b svg { width: 15px; height: 15px; margin-top: -3px; color: var(--muted); }
.period-label small { color: var(--muted); font-size: 12.5px; }

/* tarjeta principal */
.card.dark { background: var(--ink); color: #fff; padding: 20px 20px 16px; }
.kicker { display: block; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--bronce); }
.card.dark .kicker { color: var(--oro-claro); }
.big { font-family: var(--display); font-weight: 600; font-size: 46px; line-height: 1; letter-spacing: -.02em; margin: 12px 0 8px; font-variant-numeric: lining-nums tabular-nums; }
.card.dark > p.big-sub { color: rgba(255, 255, 255, .78); font-size: 15px; margin-bottom: 10px; }
.card.dark > p.cmp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: rgba(255, 255, 255, .62); font-size: 13px; margin-bottom: 4px; }
.mid { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.05; margin: 8px 0 4px; font-variant-numeric: lining-nums tabular-nums; }

.delta { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--mist); color: var(--muted); }
.delta.up { background: #e3f4ea; color: #17794a; }
.delta.down { background: #fbe9e7; color: var(--danger); }
.delta.on-dark { background: rgba(255, 255, 255, .14); color: #fff; }
.delta.on-dark.up { background: rgba(88, 214, 141, .2); color: #7ee2a8; }
.delta.on-dark.down { background: rgba(255, 120, 100, .2); color: #ff9c8c; }

/* gráfico de barras */
.chart { margin-top: 14px; }
.chart-read { font-size: 13px; color: var(--muted); min-height: 1.4em; margin-bottom: 8px; }
.chart-read b { color: var(--ink); font-weight: 600; }
.chart.on-dark .chart-read { color: rgba(255, 255, 255, .62); }
.chart.on-dark .chart-read b { color: #fff; }
.bars { display: flex; align-items: flex-end; gap: 4px; }
.chart.dense .bars { gap: 1px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; position: relative; }
.bar i { display: block; width: 100%; border-radius: 4px 4px 1px 1px; background: var(--oro); transition: background .12s; }
.chart.dense .bar i { border-radius: 2px 2px 0 0; }
.bar.vacia i { background: var(--line); }
.bar.on i { background: var(--ink); }
.chart.on-dark .bar i { background: rgba(255, 255, 255, .26); }
.chart.on-dark .bar.vacia i { background: rgba(255, 255, 255, .1); }
.chart.on-dark .bar.on i { background: var(--oro-claro); }
.chart-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.chart.on-dark .chart-axis { color: rgba(255, 255, 255, .5); }

.fine { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.card > p.fine { margin: 10px 0 0; }
.fine.on-dark { color: rgba(255, 255, 255, .5); margin-top: 8px; }
.card.dark > p.fine { margin: 8px 0 0; }
.fine.lead { margin: -4px 4px 12px; }
p.card.fine { margin-bottom: 14px; }
.alert { background: #fff6e0; color: #7a5600; border-radius: 16px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 14px; }

.link-card { display: flex; align-items: center; gap: 12px; }
.link-card > div { flex: 1; min-width: 0; }
.link-card > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* cifras en fila */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tiles.loose { margin-bottom: 14px; }
.tile { background: var(--bg); border-radius: 16px; padding: 12px 12px 10px; min-width: 0; }
.tiles.loose .tile { background: var(--surface); box-shadow: var(--shadow); }
.tile span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.tile b { display: block; font-family: var(--display); font-weight: 600; font-size: 19px; margin-top: 6px; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; }
.tile small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* canales */
.row-ch { padding: 12px 0; border-top: 1px solid var(--line); }
.card > p + .row-ch { border-top: 0; padding-top: 2px; }
.row-top { display: flex; justify-content: space-between; gap: 12px; font-size: 15.5px; font-variant-numeric: lining-nums tabular-nums; }
.row-sub { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); margin: 3px 0 8px; min-height: 22px; }
.share { height: 5px; border-radius: 3px; background: var(--mist); overflow: hidden; }
.share i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }

/* publicidad */
.split { margin-top: 14px; }
.split-bar { height: 10px; border-radius: 5px; background: var(--oro); overflow: hidden; }
.split-bar i { display: block; height: 100%; background: var(--ink); }
.split-key { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.split-key span { display: inline-flex; align-items: center; gap: 6px; }
.k { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.k.ads { background: var(--ink); }
.k.org { background: var(--oro); }
.mini-table { margin-top: 12px; }
.mini-table div { display: flex; flex-direction: column; gap: 1px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.mini-table b { color: var(--ink); font-size: 14px; }

/* detalle del reporte */
.section-title { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 26px 4px 8px; }
.sec { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.sec summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 15px 16px; cursor: pointer; font-weight: 600; font-size: 15px; }
.sec summary::-webkit-details-marker { display: none; }
.sec-ico { width: 26px; text-align: center; font-size: 19px; flex: none; }
.sec-title { flex: 1; min-width: 0; }
.sec-dot { width: 8px; height: 8px; border-radius: 50%; background: #e0a100; flex: none; }
.sec summary svg { width: 16px; height: 16px; color: var(--muted); flex: none; transition: transform .18s; }
.sec[open] summary svg { transform: rotate(180deg); }
.sec-body { padding: 0 16px 14px 54px; }
.sec-line { font-size: 14px; line-height: 1.45; color: var(--ink-2); margin: 0 0 7px; overflow-wrap: anywhere; }
.sec-line strong { color: var(--ink); font-weight: 600; }
.sec-line em { font-style: normal; color: var(--muted); }
.sec-line code { font: 12.5px ui-monospace, Menlo, monospace; background: var(--mist); border-radius: 5px; padding: 1px 5px; }
.sec-line.head { margin-top: 12px; font-size: 13px; letter-spacing: .02em; }
.sec-line.sub { padding-left: 12px; color: var(--muted); font-size: 13.5px; margin-top: -3px; }
.sec-line.sub2 { padding-left: 24px; color: var(--muted); font-size: 13px; margin-top: -4px; }
.sec-line.note { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.sec-line.warn { color: #7a5600; }

/* histórico */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 18px; margin: 0 -18px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 38px; padding: 0 15px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-row { margin-bottom: 14px; }
.input.slim { min-height: 44px; padding: 9px 40px 9px 14px; font-size: 15px; font-weight: 600; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f7a7e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px; }
.tabla { margin-top: 8px; font-variant-numeric: lining-nums tabular-nums; }
.tabla .th, .tabla .tr { display: grid; grid-template-columns: minmax(0, 1.5fr) 1.15fr .6fr .6fr; gap: 8px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.tabla .th { border-top: 0; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding-top: 4px; }
.tabla span:not(:first-child) { text-align: right; }
.tabla .tr span:nth-child(2) { font-weight: 600; }
.tabla .tr.off { color: #a5adb1; }

/* hoja para elegir periodo */
.pick { display: grid; gap: 6px; margin-bottom: 4px; }
.pick button { min-height: 48px; border-radius: 14px; background: var(--surface); text-align: left; padding: 0 16px; font-size: 15px; font-weight: 500; }
.pick button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 600; }

/* =====================================================================
   v1.3 — fecha límite, prioridad, "Para hoy", tareas que se repiten y automáticas
   ===================================================================== */
.seg a { gap: 6px; display: flex; align-items: center; justify-content: center; }
.seg .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.seg .count.late { background: var(--danger); }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
nav.seg { margin-bottom: 16px; }

.late-note { font-size: 12.5px; font-weight: 700; color: var(--danger); margin-top: -6px; }
.late-note.soft { color: var(--bronce); }

.task.late { box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }
.task.alta:not(.late) { box-shadow: inset 4px 0 0 var(--ink), var(--shadow); }
.task.scheduled { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.task.scheduled h3 { color: var(--ink-2); font-weight: 500; }
.task.scheduled .check { border-color: #b9c0c5; }
.chip.today { background: #fff1d6; color: #7a5600; }
.chip.alta { background: var(--ink); color: #fff; }
.chip.quiet { background: var(--mist); color: var(--muted); }
.chip.auto { background: #e5f5ef; color: #17694a; }
.chip.ico { display: inline-flex; align-items: center; gap: 4px; }
.chip.ico svg { width: 12px; height: 12px; }
.links { margin-left: auto; display: inline-flex; gap: 14px; }
.links .link { margin-left: 0; }
.block-title.late { color: var(--danger); }
.block-title.late span { background: #fbe9e7; color: var(--danger); }
.block-title.quiet { color: var(--muted); margin-top: 28px; }
.block-title.quiet span { background: var(--mist); color: var(--muted); }

select.input { cursor: pointer; }
label.field.tight { margin: 14px 0 0; }
.auto-head { display: flex; align-items: flex-start; gap: 14px; }
.auto-head > div { flex: 1; min-width: 0; }
.auto-head p { color: var(--muted); font-size: 14px; }
.switch { width: 52px; height: 32px; border-radius: 999px; background: #cfd4d8; position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* =====================================================================
   el asistente: botón lateral con la D y el chat
   ===================================================================== */
#asistente-root { position: relative; z-index: 30; }
.ai-boton { position: fixed; z-index: 6; right: max(18px, calc((100vw - 560px) / 2 + 18px)); bottom: calc(var(--safe-b) + 156px);
  display: flex; align-items: center; gap: 10px; background: none; padding: 0; }
.ai-circulo { width: 58px; height: 58px; border-radius: 50%; background: var(--noche); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 28px rgba(17, 17, 17, .32); flex: none; transition: transform .15s; }
.ai-circulo .d { width: 30px; height: 24px; }
.ai-boton:active .ai-circulo { transform: scale(.94); }
.ai-globo { position: relative; background: #fff; color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 15px;
  letter-spacing: .01em; padding: 10px 14px 8px; border-radius: 16px 16px 4px 16px; box-shadow: 0 6px 22px rgba(17, 17, 17, .16);
  white-space: nowrap; transition: opacity .25s, transform .25s; animation: ai-entra .5s .3s both cubic-bezier(.2, .8, .2, 1); }
.ai-boton.quieto .ai-globo { opacity: 0; transform: translateX(8px); }
@keyframes ai-entra { from { opacity: 0; transform: translateX(10px) scale(.96); } }
html.ai-abierto .ai-boton { display: none; }
html.ai-abierto body { overflow: hidden; }

.ai-capa { position: fixed; inset: 0; background: rgba(10, 10, 10, .38); display: flex; align-items: flex-end; justify-content: center; animation: ai-fondo .2s; }
@keyframes ai-fondo { from { background: transparent; } }
.ai-panel { width: 100%; max-width: 560px; height: calc(100dvh - var(--safe-t) - 10px); background: var(--bg); border-radius: 28px 28px 0 0;
  display: flex; flex-direction: column; overflow: hidden; animation: rise .26s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 900px) {
  .ai-capa { justify-content: flex-end; align-items: stretch; }
  .ai-panel { max-width: 430px; height: 100dvh; border-radius: 0; box-shadow: -12px 0 40px rgba(0, 0, 0, .12); animation: ai-lado .26s cubic-bezier(.2, .8, .2, 1); }
  @keyframes ai-lado { from { transform: translateX(40px); opacity: 0; } }
}
.ai-cabeza { display: flex; align-items: center; gap: 12px; padding: 16px 14px 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ai-circulo.chico { width: 40px; height: 40px; box-shadow: none; }
.ai-circulo.chico .d { width: 21px; height: 17px; }
.ai-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-titulo b { font-family: var(--display); font-weight: 600; font-size: 19px; line-height: 1.1; padding-top: 2px; }
.ai-titulo small { color: var(--muted); font-size: 12.5px; }
.ai-icono { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.ai-icono:hover { background: var(--mist); }
.ai-icono svg { width: 20px; height: 20px; }

.ai-lista { flex: 1; overflow-y: auto; padding: 18px 16px 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.ai-msg { display: flex; margin-bottom: 12px; }
.ai-msg.yo { justify-content: flex-end; }
.ai-texto { max-width: 88%; padding: 11px 14px; border-radius: 20px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-msg.yo .ai-texto { background: var(--ink); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.ai-msg.ia .ai-texto { background: var(--surface); box-shadow: var(--shadow); border-bottom-left-radius: 6px; max-width: 94%; }
.ai-msg.error .ai-texto { background: #fbe9e7; color: var(--danger); box-shadow: none; }
.ai-msg.error .link { color: var(--danger); margin: 6px 0 0; display: inline-block; }
.ai-texto p + p, .ai-texto p + ul, .ai-texto p + ol, .ai-texto ul + p, .ai-texto ol + p, .ai-texto .tabla + p, .ai-texto p + .tabla { margin-top: 8px; }
.ai-texto ul, .ai-texto ol { padding-left: 20px; }
.ai-texto li + li { margin-top: 3px; }
.ai-texto .titulo { font-weight: 700; }
.ai-texto code { font-size: 13px; background: var(--mist); border-radius: 6px; padding: 1px 5px; }
.ai-texto .tabla { overflow-x: auto; margin: 4px -4px; }
.ai-texto table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.ai-texto th, .ai-texto td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ai-texto th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ai-texto td.num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.ai-msg.pensando .ai-texto { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.ai-puntos { display: inline-flex; gap: 4px; }
.ai-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--oro-claro); animation: ai-punto 1.1s infinite ease-in-out; }
.ai-puntos i:nth-child(2) { animation-delay: .15s; }
.ai-puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-punto { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }

.ai-vacio { text-align: center; padding: 26px 8px 8px; display: flex; flex-direction: column; align-items: center; }
.ai-circulo.grande { width: 72px; height: 72px; margin-bottom: 14px; }
.ai-circulo.grande .d { width: 38px; height: 31px; }
.ai-vacio b { font-family: var(--display); font-weight: 600; font-size: 26px; }
.ai-vacio p { color: var(--muted); margin: 6px 0 18px; max-width: 340px; }
.ai-sugerencias { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ai-sugerencias button { text-align: left; background: var(--surface); box-shadow: var(--shadow); border-radius: 16px; padding: 13px 16px; font-size: 14.5px; font-weight: 500; }
.ai-sugerencias button:active { transform: scale(.99); }

.ai-form { display: flex; align-items: flex-end; gap: 8px; margin: 8px 12px 0; background: var(--surface); border-radius: 26px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); }
.ai-entrada { flex: 1; border: 0; outline: 0; resize: none; background: none; font: inherit; font-size: 16px; line-height: 1.4; padding: 9px 0; max-height: 140px; color: var(--ink); }
.ai-enviar { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.ai-enviar svg { width: 20px; height: 20px; }
.ai-enviar:disabled { opacity: .35; }
.ai-pie { color: var(--muted); font-size: 11.5px; text-align: center; padding: 8px 18px calc(var(--safe-b) + 12px); }
.ai-entrada::placeholder { color: #9aa3a7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- DJS: pedido semanal y cierre del mes ---------- */
.sec-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--oro-suave); color: var(--noche); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.sec summary .sec-count + svg { margin-left: 0; }
.sec.prov summary { align-items: flex-start; }
.prov-head { flex: 1; min-width: 0; }
.prov-head .row-sub { margin: 3px 0 8px; font-weight: 400; }
.sec.prov summary > svg { margin-top: 3px; }
.row-prod { display: flex; gap: 12px; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.sec-body .row-prod:first-child, .sec-body .fine + .row-prod { border-top: 0; }
.row-prod > div:first-child { min-width: 0; }
.row-prod b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row-prod small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.row-prod small.nota { color: var(--ink-2); }
.row-prod .num { text-align: right; flex: none; font-variant-numeric: lining-nums tabular-nums; }
.row-prod b.neg { color: var(--danger); }
a.btn { margin-bottom: 14px; }
a.btn svg { width: 20px; height: 20px; }
.sec.lista .sec-body, .sec.prov .sec-body { padding-left: 16px; }

/* ---------- En vivo: envíos de hoy y saldo de Amazon ---------- */
.vivo-estado { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 4px 14px; font-size: 13px; color: var(--muted); }
.vivo-estado .btn { flex: none; }
.vivo-estado .btn svg { width: 16px; height: 16px; }
.tile.rojo b { color: var(--danger); }
.tile.ambar b { color: #a86b00; }
.card .row-top h2 { margin: 0; }
.saldo-total { font-family: var(--display); font-size: 20px; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.card .mini-table div span { line-height: 1.35; }
