/* ============ Tokens ============ */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F6FA;
  --ink: #1E2140;
  --ink-2: #3A3E63;
  --muted: #6E7191;
  --line: #ECEEF4;
  --line-2: #DDE0EA;

  --violet: #7B61FF;
  --violet-soft: #EEEAFF;
  --coral: #FF6B6B;
  --coral-soft: #FFE9E7;
  --sun: #FFB547;
  --sun-soft: #FFF3DC;
  --mint: #14B8A6;
  --mint-soft: #DDF6F2;
  --sky: #3BA7F5;
  --sky-soft: #E1F1FE;
  --pink: #F472B6;

  --ok: #0E9F6E;
  --bad: #E5484D;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(30, 33, 64, .04), 0 8px 24px rgba(30, 33, 64, .06);
  --shadow-lg: 0 20px 60px rgba(30, 33, 64, .18);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--violet); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ============ Fondo decorativo ============ */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; }
.b1 { width: 420px; height: 420px; background: #FFD7C2; top: -140px; right: -80px; }
.b2 { width: 360px; height: 360px; background: #DCD3FF; bottom: -120px; left: -100px; }
.b3 { width: 260px; height: 260px; background: #C9F1EA; top: 40%; left: 55%; opacity: .35; }
/* En el dashboard el fondo queda blanco liso; los toques de color quedan solo en el login */
body:not(.auth-body) .sky { display: none; }
.route { position: absolute; left: 0; right: 0; top: 18%; width: 100%; height: 200px; }
.route path { stroke: var(--violet); stroke-width: 2; stroke-dasharray: 2 10; opacity: .35; fill: none; }

/* ============ Marca ============ */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--violet), var(--coral));
  box-shadow: 0 6px 16px rgba(123, 97, 255, .3);
}
.brand-mark svg { width: 20px; height: 20px; fill: #fff; stroke: none; }
.brand-lg { font-size: 20px; margin-bottom: 22px; }

/* ============ Botones y formularios ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 800; cursor: pointer;
  background: var(--surface-2); color: var(--ink); transition: transform .15s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible, .icon-btn:focus-visible, .field input:focus-visible { outline: 3px solid rgba(123, 97, 255, .35); outline-offset: 2px; }
.btn-primary { background: var(--violet); color: #fff; box-shadow: 0 8px 20px rgba(123, 97, 255, .3); }
.btn-primary:hover { background: #6C50F5; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--coral-soft); color: #D93F3F; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 11px 14px; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(123, 97, 255, .12); }
.time-pick { display: flex; align-items: center; gap: 6px; }
.time-pick select { flex: 1; text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; }
.time-pick b { color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field input[type=color] { width: 56px; height: 36px; padding: 2px; cursor: pointer; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 600; }

.segmented { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; padding: 8px 12px; border-radius: 999px; font-weight: 800; font-size: 14px;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid rgba(123, 97, 255, .35); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 2px solid var(--line); font-weight: 800; font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.chip-radio span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip-radio input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.chip-radio input:focus-visible + span { outline: 3px solid rgba(123, 97, 255, .35); }

.alert { background: var(--coral-soft); color: #B42F2F; border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 700; font-size: 14px; margin-bottom: 16px; }
.alert-ok { background: var(--mint-soft); color: #0B7A6D; }

/* ============ Login / instalación ============ */
.auth-body { display: grid; place-items: center; padding: 24px 16px; }
.auth-wrap { width: 100%; display: grid; place-items: center; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 28px; padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-card > p.muted { margin-bottom: 22px; }
.auth-card-wide { max-width: 760px; }
.checks { list-style: none; padding: 0; margin: 0 0 20px; font-weight: 700; font-size: 14px; display: grid; gap: 4px; }
.checks .ok { color: var(--ok); }
.checks .bad { color: var(--bad); }
.install-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.install-person { border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 14px 14px 0; margin: 0; }
.install-person legend { font-weight: 900; padding: 0 6px; }

/* ============ Barra superior ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .85); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.tabs { display: flex; gap: 4px; margin: 0 auto; background: var(--surface); padding: 5px; border-radius: 999px; box-shadow: var(--shadow); }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 800; transition: background .15s, color .15s;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { background: var(--ink); color: #fff; }
.tabs svg { width: 18px; height: 18px; }

.account { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; font-weight: 800; }
.avatar-btn:hover { background: var(--surface); }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--c, var(--violet)); color: #fff; font-weight: 900; font-size: 14px; flex: none;
}
.avatar-sm { width: 24px; height: 24px; font-size: 11px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 30;
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu form { margin: 0; }

/* ============ Contenedor ============ */
.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.loading { text-align: center; padding: 80px 0; color: var(--muted); font-weight: 700; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h1 { font-size: 30px; }
.section-head p { color: var(--muted); font-weight: 600; margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-title { font-size: 17px; font-weight: 900; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.grid > * { min-width: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-weight: 700; }
.empty svg { width: 40px; height: 40px; color: var(--line-2); margin-bottom: 8px; }

/* ============ Inicio ============ */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 32px; color: #fff; margin-bottom: 18px;
  background: linear-gradient(120deg, #6F55F6 0%, #A55CF0 38%, #FF6B8B 72%, #FFA25C 100%);
  box-shadow: 0 18px 40px rgba(123, 97, 255, .25);
}
.hero-inner { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.hero .eyebrow { font-weight: 800; opacity: .85; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.hero h1 { font-size: 38px; margin: 6px 0 8px; }
.hero .dates { font-weight: 700; opacity: .92; }
.count { text-align: right; }
.count-num { font-size: 72px; font-weight: 900; line-height: 1; letter-spacing: -.03em; }
.count-label { font-weight: 800; opacity: .9; }
.hero-deco { position: absolute; right: -40px; top: -60px; width: 300px; height: 300px; opacity: .16; z-index: 0; }
.hero-deco svg { width: 100%; height: 100%; stroke: #fff; stroke-width: 1.4; }
.hero-path { position: absolute; left: 0; bottom: 0; width: 100%; height: 90px; z-index: 0; opacity: .35; }
.hero-path svg { width: 100%; height: 100%; stroke: #fff; stroke-width: 2; stroke-dasharray: 2 9; }
.progress { margin-top: 18px; height: 8px; background: rgba(255, 255, 255, .25); border-radius: 999px; overflow: hidden; max-width: 360px; }
.progress span { display: block; height: 100%; background: #fff; border-radius: 999px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  overflow: hidden;
}
.stat-label { font-size: 13px; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat-label i { width: 10px; height: 10px; border-radius: 4px; background: var(--c); }
.stat-value { font-size: 26px; font-weight: 900; margin-top: 4px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; font-weight: 700; color: var(--muted); }

.upcoming { display: grid; gap: 10px; }
.up-item { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 16px; cursor: pointer; transition: background .15s; }
.up-item:hover { background: var(--surface-2); }
.up-date { width: 52px; text-align: center; border-radius: 14px; padding: 6px 0; background: var(--violet-soft); color: var(--violet); flex: none; }
.up-date b { display: block; font-size: 20px; line-height: 1.1; font-weight: 900; }
.up-date small { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.up-body { min-width: 0; }
.up-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-meta { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ============ Itinerario ============ */
.itin { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.cal { padding: 18px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-head { margin-bottom: 8px; }
.cal-head span { text-align: center; font-size: 12px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cal-day {
  position: relative; min-height: 112px; border-radius: 16px; padding: 8px; background: var(--surface-2);
  border: 2px solid transparent; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, background .15s, transform .15s; min-width: 0;
}
.cal-day:hover { background: #EEF0F6; }
.cal-day.out { background: transparent; cursor: default; opacity: .4; }
.cal-day.out:hover { background: transparent; }
.cal-day.selected { border-color: var(--violet); background: var(--surface); box-shadow: 0 6px 18px rgba(123, 97, 255, .16); }
.cal-day.today .cal-num { background: var(--coral); color: #fff; }
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 9px; font-weight: 900; font-size: 14px; }
.cal-tag { font-size: 10px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.cal-chip {
  display: block; font-size: 11.5px; font-weight: 800; padding: 3px 7px; border-radius: 8px; color: var(--ink-2);
  background: color-mix(in srgb, var(--c) 16%, white); border-left: 3px solid var(--c);
  line-height: 1.25; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cal-more { font-size: 11px; font-weight: 800; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

.day-panel { position: sticky; top: 84px; }
.day-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.day-panel-head h2 { font-size: 22px; }
.day-panel-head .muted { font-weight: 700; font-size: 13px; }
.day-nav { display: flex; gap: 4px; }
.timeline { display: grid; gap: 10px; }
.act {
  display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; border-radius: 16px;
  background: var(--surface-2); border-left: 4px solid var(--c); cursor: pointer; transition: background .15s;
}
.act:hover { background: #EEF0F6; }
.act-time { font-weight: 900; font-size: 14px; line-height: 1.25; }
.act-time small { display: block; font-weight: 700; color: var(--muted); font-size: 12px; }
.act-title { font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.act-meta { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.act-notes { font-size: 13px; color: var(--ink-2); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.price-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--mint-soft); color: #0B7A6D; font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ============ Ideas (sin confirmar) ============ */
.ideas { margin-top: 18px; background: linear-gradient(180deg, var(--sun-soft) 0, var(--surface) 140px); }
.ideas-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.ideas-title { display: inline-flex; align-items: center; gap: 8px; }
.ideas-title svg { color: #E09A1F; }
.ideas-sub { font-size: 13px; font-weight: 600; margin-top: 4px; max-width: 640px; }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.idea {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px;
  border-radius: 16px; background: var(--surface); border: 2px dashed color-mix(in srgb, var(--c) 45%, white);
  min-width: 0;
}
.idea-body { cursor: pointer; min-width: 0; }
.idea-title { font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; margin-bottom: 2px; }
.idea-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.idea-by { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 0; }
.idea-actions { display: flex; gap: 6px; margin-left: auto; }
.vote {
  display: inline-flex; align-items: center; gap: 5px; border: 2px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 5px 10px; font-weight: 800; font-size: 13px; color: var(--muted); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.vote svg { width: 16px; height: 16px; }
.vote:hover { border-color: var(--coral); color: var(--coral); }
.vote.on { border-color: var(--coral); background: var(--coral-soft); color: #D93F3F; }
.vote.on svg { fill: currentColor; }
.vote.all { border-color: var(--mint); background: var(--mint-soft); color: #0B7A6D; }
.vote:focus-visible { outline: 3px solid rgba(123, 97, 255, .35); outline-offset: 2px; }
.btn-confirm { background: var(--mint-soft); color: #0B7A6D; padding: 6px 12px; font-size: 13px; }
.btn-confirm:hover { background: var(--mint); color: #fff; }
.btn-confirm svg { width: 16px; height: 16px; }

/* ============ Datos importantes ============ */
.fact-add { margin-bottom: 18px; display: grid; gap: 12px; }
.fact-add textarea {
  width: 100%; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px; resize: vertical; min-height: 64px;
}
.fact-add textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(123, 97, 255, .12); }
.fact-add-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lvl-filter { display: inline-flex; align-items: center; gap: 6px; }
.lvl-filter i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fact {
  display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px;
  border-radius: 14px; border-left: 5px solid var(--c); background: color-mix(in srgb, var(--c) 7%, white);
  cursor: pointer; transition: background .15s;
}
.fact:hover { background: color-mix(in srgb, var(--c) 13%, white); }
.fact:focus-visible { outline: 3px solid rgba(123, 97, 255, .35); outline-offset: 2px; }
.fact-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); margin-top: 3px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, white); }
.fact-text { font-weight: 700; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.fact-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.fact-level { color: var(--c); font-weight: 900; margin-right: 4px; filter: brightness(.85); }
.home-facts { margin-bottom: 18px; border-top: 4px solid #E5484D; }

/* ============ Imágenes ============ */
.ext-img.broken { display: none; }
.act-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--line); cursor: zoom-in; }
.idea-img { width: calc(100% + 28px); margin: -14px -14px 0; height: 150px; object-fit: cover; border-radius: 14px 14px 0 0; background: var(--line); cursor: zoom-in; display: block; }
.zoom-img { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 16px; background: var(--surface-2); }

.img-pick { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; align-items: start; }
.img-current { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 2px solid var(--line); }
.img-current img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.img-empty svg { width: 28px; height: 28px; color: var(--line-2); }
.img-side { min-width: 0; display: grid; gap: 8px; }
.img-sugs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; min-height: 64px; align-content: start; }
.img-sugs .hint { grid-column: 1 / -1; }
.img-sug { padding: 0; border: 3px solid transparent; border-radius: 12px; overflow: hidden; aspect-ratio: 1; cursor: pointer; background: var(--surface-2); }
.img-sug img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-sug:hover { border-color: var(--line-2); }
.img-sug.on { border-color: var(--violet); }
.img-sug:focus-visible { outline: 3px solid rgba(123, 97, 255, .35); outline-offset: 1px; }
.img-tools { display: flex; gap: 6px; align-items: center; }
.img-tools input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13px; }
.img-tools input:focus { outline: none; border-color: var(--violet); }

@media (max-width: 720px) {
  .img-pick { grid-template-columns: 96px minmax(0, 1fr); }
  .act-img { width: 52px; height: 52px; }
}

/* ============ Presupuesto ============ */
.people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.budget-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; align-items: stretch; }
.budget-top .stat { display: flex; flex-direction: column; justify-content: center; }
.budget-top .stat-value { font-size: 32px; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border-top: 5px solid var(--c); }
.person-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 900; }
.person-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--muted); padding: 3px 0; }
.person-row b { color: var(--ink); }
.balance { margin-top: 10px; padding: 8px 10px; border-radius: 12px; font-weight: 900; font-size: 14px; text-align: center; }
.balance.pos { background: var(--mint-soft); color: #0B7A6D; }
.balance.neg { background: var(--coral-soft); color: #C13838; }
.balance.zero { background: var(--surface-2); color: var(--muted); }

.settle { display: grid; gap: 8px; }
.settle-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-weight: 700; flex-wrap: wrap; }
.settle-item .arrow { color: var(--muted); }
.settle-item .amt { margin-left: auto; font-weight: 900; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; font-weight: 800; }
.bar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.bar-row .num { text-align: right; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 0; background: var(--surface-2); border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 13px; color: var(--muted); cursor: pointer; }
.filters button.active { background: var(--ink); color: #fff; }

.exp-list { display: grid; gap: 8px; }
.exp {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px;
  border-radius: 16px; cursor: pointer; transition: background .15s;
}
.exp:hover { background: var(--surface-2); }
.exp-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, white); color: var(--c); }
.exp-icon svg { width: 22px; height: 22px; }
.exp-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-meta { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.exp-amt { text-align: right; font-weight: 900; font-size: 16px; white-space: nowrap; }
.exp-amt small { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.pill-group { background: var(--violet-soft); color: var(--violet); }
.pill-ind { background: var(--sun-soft); color: #B7791F; }
.pill-paid { background: var(--mint-soft); color: #0B7A6D; }
.pill-pending { background: var(--coral-soft); color: #C13838; }
.exp-pending .exp-amt { color: var(--muted); }
.seg-status input[value=paid]:checked + span { background: var(--mint); color: #fff; }
.seg-status input[value=pending]:checked + span { background: var(--coral); color: #fff; }
#kindHint { margin-top: 6px; }
.who { display: inline-flex; align-items: center; gap: 5px; }
.who i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30, 33, 64, .38); backdrop-filter: blur(3px); animation: fade .2s; }
.modal-card {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border-radius: 26px; padding: 24px; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { font-size: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; }
.modal-actions .right { display: flex; gap: 10px; margin-left: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow-lg);
  animation: pop .2s; max-width: calc(100vw - 32px);
}
.toast.error { background: var(--bad); }

/* ============ Responsive ============ */
@media (max-width: 1000px) {
  .itin { grid-template-columns: 1fr; }
  .day-panel { position: static; }
  .stats, .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .budget-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .budget-top .person { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255, 255, 255, .97); }
  .topbar-inner { padding: 10px 16px; }
  .account-name { display: none; }
  .tabs {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
    justify-content: space-around; box-shadow: var(--shadow-lg);
  }
  .tabs a { flex: 1; flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 11px; justify-content: center; }
  .tabs svg { width: 20px; height: 20px; }
  .container { padding: 18px 16px 120px; }
  .section-head h1 { font-size: 24px; }
  .hero { padding: 24px 20px; border-radius: 24px; }
  .hero h1 { font-size: 28px; }
  .count { text-align: left; }
  .count-num { font-size: 56px; }
  .hero-deco { width: 200px; height: 200px; right: -50px; top: -40px; }
  .card { padding: 16px; border-radius: 20px; }
  .stat-value { font-size: 19px; }
  .budget-top .stat-value { font-size: 21px; }
  .people { grid-template-columns: minmax(0, 1fr); }
  .filters { width: 100%; }
  .cal { padding: 12px; }
  .cal-head, .cal-grid { gap: 4px; }
  .cal-head span { font-size: 10px; letter-spacing: 0; }
  .cal-day { min-height: 62px; padding: 5px; border-radius: 12px; align-items: center; }
  .cal-top { flex-direction: column; gap: 0; }
  .cal-tag, .cal-chip, .cal-more { display: none; }
  .cal-dots { display: flex; justify-content: center; }
  .modal { place-items: end center; padding: 0; }
  .modal-card { max-width: none; border-radius: 26px 26px 0 0; max-height: 92vh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .row { grid-template-columns: 1fr; gap: 0; }
  .bar-row { grid-template-columns: 84px 1fr 72px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .stats { gap: 10px; }
  .stat, .person { padding: 14px; }
  .exp { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 10px 6px; }
  .exp-icon { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
