/* BRISA — panel privado (móvil primero) */
:root {
  --ink: #111D2B; --ivory: #F8F5ED; --ivory-2: #EFEADD; --orange: #E65B29; --orange-dark: #C9461A;
  --line: rgba(17, 29, 43, .14); --muted: #5B6573; --ok: #1F7A4D; --bad: #B3261E;
  --serif: "Fraunces", Georgia, serif; --sans: "DM Sans", system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, p { margin: 0; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.loading, .noscript { padding: 40px 20px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; font-weight: 600; text-decoration: none; transition: background .2s, color .2s;
}
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-accent { background: var(--orange); color: #fff; }
.btn-accent:hover { background: var(--orange-dark); }
.btn-ink { background: var(--ink); color: var(--ivory); }
.btn-ghost { border: 1.5px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--ivory); }
.btn-block { width: 100%; }
.link { text-decoration: underline; padding: 6px 4px; }
.danger { color: var(--bad); }

/* acceso */
.auth { max-width: 420px; margin: 0 auto; padding: 56px 22px; display: grid; gap: 18px; }
.auth-brand { font-family: var(--serif); font-size: 22px; letter-spacing: .06em; }
.auth-error { color: var(--bad); font-weight: 600; }
.back-site { justify-self: center; font-size: 14px; color: var(--muted); }

/* estructura */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; background: var(--ink); color: var(--ivory); position: sticky; top: 0; z-index: 10; }
.top-brand { font-family: var(--serif); font-size: 20px; text-decoration: none; }
.top-brand small { font-family: var(--sans); font-size: 12px; opacity: .7; text-transform: uppercase; letter-spacing: .12em; }
.top-actions { display: flex; gap: 14px; align-items: center; font-size: 15px; }
.top-actions a, .top-actions .link { color: var(--ivory); }
.tabs { display: flex; overflow-x: auto; gap: 4px; padding: 8px 12px; background: var(--ivory-2); border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.tabs a { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; }
.tabs a[aria-current] { background: var(--ink); color: var(--ivory); }
.panel { max-width: 880px; margin: 0 auto; padding: 22px 16px 120px; display: grid; gap: 18px; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.back { text-decoration: none; font-weight: 600; }
.empty { padding: 22px; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; gap: 6px; list-style: none; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 12px; }

/* campos */
.field { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea, .embed-row input {
  width: 100%; font: inherit; font-weight: 400; font-size: 16px; color: var(--ink);
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus, .embed-row input:focus { outline: none; border-color: var(--ink); }
.field-sm input, .field-sm select { padding: 9px 12px; font-size: 15px; }

/* lista de trabajos */
.job-list { display: grid; gap: 10px; }
.job-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 12px; align-items: center; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.job-row img, .job-row .ph { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; grid-row: span 2; background: var(--ivory-2); }
.job-row-body { display: grid; min-width: 0; }
.job-row-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .status-hero { grid-column: 3; }
.status { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; white-space: nowrap; justify-self: end; }
.status-draft { background: var(--ivory-2); color: var(--muted); }
.status-published { background: #DDF1E6; color: var(--ok); }
.status-hero { background: var(--orange); color: #fff; }

/* editor */
.editor { display: grid; gap: 16px; }
.media-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 14px; }
.media-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.uploader { display: grid; gap: 10px; }
.upload-btn { cursor: pointer; }
.embed-row { display: flex; gap: 8px; }
.embed-row input { flex: 1; min-width: 0; }
.progress-list { display: grid; gap: 8px; }
.progress { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.p-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-bar { grid-column: span 2; height: 6px; border-radius: 99px; background: var(--ivory-2); overflow: hidden; grid-row: 2; }
.p-bar span { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }
.progress.ok .p-bar span { background: var(--ok); }
.progress.bad { color: var(--bad); }
.progress.bad .p-name { white-space: normal; }
.progress.bad .p-bar span { background: var(--bad); }

.media-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.media-item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--ivory); }
.media-item.is-cover { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.mi-thumb { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--ink); }
.mi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ph-video { display: grid; place-items: center; width: 100%; height: 100%; color: var(--ivory); font-size: 26px; }
.mi-kind { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(17, 29, 43, .8); color: var(--ivory); }
.mi-fields { display: grid; gap: 8px; min-width: 0; }
.mi-tools { grid-column: span 2; display: flex; gap: 8px; }
.tool { min-width: 44px; min-height: 40px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tool span { font-size: 13px; font-weight: 600; }
.tool.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.tool[disabled] { opacity: .35; }
.tool.danger { margin-left: auto; color: var(--bad); }
.pair-hint { margin-top: -4px; }

.editor-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--ivory) 30%);
}
.editor-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }

/* portada */
.hero-list { display: grid; gap: 10px; }
.hero-opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.hero-opt input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--orange); flex: 0 0 auto; }
.hero-opt > span { display: grid; }
.hero-opt:has(input:checked) { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }

/* empresa */
.settings, .pw { display: grid; gap: 14px; }
.settings .btn, .pw .btn { justify-self: start; }
.logo-row { min-height: 40px; }
.logo-prev { max-height: 64px; width: auto; background: var(--ivory-2); padding: 8px; border-radius: 8px; }

/* solicitudes */
.quotes { display: grid; gap: 10px; }
.quote-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; }
.quote-item.done { opacity: .6; }
.quote-item header, .quote-item footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.quote-item footer label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* avisos */
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--ivory);
  font-weight: 600; z-index: 50; transition: transform .3s; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

@media (min-width: 720px) {
  .panel { padding: 32px 24px 120px; }
  .media-item { grid-template-columns: 120px 1fr auto; }
  .mi-thumb { width: 120px; height: 120px; }
  .mi-fields { grid-template-columns: 1fr 1fr; }
  .mi-fields .field:last-child { grid-column: span 2; }
  .mi-tools { grid-column: auto; flex-direction: column; }
  .tool.danger { margin-left: 0; margin-top: auto; }
}

/* textos y garantías */
.texts { display: grid; gap: 14px; }
.rows { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: #fff; }
.rows legend, .trust legend { font-weight: 700; padding: 0 6px; }
.rows legend small, .trust legend small { font-weight: 400; color: var(--muted); }
.row { display: grid; gap: 6px; grid-template-columns: 1fr auto; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.row > :not(.tool):not(.check) { grid-column: 1; }
.row .tool { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.row input, .row textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; }
.trust { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: #fff; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); }
.q-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.q-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }

/* imágenes fijas */
.img-slots { display: grid; gap: 12px; }
.img-slot { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.img-prev { width: 120px; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--ivory-2); display: grid; place-items: center; text-align: center; padding: 4px; }
.img-prev.wide { aspect-ratio: 21 / 9; align-self: center; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.img-body { display: grid; gap: 6px; min-width: 0; }
.img-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.img-actions .btn { min-height: 42px; padding: 0 16px; font-size: 15px; }
.img-status { color: var(--muted); }
