/* Honshitsu Dojo — panel de administración */
:root {
  --ink: #0a0b0c;
  --text: #1b1d1f;
  --muted: #6d6a64;
  --faint: #9a968e;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --sunken: #efece5;
  --line: rgba(10, 11, 12, 0.08);
  --line-strong: rgba(10, 11, 12, 0.14);
  --red: #c41218;
  --red-dark: #a10e13;
  --red-soft: rgba(196, 18, 24, 0.07);
  --warn: #8f5300;
  --warn-bg: #fbf0dc;
  --ok: #2f5a2c;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(10, 11, 12, 0.05);
  --shadow: 0 1px 2px rgba(10, 11, 12, 0.04), 0 4px 16px rgba(10, 11, 12, 0.05);
  --shadow-lg: 0 24px 64px rgba(10, 11, 12, 0.28);
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  --jp: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

a { color: inherit; }
h1, h2, p { margin: 0; }
img, video { display: block; max-width: 100%; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ico { flex: none; }
.muted { color: var(--faint); font-weight: 400; }

/* ---------- Hanko ---------- */
.hanko {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-family: var(--jp);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--red);
  width: 26px;
  height: 46px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
  flex: none;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 550;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--red); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { border-color: rgba(10, 11, 12, 0.28); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--sunken); }
.btn-danger { background: var(--ink); color: #fff; }
.btn-danger:hover { background: var(--red); }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: rgba(196, 18, 24, 0.25); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: var(--red); }
.btn.is-busy { opacity: 0.6; pointer-events: none; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, .photo-thumb:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover:not(:disabled) { background: var(--sunken); }
.icon-btn:disabled { opacity: 0.28; cursor: default; }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-soft); }

/* ---------- Formularios ---------- */
.stack { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field.grow { flex: 1; min-width: 0; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.help { font-size: 12px; color: var(--muted); }

input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

.file-input {
  font: inherit;
  font-size: 13px;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 100%;
}

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--sunken);
  border-radius: var(--radius-sm);
  width: fit-content;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  padding: 7px 16px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--red); }

[data-pdf-field].is-muted { opacity: 0.45; }
.current-file { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.current-file a { color: var(--red); font-weight: 550; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  padding: 24px;
}
.login-card {
  width: min(380px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 24px;
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.login-sub { color: var(--muted); font-size: 13px; }
.login-foot { font-size: 12px; color: var(--muted); text-align: center; }
.login-back { font-size: 13px; color: var(--muted); text-decoration: none; }
.login-back:hover { color: var(--text); }
.inline-error {
  background: var(--red-soft);
  color: var(--red-dark);
  border: 1px solid rgba(196, 18, 24, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-card .inline-error { margin: 0; }

/* ---------- Estructura ---------- */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  text-decoration: none;
}
.brand-text { display: grid; line-height: 1.25; }
.brand-text strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-text small { font-size: 12px; color: var(--muted); }

.nav { display: grid; gap: 2px; }
.nav-label, .eyebrow, .viewer-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.nav-label { padding: 0 10px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 520;
  transition: background-color 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--sunken); color: var(--text); }
.nav-item.on { background: var(--sunken); color: var(--ink); font-weight: 600; }
.nav-item.on .ico { color: var(--red); }
.nav-text { flex: 1; }
.count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-item.on .count { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.sidebar-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid var(--line); }

.main {
  margin-left: var(--sidebar);
  padding: 40px 48px 80px;
  max-width: calc(var(--sidebar) + 1120px);
}

/* ---------- Encabezado de página ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.page-head h1 { font-size: 26px; font-weight: 680; letter-spacing: -0.02em; margin: 4px 0 6px; color: var(--ink); }
.page-sub { color: var(--muted); max-width: 60ch; }
.page-actions { display: flex; gap: 8px; flex: none; }

/* ---------- Paneles ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
  scroll-margin-top: 24px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.panel-head h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.panel-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.count-pill {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.count-pill.is-warn { background: var(--warn-bg); color: var(--warn); }
.warn-text { color: var(--warn); font-style: normal; font-weight: 550; }
.empty-inline { color: var(--muted); }

.panel.is-flash, .post.is-flash { animation: flash 2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--red-soft), var(--shadow-sm); } 100% { box-shadow: var(--shadow-sm); } }

/* ---------- Resumen ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  min-width: 0;
}
.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-label .ico { color: var(--red); width: 16px; height: 16px; }
.stat-value { font-size: 30px; font-weight: 680; letter-spacing: -0.03em; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value-sm { font-size: 17px; letter-spacing: -0.01em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 0; }
.row-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); background: var(--sunken); }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.strip {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 132px;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.strip a { display: grid; gap: 6px; text-decoration: none; }
.strip img { width: 132px; height: 132px; object-fit: cover; border-radius: var(--radius-sm); background: var(--sunken); transition: opacity 0.15s; }
.strip a:hover img { opacity: 0.85; }
.strip-label { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-date { font-size: 11px; color: var(--muted); margin-top: -4px; }

/* ---------- Badges ---------- */
.badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.badge-warn .ico { width: 13px; height: 13px; }

.chip {
  position: absolute;
  top: 10px;
  left: 44px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.chip-accent { background: var(--red); color: #fff; }
.chip-dark { background: rgba(10, 11, 12, 0.72); color: #fff; }
.chip-br { top: auto; left: auto; right: 10px; bottom: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--sunken);
  color: var(--muted);
}
.pill-noticia { background: var(--red-soft); color: var(--red); }
.pill-pdf { background: var(--ink); color: #fff; }

/* ---------- Subida ---------- */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfaf7;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--red); background: var(--red-soft); }
.dropzone:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dz-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--red);
  margin-bottom: 4px;
}
.dz-title { font-weight: 600; color: var(--ink); }
.dz-link { color: var(--red); text-decoration: underline; text-underline-offset: 3px; font-weight: 550; }
.dz-hint { font-size: 12px; color: var(--muted); max-width: 56ch; }
.upload-compact .dropzone { padding: 20px; }

.dz-previews {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.dz-previews li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 0;
}
.dz-previews li.is-low { border-color: rgba(143, 83, 0, 0.35); background: #fffaf1; }
.dz-thumb {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 5px;
  overflow: hidden;
  background: var(--sunken);
}
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dz-thumb.is-file { display: grid; place-items: center; font-size: 10px; font-weight: 650; color: var(--muted); text-transform: uppercase; }
.dz-info { min-width: 0; }
.dz-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.upload-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 16px;
}
.upload-compact { margin-bottom: 20px; }
.upload-compact .upload-row { margin-top: 12px; }
.yt-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.yt-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.yt-title .ico { color: var(--red); }
.chip .ico { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }

/* ---------- Grilla de fotos ---------- */
.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.photo {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  scroll-margin-top: 24px;
}
.photo:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.photo.is-flash { animation: flash 2s ease; }

.photo-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--sunken);
  cursor: zoom-in;
  overflow: hidden;
}
.photo-grid-tall .photo-thumb { aspect-ratio: 3 / 4; }
.photo-thumb img, .photo-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.photo:hover .photo-thumb img { transform: scale(1.03); }
.photo-pos {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}
.photo-zoom {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 11, 12, 0.6);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}
.photo:hover .photo-zoom { opacity: 1; }
.photo-zoom .ico { width: 15px; height: 15px; }

.photo-body { padding: 12px 14px 4px; display: grid; gap: 4px; }
.photo-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.res { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.photo-caption {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-caption.is-empty { color: var(--faint); font-style: italic; }
.photo-date { font-size: 12px; color: var(--muted); }

.photo-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 8px;
  margin-top: auto;
}
.photo-actions form { display: contents; }
.photo-actions .spacer { flex: 1; }

@media (hover: hover) and (min-width: 861px) {
  .photo-actions { opacity: 0.35; transition: opacity 0.15s; }
  .photo:hover .photo-actions, .photo:focus-within .photo-actions { opacity: 1; }
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fbfaf7;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--faint);
  margin-bottom: 6px;
}
.empty-title { font-weight: 650; color: var(--ink); }
.empty-text { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ---------- Blog ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px 12px;
  margin: 0 -12px;
  border-top: 1px solid var(--line);
  border-radius: var(--radius-sm);
  scroll-margin-top: 24px;
}
.post:first-child { border-top: 0; }
.post:hover { background: #fbfaf7; }
.post.is-current { background: var(--red-soft); }
.post .pill { margin-top: 2px; }
.post-title { font-weight: 620; color: var(--ink); }
.post-excerpt { color: var(--muted); font-size: 13px; margin-top: 4px; }
.post-meta { color: var(--faint); font-size: 12px; margin-top: 6px; }
.post-meta a { color: var(--red); font-weight: 550; }
.post-actions { display: flex; gap: 6px; }
.post-actions form { margin: 0; }
.panel.is-editing { border-color: rgba(196, 18, 24, 0.3); box-shadow: 0 0 0 3px var(--red-soft); }

/* ---------- Ubicación ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.split .panel { margin-bottom: 0; }
.map-panel { position: sticky; top: 24px; }
.map-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--sunken);
  margin-bottom: 12px;
}
.map-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-q { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.map-q .ico { color: var(--red); margin-top: 1px; width: 16px; height: 16px; }

/* ---------- Visor ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.viewer-backdrop { position: absolute; inset: 0; background: rgba(10, 11, 12, 0.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.viewer-dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  width: min(1240px, 100%);
  height: min(820px, calc(100vh - 48px));
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
.viewer-stage { position: relative; background: #111214; display: grid; place-items: center; min-height: 0; }
.viewer-media { width: 100%; height: 100%; display: grid; place-items: center; padding: 24px; min-height: 0; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.viewer-media .viewer-yt { width: 100%; max-height: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 4px; background: #000; }
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s;
}
.viewer-nav:hover { background: rgba(255, 255, 255, 0.24); }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }
.viewer-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}
.viewer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.viewer-title { font-size: 16px; font-weight: 650; color: var(--ink); margin-top: 4px; }
.viewer-info { margin: 0; display: grid; gap: 10px; padding: 14px; background: #fbfaf7; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.viewer-info div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.viewer-info dt { font-size: 12px; color: var(--muted); }
.viewer-info dd { margin: 0; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.viewer-hint { font-size: 12px; color: var(--warn); background: var(--warn-bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.viewer-caption { display: grid; gap: 8px; }
.viewer-caption .btn { justify-self: start; }
.viewer-label { margin-bottom: -8px; }
.viewer-row { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-row form { margin: 0; }
.viewer-delete { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Modal de confirmación ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 11, 12, 0.5); }
.modal-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.15s ease;
}
.modal-title { font-weight: 650; font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.modal-text { color: var(--muted); margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #f3f1ec;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
.toast p { flex: 1; font-size: 13px; padding-top: 1px; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: #6fbf73; }
.toast-err .toast-dot { background: #ff5a55; }
.toast-x { border: 0; background: transparent; color: rgba(255, 255, 255, 0.6); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.toast-x:hover { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 32px 32px 72px; }
}

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .map-panel { position: static; }
  .viewer-dialog { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - 32px); }
  .viewer-side { border-left: 0; border-top: 1px solid var(--line); max-height: 48vh; }
}

@media (max-width: 860px) {
  body { font-size: 15px; }
  .sidebar {
    position: sticky;
    top: 0;
    inset: auto;
    width: auto;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 10px 12px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .brand { padding: 0 4px; flex: 1; }
  .brand .hanko { width: 22px; height: 38px; font-size: 11px; }
  .sidebar-foot { order: 2; margin: 0; padding: 0; border: 0; display: flex; gap: 0; }
  .sidebar-foot .nav-text { display: none; }
  .sidebar-foot .nav-item { width: 42px; height: 42px; justify-content: center; padding: 0; }
  .nav {
    order: 3;
    flex-basis: 100%;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 0 10px;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .nav-item { flex: none; min-height: 40px; border: 1px solid var(--line); background: var(--surface); }
  .nav-item.on { background: var(--ink); color: #fff; border-color: var(--ink); }
  .nav-item.on .ico { color: #fff; }
  .nav-item.on .count { background: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; }
  .main { margin-left: 0; padding: 24px 16px 96px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 24px; }
  .page-head h1 { font-size: 23px; }
  .page-actions .btn { flex: 1; min-height: 44px; }
  .panel { padding: 16px; border-radius: var(--radius); }
  .panel-head { flex-wrap: wrap; }
  .stats { gap: 10px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 26px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .photo-body { padding: 10px 10px 2px; }
  .photo-actions { padding: 4px; border-top: 1px solid var(--line); margin-top: 8px; }
  .photo-actions .spacer { display: none; }
  .photo-actions .icon-btn { flex: 1; width: auto; min-width: 0; height: 42px; }
  .icon-btn { width: 40px; height: 40px; }
  .chip { left: auto; right: 8px; top: 8px; }
  .chip-br { top: auto; bottom: 8px; }
  .photo-pos { top: 8px; left: 8px; }
  .photo-zoom { display: none; }
  .upload-row { flex-direction: column; align-items: stretch; }
  .upload-row .btn, .form-actions .btn { min-height: 46px; flex: 1; }
  .dz-previews { grid-template-columns: 1fr; }
  .post { grid-template-columns: 1fr; gap: 8px; margin: 0; padding: 16px 0; }
  .post .pill { justify-self: start; }
  .post-actions .btn { min-height: 40px; }
  .row { grid-template-columns: 48px minmax(0, 1fr); }
  .row .btn { grid-column: 1 / -1; }
  .row-thumb { width: 48px; height: 48px; }
  .viewer { padding: 0; }
  .viewer-dialog { height: 100vh; height: 100dvh; border-radius: 0; }
  .viewer-media { padding: 8px; }
  .viewer-nav { width: 40px; height: 40px; }
  .viewer-nav.prev { left: 8px; }
  .viewer-nav.next { right: 8px; }
  .viewer-side { padding: 16px; gap: 12px; }
  .viewer-row .btn, .viewer-row label.btn { min-height: 42px; }
  .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; }
  input[type="text"], input[type="password"], textarea { font-size: 16px; min-height: 44px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-value-sm { white-space: normal; }
  .photo-caption { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
