/* CareMargin V2 · estilo limpio (inspirado en Gemini/ChatGPT de escritorio).
   Solo lo carga la web de los médicos (index.html); la consola /admin sigue con styles.css tal cual.
   Se apoya en las variables de styles.css: aquí se redefinen y se modernizan los componentes. */

/* ── Tokens ─────────────────────────────────────────────── */
:root {                                  /* Oscuro (noche) */
  --bg: #0E1525; --bg1: #121A2C; --bg2: #172036; --bg3: #1C2740;
  --glass: #151D30; --glass2: #1B2438;
  --border: rgba(160, 180, 215, .14); --border2: rgba(160, 180, 215, .24); --border3: rgba(160, 180, 215, .40);
  --cyan: #7CB8F0; --cyan2: #A9D1F6; --violet: #B79CF2; --violet2: #D2C2F8;
  --green: #6FD39A; --red: #F2788C; --yellow: #F0C66E; --orange: #F29A6B;
  --white: #EEF2F8; --text: #D3DBE8; --muted: #9AA7BD; --dim: #5D6A82;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 18px; --r-lg: 26px; --pill: 999px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .18);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, .30);
  --header-bg: rgba(14, 21, 37, .92); --header-bg-solid: #0E1525;
  --toast-bg: rgba(20, 28, 46, .97);
  --accent: #7CB8F0; --accent-ink: #0E1525;
  --ok-bg: rgba(111, 211, 154, .12); --ok-ink: #A7E3C0;
  --stars: 0;
}
:root[data-theme="light"] {              /* Claro (día), el predeterminado */
  --bg: #F7F9FC; --bg1: #FFFFFF; --bg2: #F1F4F9; --bg3: #E9EEF6;
  --glass: #FFFFFF; --glass2: #F1F4F9;
  --border: #E3E8F0; --border2: #D3DCE8; --border3: #B9C6D8;
  --cyan: #0F4C81; --cyan2: #0B3A63; --violet: #5B3FB0; --violet2: #4A3196;
  --green: #2F7A4C; --red: #B4233A; --yellow: #8A5A00; --orange: #A6401B;
  --white: #14213D; --text: #2A3650; --muted: #5B6577; --dim: #8592A8;
  --shadow: 0 1px 2px rgba(20, 33, 61, .04), 0 8px 24px rgba(20, 33, 61, .06);
  --shadow-lg: 0 10px 34px rgba(20, 33, 61, .08);
  --header-bg: rgba(255, 255, 255, .94); --header-bg-solid: #FFFFFF;
  --toast-bg: rgba(20, 33, 61, .96);
  --accent: #0F4C81; --accent-ink: #FFFFFF;
  --ok-bg: #E8F3EC; --ok-ink: #2F5E3B;
}
:root[data-theme="light"][data-tone="warm"] {   /* Hueso (intermedio): cálido y mate para muchas horas */
  --bg: #F4F0E8; --bg1: #FBF9F4; --bg2: #EDE7DC; --bg3: #E5DED1;
  --glass: #FBF9F4; --glass2: #F0EBE1;
  --border: #E2DACB; --border2: #D3C9B6; --border3: #B8AC95;
  --cyan: #1E5A7E; --cyan2: #164662;
  --white: #2A241C; --text: #3B342B; --muted: #6A6052;
  --accent: #1E5A7E; --accent-ink: #FFFFFF;
  --shadow: 0 1px 2px rgba(60, 50, 35, .05), 0 8px 24px rgba(60, 50, 35, .06);
}

/* ── Base ───────────────────────────────────────────────── */
body { font-family: var(--sans); font-size: 15px; line-height: 1.55; background: var(--bg); color: var(--white); }
body::before { display: none; }
::selection { background: rgba(15, 76, 129, .18); }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 18px; font-weight: 600; }
.small { font-size: 13px; }
.mono, .code-tag { font-family: var(--mono); }

/* ── Tarjetas, botones, campos ─────────────────────────── */
.card { background: var(--glass); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.card::before { display: none; }
.card-title { font-family: var(--sans); font-size: 15px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--white); margin-bottom: 14px; }
.card-title .line { background: transparent; }
.card-title .aside { font-size: 13px; letter-spacing: 0; color: var(--muted); }
.btn { font-family: var(--sans); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; border-radius: var(--pill); padding: 9px 16px; border: 1px solid var(--border2); background: var(--glass); color: var(--white); }
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--glass); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary, .run-btn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--cyan2); color: var(--accent-ink); }
.run-btn { font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; border-radius: var(--pill); padding: 13px 20px; box-shadow: none; }
.run-btn:hover:not(:disabled) { filter: none; background: var(--cyan2); transform: none; box-shadow: none; }
input, textarea, select { font-family: var(--sans); font-size: 15px; border-radius: 14px; border: 1px solid var(--border2); background: var(--glass); color: var(--white); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 76, 129, .14); }
label { font-family: var(--sans); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--white); font-weight: 500; }
.field label .hint, .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.badge { font-family: var(--sans); font-size: 12px; letter-spacing: 0; text-transform: none; border-radius: var(--pill); padding: 3px 10px; }
.seg { border-radius: var(--pill); padding: 3px; background: var(--glass2); border: 1px solid var(--border); }
.seg button { border-radius: var(--pill); font-family: var(--sans); font-size: 13px; letter-spacing: 0; text-transform: none; }
.seg button.on { background: var(--glass); color: var(--accent); box-shadow: var(--shadow); }
.notice { border-radius: 16px; }
.dropzone { border-radius: var(--r-lg); }
.tabs a { font-family: var(--sans); letter-spacing: 0; text-transform: none; font-size: 14px; }
.m-tile { border-radius: 20px; box-shadow: var(--shadow); }
.m-label { font-family: var(--sans); letter-spacing: 0; text-transform: none; font-size: 13px; }
#toast { border-radius: 16px; font-family: var(--sans); }
dialog { border-radius: var(--r-lg); }

/* ── Barra lateral (sustituye a la cabecera) ───────────── */
.rail { position: fixed; inset: 0 auto 0 0; z-index: 120; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: calc(16px + env(safe-area-inset-top)) 0 16px; background: var(--bg1); border-right: 1px solid var(--border); }
.rail-logo { display: flex; width: 44px; height: 44px; align-items: center; justify-content: center; margin-bottom: 12px; }
.rail-logo .logo-mark { width: 36px; height: 36px; }
/* Logo girado 45° (origen en la base, red abierta hacia arriba): misma red a escala 0,81, trazo proporcional */
.logo-mark .lm-links line { stroke-width: 2.12; }
.rail-logo .logo-mark { width: 40px; height: 40px; }
.rail-btn { position: relative; display: flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 14px;
  color: var(--text); background: transparent; border: 0; cursor: pointer; font-size: 18px; }
.rail-btn:hover, .rail-btn:focus-visible { background: var(--bg3); color: var(--accent); }
.rail-btn.active { background: var(--bg3); color: var(--accent); }
.rail-btn[data-tip]:hover::after, .rail-btn[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; left: 54px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; background: #14213D; color: #FFFFFF; font: 500 12.5px var(--sans); padding: 6px 10px; border-radius: 8px; pointer-events: none; z-index: 5; }
.rail-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--logo-margin); }
.rail-grow { flex: 1 1 auto; }
.rail .theme-btn { width: 44px; height: 44px; border: 0; background: transparent; color: var(--text); }
.rail-avatar { display: flex; width: 36px; height: 36px; margin-top: 8px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 600; align-items: center; justify-content: center; }
.rail-avatar:hover { color: var(--accent-ink); filter: brightness(1.1); }
body.has-rail .body { margin-left: 72px; max-width: none; padding: 24px 32px; }
body.has-rail .body > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
body.has-rail .body > .home { max-width: none; }
body.has-rail .body > .soon { max-width: 680px; margin-top: 10vh; }

/* Panel lateral deslizante: Mis casos */
.side-panel { position: fixed; top: 0; bottom: 0; left: 72px; z-index: 110; width: 320px; display: flex; flex-direction: column; gap: 12px;
  padding: calc(20px + env(safe-area-inset-top)) 14px 16px; background: var(--bg1); border-right: 1px solid var(--border); box-shadow: 10px 0 30px rgba(20, 33, 61, .08);
  animation: slideIn .18s ease both; }
@keyframes slideIn { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sp-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.sp-head h2 { font-size: 17px; }
.sp-search { height: 40px; padding: 0 14px; border-radius: var(--pill); background: var(--bg); }
.sp-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-filters button { font: 500 12.5px var(--sans); padding: 6px 11px; border-radius: var(--pill); border: 0; background: var(--glass2); color: var(--text); cursor: pointer; }
.sp-filters button.on { background: var(--accent); color: var(--accent-ink); }
.sp-list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.sp-group { margin: 10px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sp-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; color: var(--white); }
.sp-row:hover, .sp-row.on { background: var(--bg2); color: var(--white); }
.sp-row .t { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row .m { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-foot { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 20px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; }
.sp-all { font-size: 13px; font-weight: 500; padding: 4px 6px; }

/* ── Inicio de Médicos (estilo Gemini) ─────────────────── */
.home { display: flex; flex-direction: column; align-items: center; min-height: calc(100vh - 48px); }
.home-inner { width: 100%; max-width: 820px; display: flex; flex-direction: column; gap: 20px; padding-top: 14vh; }
.home-hello { margin: 0; font-size: 18px; color: var(--muted); }
.home-title { margin: 0; font-size: 40px; font-weight: 600; letter-spacing: -.02em; color: var(--white); }
.img-box { display: flex; align-items: center; gap: 20px; padding: 24px 26px; border: 1.5px dashed var(--border3); border-radius: var(--r-lg);
  background: var(--glass); color: var(--white); cursor: pointer; text-align: left; font: inherit; width: 100%; }
.img-box:hover, .img-box.drag { border-color: var(--accent); background: var(--bg1); }
.img-box .ico { display: flex; flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--bg3); color: var(--accent); align-items: center; justify-content: center; }
.img-box .t { font-size: 17px; font-weight: 600; }
.img-box .s { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--green); }
.img-box .opts { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.img-box .opt { font: 500 13px var(--sans); padding: 8px 12px; border-radius: var(--pill); background: var(--glass2); color: var(--text); border: 0; cursor: pointer; }
.img-box .opt.svs { background: rgba(232, 100, 60, .12); color: var(--orange); }
.img-box .opt:hover { color: var(--accent); }
.attach-row { display: flex; flex-wrap: wrap; gap: 10px; }
.attach { position: relative; width: 96px; height: 72px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--bg2); }
.attach img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; transition: transform .15s; }
.attach img:hover { transform: scale(1.05); }
.attach .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(20, 33, 61, .75); color: #fff; font-size: 12px; cursor: pointer; }
.attach .ok { position: absolute; left: 4px; bottom: 4px; font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: var(--pill); background: rgba(255, 255, 255, .94); color: #2F5E3B; }
.attach.doc, .attach.slide { display: flex; flex-direction: column; justify-content: center; padding: 8px 10px; width: auto; min-width: 150px; max-width: 240px; gap: 2px; }
.attach.doc .n, .attach.slide .n { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 22px; }
.attach.doc .k, .attach.slide .k { font-size: 11.5px; color: var(--muted); }
#stForm.composer, .home .composer { display: flex; grid-template-columns: none; align-items: stretch; flex-direction: column; gap: 10px; padding: 14px 14px 12px 22px; border: 1px solid var(--border2); border-radius: 30px; background: var(--glass); box-shadow: var(--shadow-lg); }
.composer:focus-within { border-color: var(--accent); }
.composer textarea { border: 0; outline: none; box-shadow: none; resize: none; padding: 8px 0 0; background: transparent; font-size: 16px; line-height: 1.5; min-height: 56px; max-height: 40vh; }
.composer textarea:focus { box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.c-btn { display: flex; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border2); background: var(--glass); color: var(--text); align-items: center; justify-content: center; cursor: pointer; }
.c-btn:hover { border-color: var(--accent); color: var(--accent); }
.c-btn.ghost { border-color: transparent; }
.c-btn.rec { color: var(--red); border-color: var(--red); }
.c-send { width: 44px; height: 44px; border: 0; background: var(--accent); color: var(--accent-ink); }
.c-send:hover { background: var(--cyan2); color: var(--accent-ink); }
.c-send:disabled { opacity: .45; cursor: default; }
.c-chip { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 14px; border-radius: var(--pill); border: 1px solid var(--border2); background: var(--glass); color: var(--text); font: 500 14px var(--sans); }
.c-chip select { border: 0; background: transparent; padding: 0 6px 0 0; height: 36px; font: 500 14px var(--sans); color: var(--text); max-width: 230px; box-shadow: none; }
.c-chip select:focus { box-shadow: none; }
.home-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 0 8px; font-size: 13px; color: var(--muted); }
.home-more { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; font-size: 13px; }

/* ── Entrar y crear cuenta ─────────────────────────────── */
/* Logo y nombre juntos, en una línea (el logo a la izquierda, pegado a CareMargin); los lemas, debajo */
.auth .hero { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; column-gap: 0; row-gap: 6px; }
.auth .hero .logo-mark { width: 66px; height: 66px; margin: 0 3px 0 0; grid-row: 1; grid-column: 1; justify-self: end; }
.auth .hero .brand { grid-row: 1; grid-column: 2; margin: 0; justify-self: start; text-align: left; }
.auth .hero > :not(.logo-mark):not(.brand) { grid-column: 1 / -1; }
.auth .hero .tag { font-family: var(--sans); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.auth .hero .tag2 { font-size: 19px; font-weight: 600; color: var(--white); margin-top: -2px; }
.auth .card { border-radius: 28px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth .card-title { font-size: 18px; }
.student-check { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--border2); background: var(--bg); cursor: pointer; font-weight: 500; }
.student-check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ── Estudiantes: muy pronto ───────────────────────────── */
.soon { max-width: 680px; margin: 10vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.soon .tag { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 6px 14px; border-radius: var(--pill); background: rgba(232, 100, 60, .12); color: var(--orange); }
.soon h1 { font-size: 36px; }
.soon p { font-size: 17px; color: var(--text); }
.soon-grid { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; text-align: left; }
.soon-grid > div { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 22px; background: var(--glass); border: 1px solid var(--border); box-shadow: var(--shadow); }
.soon-grid strong { font-size: 15px; }
.soon-grid span { font-size: 14px; color: var(--muted); }

/* ── Recorte de captura ───────────────────────────────── */
.crop-dialog { margin: auto; width: min(1200px, 94vw); max-height: 94vh; padding: 18px; border: 0; border-radius: 22px; background: var(--bg); color: var(--text); box-shadow: var(--shadow-lg); }
.crop-dialog::backdrop { background: rgba(10, 16, 30, .6); }
.crop-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.crop-stage { position: relative; display: flex; justify-content: center; background: #0d1220; border-radius: 14px; padding: 8px; }
.crop-cv { max-width: 100%; max-height: 68vh; cursor: crosshair; touch-action: none; display: block; }
.crop-sel { position: absolute; border: 2px solid #39C0E0; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); pointer-events: none; }
.crop-stage { overflow: hidden; }
.crop-foot { margin-top: 12px; gap: 8px; }

/* Firma del Agente de CareMargin en el resumen de coincidencias */
.agent-sign { margin: -6px 0 10px; font-size: 12.5px; font-weight: 600; color: var(--accent); letter-spacing: .01em; }
.agent-sign::before { content: "◆ "; }

/* Columna Colegas vacía: invitar a la vista */
.invite-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.invite-empty .link-btn { font-size: inherit; }
.card.flash { box-shadow: 0 0 0 3px var(--accent); transition: box-shadow .3s; }
/* Gestión del caso: que se vea como un botón, no como un pie de página */
.manage-wrap > summary { font: 600 16px var(--sans); text-transform: none; letter-spacing: 0; list-style: none; color: var(--accent); padding: 14px 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--glass); cursor: pointer; }

.manage-links { display: block; margin-top: 4px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.manage-links .link-btn { font-weight: 500; font-size: inherit; }
.manage-links .link-btn:hover { text-decoration: underline; }

.slides-hint { margin: -4px 0 12px; font-size: 14px; font-style: italic; color: var(--muted); }

/* Marca y patentes */
.wm .tm { font-size: .32em; font-weight: 600; vertical-align: super; margin-left: 1px; color: var(--muted); letter-spacing: 0; }
.brand-foot { margin: 22px auto 6px; text-align: center; font-size: 11.5px; color: var(--muted); opacity: .85; }

/* ── Planes ───────────────────────────────────────────── */
.meter { height: 6px; border-radius: var(--pill); background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: var(--pill); background: var(--accent); }
.sp-foot .meter { margin: 8px 0 6px; }
body.has-rail .body > .plans { max-width: 1040px; }
.plans { display: flex; flex-direction: column; gap: 20px; padding-top: 3vh; }
.plans-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.plans-head h1 { font-size: 36px; letter-spacing: -.02em; }
.plans-seg { display: inline-flex; border-radius: var(--pill); padding: 4px; gap: 4px; background: var(--glass); }
.plans-seg button { border: 0; border-radius: var(--pill); padding: 8px 16px; font: 500 14px var(--sans); letter-spacing: 0; text-transform: none; color: var(--text); }
.plans-seg button.on { background: var(--accent); color: var(--accent-ink); }
.plan-usage { padding: 16px 18px; border-radius: 22px; background: var(--glass); border: 1px solid var(--border); }
.plan-usage .meter { margin-top: 10px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: 26px; background: var(--glass); border: 1px solid var(--border); box-shadow: var(--shadow); }
.plan-card.featured { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.plan-card.current { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-card h2 { font-size: 22px; }
.plan-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; flex: 1 1 auto; }
.plan-card .btn { justify-content: center; }
.plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.plan-price strong { font-size: 34px; letter-spacing: -.02em; }
.plan-price s { color: var(--muted); }
.plan-price span { width: 100%; font-size: 13px; color: var(--muted); }
.plan-card .founder-tag { font: 600 12px var(--sans); letter-spacing: 0; text-transform: none; padding: 5px 11px; border-radius: var(--pill); background: rgba(232, 100, 60, .14); color: #A6401B; opacity: 1; }
:root[data-theme="dark"] .plan-card .founder-tag { color: #F4A98C; }
.plan-waiver { padding: 12px 16px; border-radius: 18px; border: 1px solid var(--border2); background: var(--glass); font-size: 14px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

.plan-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.plan-strip-head h2 { font-size: 20px; }
.plans-cta { font-size: 15px; padding: 10px 20px; box-shadow: 0 6px 18px rgba(15, 76, 129, .25); }
.plan-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-mini { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-decoration: none; }
.plan-mini:hover { border-color: var(--accent); color: var(--text); }
.plan-mini.current { border: 2px solid var(--accent); }
.pm-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 16px; }
.pm-cur { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); }
.pm-price { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.pm-line { font-size: 13px; color: var(--muted); }
.plan-strip-use { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; font-size: 14px; }
.rail-avatar.active { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── Móvil: la barra pasa abajo ────────────────────────── */
@media (max-width: 720px) {
  .rail { inset: auto 0 0 0; width: auto; height: calc(62px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); }
  .rail-logo, .rail-grow, .rail [data-nav="help"], .rail .theme-btn { display: none; }
  .rail-btn[data-tip]:hover::after { display: none; }
  .rail-avatar { margin-top: 0; }
  body.has-rail .body { margin-left: 0; padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); }
  .side-panel { left: 0; right: 0; width: auto; bottom: calc(62px + env(safe-area-inset-bottom)); }
  .home-inner { padding-top: 6vh; }
  .home-title { font-size: 30px; }
  .img-box { flex-wrap: wrap; padding: 18px; }
  .soon-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-strip { grid-template-columns: 1fr; }
  .plans-head h1 { font-size: 30px; }
  .composer-bar { flex-wrap: nowrap; }
  .composer-bar .c-chip { flex: 1 1 0; min-width: 0; }
  .composer-bar .c-chip select { width: 100%; min-width: 0; text-overflow: ellipsis; }
  .composer-bar > span { display: none; }
}

/* ── Modo rápido (móvil): foto → pregunta → resumen del Agente ── */
.quick-cta { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--glass); color: var(--text); text-decoration: none; }
.quick-cta > svg { flex: none; color: var(--accent); }
.quick-cta > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.quick-cta .small { color: var(--muted); }
.quick-cta > span:last-child { font-size: 26px; color: var(--muted); }
.quick-cta:hover { border-color: var(--accent); }
.quick { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100dvh - 32px); }
.q-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 0 10px;
  background: var(--bg); border-bottom: 1px solid var(--border); }
.q-x { display: flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 50%; color: var(--text); text-decoration: none; font-size: 18px; }
.q-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.q-ttl strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-feed { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 16px 0; }
.q-empty { text-align: center; padding: 8vh 8px 0; }
.q-empty .logo-mark { display: block; width: 64px; height: 64px; margin: 0 auto; }
.q-empty h1 { font-size: 26px; margin: 12px 0 8px; }
.q-round { display: flex; flex-direction: column; gap: 10px; }
.q-me { align-self: flex-end; max-width: 88%; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.q-me p { margin: 0; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: var(--accent); color: var(--accent-ink); white-space: pre-wrap; }
.q-thumbs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.q-thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); cursor: zoom-in; }
.q-round .consensus { margin: 0; }
.q-ans { border: 1px solid var(--border); border-radius: 16px; background: var(--bg1); padding: 10px 14px; }
.q-ans summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.q-ans .casetext { margin-top: 8px; }
.q-ans.live summary { font-weight: 500; color: var(--muted); }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.q-bar { position: sticky; bottom: 0; z-index: 5; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.q-pend { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.q-pend .attach { flex: none; }
.q-crop { position: absolute; left: 4px; bottom: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .94); color: #14213D; cursor: pointer; }
.q-row { display: flex; align-items: flex-end; gap: 8px; }
.q-cam { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.q-row textarea { flex: 1; min-height: 44px; resize: none; border-radius: 22px; padding: 11px 16px; font: inherit; border: 1px solid var(--border2); background: var(--bg1); color: var(--text); }
.q-note { margin-top: 6px; display: flex; gap: 6px; align-items: center; }
@media (max-width: 720px) {
  .quick { min-height: 100dvh; }
}
.q-anon { display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 8px); white-space: nowrap; overflow: hidden; }
.q-anon .spinner { width: 10px; height: 10px; }
.q-pend .attach { width: 112px; height: 96px; }
.q-pend .q-crop { bottom: auto; top: 4px; }


/* ── Visor de imágenes V2: miniaturas · imagen · «Revisa y comenta», cuerpo translúcido y redondeado ── */
dialog.viewer { inset: 12px; width: auto; height: auto; max-width: none; max-height: none; margin: 0;
  border: 1px solid var(--border2); border-radius: 22px; overflow: hidden; color: var(--text);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  box-shadow: var(--shadow-lg); display: grid; gap: 10px; padding: 10px;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "bar" "stage" "cap"; }
/* El desenfoque va en ::backdrop y no en el visor: un backdrop-filter en un antecesor de la imagen hace que el
   navegador la rasterice a baja resolución y el zoom se ve borroso. */
dialog.viewer::backdrop { background: rgba(8, 12, 22, .40); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); }
dialog.viewer.with-thumbs { grid-template-columns: 118px minmax(0, 1fr); grid-template-areas: "thumbs bar" "thumbs stage" "thumbs cap"; }
dialog.viewer.with-notes { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "bar notes" "stage notes" "cap notes"; }
dialog.viewer.with-thumbs.with-notes { grid-template-columns: 118px minmax(0, 1fr) 340px; grid-template-areas: "thumbs bar notes" "thumbs stage notes" "thumbs cap notes"; }
dialog.viewer .vw-bar { grid-area: bar; justify-content: flex-start; padding: 6px 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg1); }
dialog.viewer .vw-grow { flex: 1; }
dialog.viewer .vw-btn { min-width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border2); background: var(--bg2); color: var(--white); font-size: 15px; }
dialog.viewer .vw-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
dialog.viewer .vw-btn.vw-txt { font: 600 12px/1 var(--sans); letter-spacing: .02em; text-transform: none; }
dialog.viewer .vw-zoom, dialog.viewer .vw-count { color: var(--muted); font: 600 13px/1 var(--sans); min-width: 54px; }
dialog.viewer .vw-sep { background: var(--border2); }
dialog.viewer .vw-stage { grid-area: stage; border-radius: 16px; border: 1px solid var(--border); background: var(--bg2); }
:root[data-theme="dark"] dialog.viewer .vw-stage { background: #0A0F1A; }
dialog.viewer .vw-caption { grid-area: cap; padding: 0 6px; background: none; color: var(--muted); text-align: left; }
.vw-thumbs { grid-area: thumbs; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px; }
.vw-thumb { flex: none; width: 100%; aspect-ratio: 1; padding: 0; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: var(--bg2); cursor: pointer; }
.vw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; border-radius: 0; }
.vw-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.vw-thumb:hover:not(.on) { border-color: var(--border3); }
/* Panel «Revisa y comenta» */
.vw-notes { grid-area: notes; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--bg1); color: var(--text); overflow: hidden; }
.vw-notes-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 14px 16px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--white); font: inherit; text-align: left; cursor: default; }
.vw-notes-n { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: 12px; text-align: center; }
.vw-notes-n:empty { display: none; }
.vw-notes-chev { margin-left: auto; display: none; }
.vw-notes-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vw-notes-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.vw-notes-empty { color: var(--muted); font-size: 14px; margin: 0; }
.vw-note { max-width: 92%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--bg2); }
.vw-note.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: color-mix(in srgb, var(--accent) 14%, var(--bg1)); }
.vw-note-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.vw-note-del { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.vw-note-del:hover { color: var(--red); }
.vw-note-body { white-space: pre-wrap; margin-top: 3px; font-size: 14.5px; line-height: 1.45; color: var(--white); }
.vw-note-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 4px; border-top: 1px solid var(--border); }
.vw-note-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 30vh; border-radius: 16px; padding: 10px 12px; font: inherit; font-size: 15px; background: var(--bg2); color: var(--white); border: 1px solid var(--border2); }
.vw-note-act { display: flex; gap: 6px; }
.vw-notes-foot { margin: 0; padding: 4px 14px 12px; font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  dialog.viewer, dialog.viewer.with-thumbs, dialog.viewer.with-notes, dialog.viewer.with-thumbs.with-notes {
    inset: 0; border-radius: 0; border: 0; padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom)); gap: 8px;
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto auto; grid-template-areas: "bar" "stage" "thumbs" "notes" "cap"; }
  dialog.viewer .vw-bar { flex-wrap: nowrap; overflow-x: auto; }
  dialog.viewer .vw-sep, dialog.viewer [data-vw="one"], dialog.viewer [data-vw="fit"], dialog.viewer .vw-zoom { display: none; }
  dialog.viewer .vw-bar { gap: 6px; }
  dialog.viewer .vw-btn { min-width: 40px; height: 40px; padding: 0 8px; }
  .vw-thumbs { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .vw-thumb { width: 64px; }
  .vw-notes { max-height: 46dvh; }
  .vw-notes-h { padding: 10px 14px; cursor: pointer; }
  .vw-notes-chev { display: inline; }
  .vw-notes.closed .vw-notes-body { display: none; }
  .vw-notes.closed .vw-notes-chev { transform: rotate(-90deg); }
}
/* Ojo de la contraseña */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--accent); }
dialog.viewer :focus:not(:focus-visible) { outline: none; }

/* ── Respuesta CareMargin ── */
.cm-answer .card-title { align-items: center; }
.cm-answer-ttl { font-size: 17px; font-weight: 700; color: var(--white); letter-spacing: -.01em; }
.cm-answer.c-green { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.cm-answer.c-warn { border-color: color-mix(in srgb, var(--yellow) 45%, var(--border)); }
.cm-answer.c-red { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.cm-answer-body { font-size: 15.5px; line-height: 1.55; margin: 6px 0 4px; }
.cm-resolve { margin: 10px 0 2px; padding: 10px 12px; border-radius: 12px; background: var(--bg2); border-left: 3px solid var(--yellow); font-size: 14.5px; }
.cm-answer.c-red .cm-resolve { border-left-color: var(--red); }
.cm-answer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.cm-fb { display: inline-flex; align-items: center; gap: 4px; }
.cm-fb-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border2); background: var(--bg2); cursor: pointer; font-size: 16px; filter: grayscale(.6); opacity: .8; }
.cm-fb-btn:hover { opacity: 1; filter: none; }
.cm-fb-btn.on { filter: none; opacity: 1; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg1)); }
.cm-legal { margin-top: 8px; }
.who-tag { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: none; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); opacity: .8; }
.join-card .join-h { font-size: 21px; line-height: 1.3; margin: 0 0 4px; }
.join-card .join-who { color: var(--accent, inherit); }
.join-card .join-spec { margin: 0 0 12px; }
.join-form { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 12px; }
.join-form input:not([type=checkbox]) { width: 100%; }
.join-form .run-btn { margin-top: 6px; }
.join-alt { margin-top: 8px; }
.q-light { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; margin: 0 0 8px; padding: 8px 10px 8px 12px;
  border-radius: 12px; font-size: 13.5px; line-height: 1.4; background: var(--bg2); border: 1px solid var(--border); }
.q-light.c-green { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.q-light.c-warn { border-color: color-mix(in srgb, var(--yellow) 55%, var(--border)); background: color-mix(in srgb, var(--yellow) 10%, var(--bg1)); }
.q-light.c-red { border-color: color-mix(in srgb, var(--red) 55%, var(--border)); background: color-mix(in srgb, var(--red) 9%, var(--bg1)); }
.q-light-msg { flex: 1 1 180px; }
.q-light .btn { flex: none; }
.cm-protect { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 12px; padding: 9px 12px; border-radius: 12px;
  background: var(--ok-bg); color: var(--ok-ink); font-size: 13px; line-height: 1.45; }
.cm-protect-h { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.cm-protect-h svg { flex: none; }
.cm-protect-i { opacity: .92; }
@media (min-width: 721px) {
  .workspace.ai-folded { grid-template-columns: minmax(0, 1fr); }
  .workspace.ai-folded .col.anthropic, .workspace.ai-folded .col.openai { display: none; }
}
.cm-answer-body ul, .cm-answer-body ol { padding-left: 22px; margin: 6px 0; }

/* Invitados: «Probar sin registrarte» */
.gg { max-width: 520px; margin: 0 auto; padding: 0 16px 32px; }
.gg .q-empty { padding-top: 12px; }
.gg-who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.gg-opt { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--border2);
  background: var(--glass); color: inherit; font: inherit; cursor: pointer; }
.gg-opt span { font-size: .82rem; opacity: .75; }
.gg-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 76, 129, .14); }
.gg-card { margin-top: 0; }
.gg-card .run-btn { width: 100%; }
.guest-try { display: block; width: 100%; margin-top: 10px; text-align: center; }
.q-ttl .q-left { display: block; }
.q-guest { margin: 12px 0; }
.q-guest p { margin: 0 0 8px; }
.q-explore { display: flex; align-items: center; gap: 4px; flex: none; padding: 6px 12px 6px 6px; border-radius: var(--pill); border: 1px solid var(--border2);
  background: var(--glass); color: var(--accent); text-decoration: none; font-size: 12.5px; font-weight: 600; line-height: 1.15; }
.q-explore:hover { border-color: var(--accent); }
.gg-doc { font-size: 16px; }
.gg-brand { letter-spacing: -0.01em; }
.gg-brand sup.tm { font-size: .35em; vertical-align: super; }
.cm-contact { text-align: center; margin-top: 10px; } .cm-contact a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.guest-gate .q-ttl strong { white-space: normal; line-height: 1.15; }
/* Portada de «Foto y pregunta» sin cuenta (estilo GPT): barra en línea, bloque opcional y pie */
.q-start { gap: 14px; }
.q-start .q-empty { padding-bottom: 0; }
.q-start .q-bar { position: static; border-top: 0; padding: 0; background: transparent; }
.q-opt { margin-top: 4px; }
.q-opt-h { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim, var(--muted)); }
.q-foot { text-align: center; padding: 6px 0 18px; }
.q-foot p { margin: 4px 0; }
.q-start .q-empty { padding-top: 8px; }
.q-start .q-row textarea { min-height: 128px; border-radius: 20px; }
.auth .hero .tag3 { font-size: 14px; font-weight: 600; color: var(--orange, #E8693A); margin-top: 6px; }
.q-svs { margin: 6px 0 0; text-align: center; }
.q-svs a { font-weight: 600; color: var(--accent); text-decoration: none; }
/* «Probar sin registrarte» (versión completa): aviso fijo arriba */
.guest-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--bg1)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-size: 14px; backdrop-filter: blur(8px); }
.guest-bar .gb-txt { display: flex; gap: 8px; align-items: flex-start; flex: 1 1 360px; }
.guest-bar .gb-txt svg { flex: none; margin-top: 2px; color: var(--accent); }
.guest-bar .gb-btns { display: flex; gap: 8px; flex-wrap: wrap; }
body.has-rail .guest-bar { margin-left: 0; }
body.has-rail .guest-bar { margin: 12px 32px 0 104px; }
@media (max-width: 720px) { body.has-rail .guest-bar { margin: 8px 12px 0; } }
body.guest-full .case-acts { display: none; }
