/* CVListo: estilos propios. La base (tokens, botones, campos, diálogos, header, pie) está en appita.css; las plantillas del CV, en cv.css. */

/* Editor + vista previa del documento. En escritorio van lado a lado (el documento no entra en 560px). */
:root { --col: 1240px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--space-5); max-width: var(--col); margin: 0 auto; padding: var(--space-5) var(--space-4) 100px; width: 100%; }
.editor { min-width: 0; }
.preview-col { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; min-width: 0; scrollbar-width: thin; }
.mobile-tabs { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-bottom: 110px; max-width: 560px; }
  .preview-col { position: static; max-height: none; overflow: visible; }
  .layout[data-tab="edit"] .preview-col, .layout[data-tab="preview"] .editor { display: none; }
  /* Editar / Vista previa: segmentado anclado abajo */
  .mobile-tabs { display: flex; gap: 2px; position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 4px; box-shadow: var(--shadow-pop); }
  .mobile-tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: 500 14px/20px var(--font-sans); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .mobile-tabs button[aria-selected="true"] { background: var(--app-strong); color: var(--on-app); }
}
@media (max-width: 640px) { .hide-sm { display: none; } }

/* Secciones plegables del editor */
.ed-sec { margin-bottom: 12px; padding: 0; }
.ed-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 16px; font: 500 15px/22px var(--font-sans); }
.ed-sec > summary::-webkit-details-marker { display: none; }
.ed-sec > summary::after { content: ""; width: 16px; height: 16px; margin-left: auto; background: currentColor; color: var(--muted); transition: transform .15s;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.ed-sec[open] > summary::after { transform: rotate(180deg); }
.ed-sec > summary .count { font: 500 12px/16px var(--font-sans); color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 6px; }
.ed-body { padding: 0 16px 16px; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid2.stack-sm { grid-template-columns: 1fr; } }
.entry-tools { display: flex; gap: 2px; }
.entry-tools button { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.entry-tools button:hover { background: var(--surface-2); color: var(--ink); }
.entry-tools button:disabled { opacity: .3; cursor: default; }

/* Colores de acento del documento */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.swatch { position: relative; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.swatch::after { content: ""; position: absolute; inset: -6px; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

/* Vista previa: la hoja es papel (blanca), como el PDF que sale */
.preview-wrap { position: relative; width: 100%; }
.sheet-scaler { transform-origin: top left; width: max-content; }

.steps-list { margin: 0 0 14px; padding-left: 1.2rem; display: grid; gap: 4px; }
.ex-group { margin: 6px 0 16px; }
.ex-group h3 { font: 500 12px/16px var(--font-sans); text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin-bottom: 8px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.ex-card { text-align: left; border: 1px solid var(--line); border-radius: var(--radius-md); background: none; color: var(--ink); padding: 12px; cursor: pointer; font: 500 14px/20px var(--font-sans); min-height: 56px; }
.ex-card:hover { border-color: var(--app-strong); background: var(--surface); }

#print-root { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
}

.cv-switch { border: 1px solid var(--line); background: none; color: var(--ink); border-radius: var(--radius-sm); min-height: 36px; padding: 0 10px; cursor: pointer; font: 500 13px/18px var(--font-sans); max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-pill { font: 500 12px/16px var(--font-sans); padding: 1px 6px; border-radius: var(--radius-sm); border: 1px solid currentColor; color: var(--success); }
.mobile-tabs button[aria-selected="true"] .score-pill { color: var(--on-app); }

.entry { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 12px 0; margin-bottom: 12px; }
.entry-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.entry-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px/20px var(--font-sans); }
.row-inline { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.photo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.photo-row img, .photo-row .ph { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }

/* Plantillas */
.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
@media (max-width: 480px) { .tpl-grid { grid-template-columns: repeat(2, 1fr); } }
.tpl-btn { position: relative; border: 1px solid var(--line); border-radius: var(--radius-md); background: none; color: var(--muted); padding: 8px; cursor: pointer; text-align: left; font: 500 13px/18px var(--font-sans); }
.tpl-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.tpl-btn[aria-pressed="true"] { border-color: var(--app-strong); background: var(--app-soft); color: var(--app-strong); }
.tpl-thumb { height: 58px; border-radius: var(--radius-sm); margin-bottom: 6px; background: #fff; position: relative; overflow: hidden; }
.tpl-thumb i { position: absolute; display: block; background: #d1d5db; border-radius: 2px; }

/* Puntaje ATS */
.ats { padding: var(--space-4); margin-bottom: var(--space-4); }
.ats-top { display: flex; align-items: center; gap: 14px; }
.ring { --p: 0; --c: var(--success); width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 54px; height: 54px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font: 600 18px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.ats h3 { font: 600 15px/22px var(--font-sans); }
.ats ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.ats li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; }
.ats li svg.i { width: 16px; height: 16px; margin-top: 2px; color: var(--danger); }
.ats li.ok svg.i { color: var(--success); }
.ats .more { border: 0; background: none; color: var(--app-strong); font: 500 14px/20px var(--font-sans); cursor: pointer; padding: 6px 0 0; text-decoration: underline; text-underline-offset: 3px; }

.cv-list { list-style: none; padding: 0; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.cv-list li { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 8px 8px 16px; }
.cv-list li + li { border-top: 1px solid var(--line); }
.cv-list li.current { background: var(--app-soft); }
.cv-list .main { flex: 1; min-width: 0; cursor: pointer; }
.cv-list .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 15px/22px var(--font-sans); }

/* Modo claro (colorido 2005) */
[data-theme="light"] .ed-sec > summary { font-weight: 700; }
[data-theme="light"] .ed-sec > summary::after { color: var(--ink); }
[data-theme="light"] .ed-sec > summary .count { border: 0; background: var(--surface-2); color: var(--ink); font-weight: 700; }
[data-theme="light"] .entry-tools button { color: var(--ink); }
[data-theme="light"] .swatch { border-color: var(--surface); }
[data-theme="light"] .ex-group h3 { color: var(--ink); font-weight: 700; }
[data-theme="light"] .ex-card { background: var(--surface); border: 2px solid var(--line-strong); border-radius: 14px; font-weight: 600; }
[data-theme="light"] .ex-card:hover { background: var(--app-soft); border-color: var(--app-strong); }
[data-theme="light"] .preview-col .sheet-scaler, [data-theme="light"] .preview-wrap > * { filter: drop-shadow(0 4px 0 var(--line-strong)); }
@media (max-width: 900px) {
  [data-theme="light"] .mobile-tabs { border: 2px solid var(--line-strong); border-radius: var(--radius-pill); box-shadow: var(--shadow-card); }
  [data-theme="light"] .mobile-tabs button { color: var(--ink); font-weight: 700; border-radius: var(--radius-pill); }
  [data-theme="light"] .mobile-tabs button[aria-selected="true"] { box-shadow: var(--shadow-button); }
}
[data-theme="light"] .cv-switch, [data-theme="light"] .tpl-btn { background: var(--surface); border: 2px solid var(--line-strong); font-weight: 600; }
[data-theme="light"] .ap-header .cv-switch { border-color: transparent; color: var(--ink); }
[data-theme="light"] .tpl-btn { color: var(--ink); border-radius: 14px; }
[data-theme="light"] .tpl-btn[aria-pressed="true"] { border-color: var(--app-strong); background: var(--app-soft); color: var(--app-strong); }
[data-theme="light"] .tpl-thumb { border: 1px solid var(--line); }
[data-theme="light"] .ring span { background: var(--surface); font-weight: 800; }
[data-theme="light"] .entry { background: var(--surface); border: 2px solid var(--line-strong); border-radius: 14px; }
[data-theme="light"] .entry-head b { font-weight: 700; }
[data-theme="light"] .cv-list { border: 2px solid var(--line-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-card); }
[data-theme="light"] .cv-list li + li { border-top: 2px dashed var(--line); }
[data-theme="light"] .cv-list .main b { font-weight: 700; }
