/* Balda Garage · Panel */
.admin { background: var(--bg); min-height: 100vh; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 500px at 50% 0%, rgba(255,90,31,.14), transparent 60%); }
.gate-card { width: min(400px, 100%); padding: 36px 32px; display: flex; flex-direction: column; gap: 16px; text-align: center; }
.gate-card .logo-mark { width: 52px; height: 52px; margin: 0 auto 4px; }
.gate-card h1 { margin: 0; font-family: var(--ff-display); font-stretch: 115%; font-size: 26px; letter-spacing: -.02em; }
.gate-card p { margin: 0; color: var(--muted); }
.gate-card .field { text-align: left; }
.gate-err { color: var(--danger) !important; font-weight: 600; font-size: 14px; }
.gate-back { color: var(--muted); font-size: 14px; }
.gate-back:hover { color: var(--text); }

.a-header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px;
  padding: 14px var(--gutter); background: rgba(11,12,14,.85); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.a-status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.a-status .pill { padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.a-status .pill.draft { background: rgba(255,194,71,.15); color: var(--warn); }
.a-status .pill.clean { background: rgba(61,220,151,.12); color: var(--ok); }
.a-header-actions { margin-left: auto; display: flex; gap: 8px; }

.a-main { max-width: 1180px; margin: 0 auto; padding: 32px var(--gutter) 80px; }
.a-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.a-stat { padding: 18px 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.a-stat b { display: block; font-family: var(--ff-display); font-stretch: 115%; font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.a-stat span { font-size: 13px; color: var(--muted); }
.a-stat.accent b { color: var(--accent); }

.a-list-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.a-list-tools .search-box { max-width: none; }
.a-select { appearance: none; height: 46px; padding: 0 40px 0 16px; border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238b9098' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 15px center; border: 1px solid var(--line-2); font-weight: 500; }

.a-rows { display: flex; flex-direction: column; gap: 8px; }
.a-row {
  display: grid; grid-template-columns: 96px 1fr auto auto; gap: 18px; align-items: center;
  padding: 10px 14px 10px 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .2s, background .2s;
}
.a-row:hover { border-color: var(--line-2); background: var(--surface-2); }
.a-thumb { width: 96px; height: 68px; border-radius: 10px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); position: relative; }
.a-thumb img { width: 100%; height: 100%; object-fit: cover; }
.a-thumb .star { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; padding: 3px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }
.a-row h4 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.a-row p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.a-row .a-price { font-family: var(--ff-display); font-stretch: 110%; font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-row select {
  appearance: none; height: 34px; padding: 0 30px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23c4c6ca' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 11px center;
}
.a-row select[data-v="disponible"] { background-color: rgba(61,220,151,.14); color: var(--ok); }
.a-row select[data-v="reservado"] { background-color: rgba(255,194,71,.15); color: var(--warn); }
.a-row select[data-v="vendido"] { background-color: rgba(255,255,255,.1); color: var(--text-2); }
.a-row select[data-v="oculto"] { background-color: rgba(255,77,94,.12); color: var(--danger); }
.a-empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r); }

.a-help { margin-top: 32px; padding: 24px 28px; border-radius: var(--r-lg); }
.a-help h3 { margin: 0 0 10px; font-size: 17px; }
.a-help ol { margin: 0 0 18px; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; font-size: 14.5px; }
.a-help code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.a-help .help-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Editor */
.editor {
  width: min(880px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0;
  border: 1px solid var(--line-2); border-radius: var(--r-xl); background: var(--surface); color: var(--text);
  box-shadow: 0 40px 120px -20px rgba(0,0,0,.9); overflow: hidden;
}
.editor[open] { animation: dialogIn .35s var(--ease); }
.editor::backdrop { background: rgba(5,6,8,.75); backdrop-filter: blur(4px); }
.ed { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.ed-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 28px 18px; border-bottom: 1px solid var(--line); }
.ed-head .kicker { margin-bottom: 6px; }
.ed-head h2 { margin: 0; font-family: var(--ff-display); font-stretch: 112%; font-size: 26px; letter-spacing: -.02em; }
.ed-body { overflow-y: auto; padding: 8px 28px 28px; overscroll-behavior: contain; }
.ed-section { padding: 22px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.ed-section:last-child { border-bottom: 0; }
.ed-section h3 { margin: 0; font-size: 15px; font-weight: 700; }
.ed-section h3 small, .field small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.ed-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ed-grid .span-2 { grid-column: span 2; }
.ed-private { background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(255,255,255,.012) 12px 24px); margin: 0 -28px; padding-inline: 28px; }
.seg-4 { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg-4 label span { width: 100%; height: 42px; }
.ed-foot { display: flex; gap: 8px; align-items: center; padding: 16px 28px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.ed-foot .spacer { flex: 1; }
.btn.danger:hover { color: var(--danger); border-color: rgba(255,77,94,.4); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.photos:empty { display: none; }
.ph { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 2px solid transparent; }
.ph:first-child { border-color: var(--accent); }
.ph:first-child::before { content: "Portada"; position: absolute; left: 6px; top: 6px; z-index: 1; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-tools { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; padding: 6px; background: linear-gradient(0deg, rgba(0,0,0,.75), transparent); opacity: 0; transition: opacity .2s; }
.ph:hover .ph-tools, .ph:focus-within .ph-tools { opacity: 1; }
@media (hover: none) { .ph-tools { opacity: 1; } }
.ph-tools button { width: 30px; height: 30px; border-radius: 8px; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(6px); }
.ph-tools button:hover { background: rgba(255,255,255,.28); }
.ph-tools button svg { width: 16px; height: 16px; }
.ph.loading { display: grid; place-items: center; }
.ph.loading::after { content: ""; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.photo-tools { display: grid; grid-template-columns: 1fr; gap: 10px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border-radius: var(--r);
  border: 1.5px dashed var(--line-2); background: var(--bg-2); cursor: pointer; text-align: center; transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 30px; height: 30px; color: var(--accent); }
.drop small { color: var(--muted); }
.url-add { display: flex; gap: 8px; }
.url-add input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); outline: none; font-size: 14px; }
.url-add input:focus { border-color: var(--accent); }

.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.tag-suggest button { height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
.tag-suggest button:hover { color: var(--text); border-color: var(--accent); }

@media (max-width: 860px) {
  .a-header { flex-wrap: wrap; gap: 10px 16px; }
  .a-header-actions { width: 100%; margin: 0; flex-wrap: wrap; }
  .a-header-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
  .a-header-actions #btnExport { flex-basis: 100%; }
  .a-header-actions .btn span { font-size: 13px; }
  .a-stats { grid-template-columns: repeat(2, 1fr); }
  .a-row { grid-template-columns: 76px 1fr; gap: 12px; }
  .a-thumb { width: 76px; height: 58px; }
  .a-row .a-price, .a-row select { grid-column: 2; justify-self: start; }
  .a-row .a-price { font-size: 16px; margin-top: -4px; }
  .ed-grid { grid-template-columns: 1fr 1fr; }
  .seg-4 { grid-template-columns: 1fr 1fr; }
  .editor { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .ed { max-height: 100dvh; height: 100dvh; }
  .ed-head, .ed-body, .ed-foot { padding-inline: 18px; }
  .ed-private { margin: 0 -18px; padding-inline: 18px; }
  .ed-foot .btn span { display: none; }
  .ed-foot .btn { padding: 0 16px; }
  .a-list-tools .btn { width: 100%; }
}

.fin-fields { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); }
.fin-fields[hidden] { display: none !important; }
.fin-fields .field input { background: var(--surface); }
#finPlazos label span { min-width: 46px; }
.a-fin { color: var(--ok); }
